Skip to content
Snippets Groups Projects
Commit 3565b549 authored by Henry Weller's avatar Henry Weller
Browse files

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

parent 0a43d605
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,9 @@ public: ...@@ -92,6 +92,9 @@ public:
//- Construct copy and increment reference count //- Construct copy and increment reference count
inline tmp(const tmp<T>&); 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 //- Construct copy transferring content of temporary if required
inline tmp(const tmp<T>&, bool allowTransfer); inline tmp(const tmp<T>&, bool allowTransfer);
......
...@@ -91,6 +91,19 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t) ...@@ -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> template<class T>
inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer) inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer)
: :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment