diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-15 17:09:59 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-15 17:09:59 +0200 |
commit | 840675f45d1245732b0f3ae5c1a5b4fc5fffec7b (patch) | |
tree | 1dae1b4a45d2e9d5cf59d475d9096112b15c7add | |
parent | c2bb6da6cf469e44129ccc9f13e60e74d3cedef4 (diff) |
replace with std::unique_ptrfeature/c++11
-rw-r--r-- | include/cppunit/extensions/HelperMacros.h | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index e883960..3dfab2d 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -165,24 +165,15 @@ */ #define CPPUNIT_TEST_SUITE_END() \ } \ - \ - struct CppUnitExDeleter { /* avoid deprecated auto_ptr warnings */ \ - CPPUNIT_NS::TestSuite *suite; \ - CppUnitExDeleter() : suite (nullptr) {} \ - ~CppUnitExDeleter() { delete suite; } \ - CPPUNIT_NS::TestSuite *release() { \ - CPPUNIT_NS::TestSuite *tmp = suite; suite = nullptr; return tmp; \ - } \ - }; \ \ public: \ static CPPUNIT_NS::TestSuite *suite() \ { \ const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \ - CppUnitExDeleter guard; \ - guard.suite = new CPPUNIT_NS::TestSuite( namer.getFixtureName() ); \ + std::unique_ptr<CPPUNIT_NS::TestSuite> guard( \ + new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \ CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \ - CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.suite, \ + CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.get(), \ namer, \ factory ); \ TestFixtureType::addTestsToSuite( context ); \ |