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

summaryrefslogtreecommitdiffhomepage
path: root/examples/300-Gen-OwnGenerator.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-02-01 21:43:00 +0100
committerMartin Hořeňovský2020-02-01 23:34:00 +0100
commitea6db670632204bace889f646ca08bfa58bddeab (patch)
treee47f559036a91dd062ae6400f2612c398c6a9014 /examples/300-Gen-OwnGenerator.cpp
parenta7b3e087a03f6ba33100c842445f16757d545fc0 (diff)
downloadcatch3-ea6db670632204bace889f646ca08bfa58bddeab.tar.gz
Use std::make_unique instead of our polyfill or naked new
The use we previously used the polyfill or naked new is that we supported C++11, which did not yet have `std::make_unique`. However, with the move to C++14 as the minimum, `std::make_unique` can be expected to be always available.
Diffstat (limited to 'examples/300-Gen-OwnGenerator.cpp')
-rw-r--r--examples/300-Gen-OwnGenerator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/300-Gen-OwnGenerator.cpp b/examples/300-Gen-OwnGenerator.cpp
index 427d7b24..0cb80c2f 100644
--- a/examples/300-Gen-OwnGenerator.cpp
+++ b/examples/300-Gen-OwnGenerator.cpp
@@ -40,7 +40,9 @@ int const& RandomIntGenerator::get() const {
// Notice that it returns an instance of GeneratorWrapper<int>, which
// is a value-wrapper around std::unique_ptr<IGenerator<int>>.
Catch::Generators::GeneratorWrapper<int> random(int low, int high) {
- return Catch::Generators::GeneratorWrapper<int>(std::unique_ptr<Catch::Generators::IGenerator<int>>(new RandomIntGenerator(low, high)));
+ return Catch::Generators::GeneratorWrapper<int>(
+ std::make_unique<RandomIntGenerator>(low, high)
+ );
}
// The two sections in this test case are equivalent, but the first one