Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-08-21 21:00:00 +0200
committerMartin Hořeňovský2021-08-21 21:00:00 +0200
commit928ecbaccf7f4ae8dfae2c1a649e2ee461bcb450 (patch)
treec95a5b4c6b960ce0b3976c706b9efbd6e2d9d7f7 /src/catch2
parent1cbbc5d2cbac7f497fa5e2128f6779ee2e5fb510 (diff)
downloadcatch3-928ecbaccf7f4ae8dfae2c1a649e2ee461bcb450.tar.gz
Change callable/model::clone to return a unique_ptr
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/benchmark/detail/catch_benchmark_function.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
index d70f5200..655c8635 100644
--- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp
+++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
@@ -36,7 +36,7 @@ namespace Catch {
private:
struct callable {
virtual void call(Chronometer meter) const = 0;
- virtual callable* clone() const = 0;
+ virtual Catch::Detail::unique_ptr<callable> clone() const = 0;
virtual ~callable(); // = default;
callable() = default;
@@ -48,7 +48,9 @@ namespace Catch {
model(Fun&& fun_) : fun(CATCH_MOVE(fun_)) {}
model(Fun const& fun_) : fun(fun_) {}
- model<Fun>* clone() const override { return new model<Fun>(*this); }
+ Catch::Detail::unique_ptr<callable> clone() const override {
+ return Catch::Detail::make_unique<model<Fun>>( *this );
+ }
void call(Chronometer meter) const override {
call(meter, is_callable<Fun(Chronometer)>());
@@ -90,7 +92,7 @@ namespace Catch {
}
BenchmarkFunction& operator=(BenchmarkFunction const& that) {
- f.reset(that.f->clone());
+ f = that.f->clone();
return *this;
}