BeginScope();
}
+ //! Move constructor
+ handle (handle&& theHandle) : entity(theHandle.entity)
+ {
+ theHandle.entity = 0;
+ }
+
//! Destructor
~handle ()
{
return *this;
}
+ //! Move operator
+ handle& operator= (handle&& theHandle)
+ {
+ std::swap (this->entity, theHandle.entity);
+ return *this;
+ }
+
//! STL-like cast to pointer to referred object
const T* get () const { return static_cast<const T*>(this->entity); }
BeginScope();
}
+ //! Generalized move constructor
+ template <class T2, typename = typename std::enable_if <is_base_but_not_same <T, T2>::value>::type>
+ handle (handle<T2>&& theHandle)
+ : entity(theHandle.entity)
+ {
+ theHandle.entity = 0;
+ }
+
//! Generalized assignment operator
template <class T2, typename = typename std::enable_if <is_base_but_not_same <T, T2>::value>::type>
handle operator = (const handle<T2>& theHandle)
return *this;
}
+ //! Generalized move operator
+ template <class T2, typename = typename std::enable_if <is_base_but_not_same <T, T2>::value>::type>
+ handle& operator= (handle<T2>&& theHandle)
+ {
+ std::swap (this->entity, theHandle.entity);
+ return *this;
+ }
+
#else
//! Upcast to const reference to base type.
BeginScope();
}
+ //! Generalized move constructor
+ template <class T2>
+ handle (handle<T2>&& theHandle, typename std::enable_if <is_base_but_not_same <T, T2>::value>::type* = nullptr)
+ : entity(theHandle.entity)
+ {
+ theHandle.entity = 0;
+ }
+
//! Generalized assignment operator.
template <class T2>
handle operator = (const handle<T2>& theHandle)
return *this;
}
+ //! Generalized move operator
+ template <class T2>
+ handle& operator= (handle<T2>&& theHandle)
+ {
+ std::enable_if <is_base_but_not_same <T, T2>::value, void*>::type aTypeCheckHelperVar;
+ (void)aTypeCheckHelperVar;
+ std::swap (this->entity, theHandle.entity);
+ return *this;
+ }
+
#else
//! Upcast to const reference to base type.