mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
tmp: Added 'move' constructor to simplify return of unchanged 'tmp' arguments.
This commit is contained in:
@ -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);
|
||||
|
||||
|
||||
@ -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)
|
||||
:
|
||||
|
||||
Reference in New Issue
Block a user