Skip to content
Snippets Groups Projects
Commit 6604e338 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'ElementLinkMoveable' into 'master'

Make ElementLink `moveable`

See merge request atlas/athena!35674
parents 773fbab9 12148dc7
No related branches found
No related tags found
No related merge requests found
...@@ -672,6 +672,9 @@ void test3 (SGTest::TestStore& store) ...@@ -672,6 +672,9 @@ void test3 (SGTest::TestStore& store)
TestStore::sgkey_t sgkey = store.stringToKey ("foocont3", fooclid); 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; FooCont* foocont3 = new FooCont;
for (int i=0; i < 4; i++) for (int i=0; i < 4; i++)
foocont3->push_back (new Foo(i+200)); foocont3->push_back (new Foo(i+200));
......
...@@ -70,8 +70,10 @@ public: ...@@ -70,8 +70,10 @@ public:
/// Copy constructor. /// Copy constructor.
CachedPointer (const CachedPointer& other); CachedPointer (const CachedPointer& other) noexcept;
/// Move constructor.
CachedPointer ( CachedPointer&& other) noexcept;
/// Assignment. /// Assignment.
CachedPointer& operator= (const CachedPointer& other); CachedPointer& operator= (const CachedPointer& other);
......
...@@ -40,11 +40,23 @@ CachedPointer<T>::CachedPointer (pointer_t elt) ...@@ -40,11 +40,23 @@ CachedPointer<T>::CachedPointer (pointer_t elt)
*/ */
template <class T> template <class T>
inline inline
CachedPointer<T>::CachedPointer (const CachedPointer& other) CachedPointer<T>::CachedPointer (const CachedPointer& other) noexcept
: m_a (other.get()) : 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. * @brief Assignment.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment