tmp: Added 'move' constructor to simplify return of unchanged 'tmp' arguments.

This commit is contained in:
Henry Weller 2016-05-23 12:01:36 +01:00
parent 0a43d60567
commit 3565b5491f
2 changed files with 16 additions and 0 deletions

View File

@ -92,6 +92,9 @@ public:
//- Construct copy and increment reference count
inline tmp(const tmp<T>&);
//- Construct copy moving content, does not increment reference count
inline tmp(const tmp<T>&&);
//- Construct copy transferring content of temporary if required
inline tmp(const tmp<T>&, bool allowTransfer);

View File

@ -91,6 +91,19 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t)
}
template<class T>
inline Foam::tmp<T>::tmp(const tmp<T>&& t)
:
type_(t.type_),
ptr_(t.ptr_)
{
if (isTmp())
{
t.ptr_ = 0;
}
}
template<class T>
inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer)
: