diff --git a/Control/AthLinks/test/ElementLink_test.cxx b/Control/AthLinks/test/ElementLink_test.cxx index 430cd90295d35b16149d71ed8795431b7d416444..1a603dbf050ccb209c9748b2104b39fbbd76abbf 100644 --- a/Control/AthLinks/test/ElementLink_test.cxx +++ b/Control/AthLinks/test/ElementLink_test.cxx @@ -672,6 +672,9 @@ void test3 (SGTest::TestStore& store) TestStore::sgkey_t sgkey = store.stringToKey ("foocont3", fooclid); + //Add check to see if Element link optimized for std::vector expansion + static_assert(std::is_nothrow_move_constructible<ElementLink<FooCont>>::value); + FooCont* foocont3 = new FooCont; for (int i=0; i < 4; i++) foocont3->push_back (new Foo(i+200)); diff --git a/Control/CxxUtils/CxxUtils/CachedPointer.h b/Control/CxxUtils/CxxUtils/CachedPointer.h index 005acdaccfe0f9be6c87657212744654e001c23a..624d182912b3e3076c2cc400205e42f6f67df59e 100644 --- a/Control/CxxUtils/CxxUtils/CachedPointer.h +++ b/Control/CxxUtils/CxxUtils/CachedPointer.h @@ -70,8 +70,10 @@ public: /// Copy constructor. - CachedPointer (const CachedPointer& other); + CachedPointer (const CachedPointer& other) noexcept; + /// Move constructor. + CachedPointer ( CachedPointer&& other) noexcept; /// Assignment. CachedPointer& operator= (const CachedPointer& other); diff --git a/Control/CxxUtils/CxxUtils/CachedPointer.icc b/Control/CxxUtils/CxxUtils/CachedPointer.icc index 07648b869b581c2bc2594db8efcb004a11d29770..099f11284de2b5dfbbd885b2ebe044e3c10bd736 100644 --- a/Control/CxxUtils/CxxUtils/CachedPointer.icc +++ b/Control/CxxUtils/CxxUtils/CachedPointer.icc @@ -40,11 +40,23 @@ CachedPointer<T>::CachedPointer (pointer_t elt) */ template <class T> inline -CachedPointer<T>::CachedPointer (const CachedPointer& other) +CachedPointer<T>::CachedPointer (const CachedPointer& other) noexcept : m_a (other.get()) { } +/** + * @brief Move constructor. + */ +template <class T> +inline +CachedPointer<T>::CachedPointer ( CachedPointer&& other) noexcept + : m_a (other.get()) +{ + //Does not own pointer so don't need to null +} + + /** * @brief Assignment.