diff options
-rw-r--r-- | libadhocutil/lazyPointer.h | 13 | ||||
-rw-r--r-- | libadhocutil/unittests/testLazyPointer.cpp | 4 |
2 files changed, 6 insertions, 11 deletions
diff --git a/libadhocutil/lazyPointer.h b/libadhocutil/lazyPointer.h index bb41bc2..9188d24 100644 --- a/libadhocutil/lazyPointer.h +++ b/libadhocutil/lazyPointer.h @@ -26,24 +26,19 @@ class LazyPointer { /// @endcond /** Construct pointer with a factory function. */ - explicit LazyPointer(const Factory & f) : + // NOLINTNEXTLINE(hicpp-explicit-conversions) + LazyPointer(Factory f) : source(f) { } /** Construct pointer with an instance value. */ - explicit LazyPointer(const P & p) : + // NOLINTNEXTLINE(hicpp-explicit-conversions) + LazyPointer(P p) : source(p) { } - /** Construct pointer with an instance value. */ - template <typename TT = T> - explicit LazyPointer(T * p, typename std::enable_if<!std::is_same<TT *, P>::value>::type * = nullptr) : - source(P(p)) - { - } - /** Construct pointer with no factory or value. */ LazyPointer() : source(P(NULL)) diff --git a/libadhocutil/unittests/testLazyPointer.cpp b/libadhocutil/unittests/testLazyPointer.cpp index 1709742..31b92a5 100644 --- a/libadhocutil/unittests/testLazyPointer.cpp +++ b/libadhocutil/unittests/testLazyPointer.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE ( islazy ) BOOST_AUTO_TEST_CASE ( preinit ) { Test * t = new Test(4); - TestLazyPointer p(t); + TestLazyPointer p(TestLazyPointer::pointer_type{ t }); BOOST_REQUIRE_EQUAL(true, p.hasValue()); BOOST_REQUIRE_EQUAL(p, t); BOOST_REQUIRE_EQUAL(4, p->val); @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE ( preinit ) BOOST_AUTO_TEST_CASE ( reset ) { Test * t = new Test(4); - TestLazyPointer p(t); + TestLazyPointer p(TestLazyPointer::pointer_type{ t }); BOOST_REQUIRE_EQUAL(true, p.hasValue()); BOOST_REQUIRE_EQUAL(4, p->val); p = nullptr; |