diff --git a/src/OpenFOAM/memory/tmp/tmp.H b/src/OpenFOAM/memory/tmp/tmp.H index 6a145158a7..5448b2533e 100644 --- a/src/OpenFOAM/memory/tmp/tmp.H +++ b/src/OpenFOAM/memory/tmp/tmp.H @@ -92,6 +92,9 @@ public: //- Construct copy and increment reference count inline tmp(const tmp&); + //- Construct copy moving content, does not increment reference count + inline tmp(const tmp&&); + //- Construct copy transferring content of temporary if required inline tmp(const tmp&, bool allowTransfer); diff --git a/src/OpenFOAM/memory/tmp/tmpI.H b/src/OpenFOAM/memory/tmp/tmpI.H index e08214bcd1..70a4dc2b7f 100644 --- a/src/OpenFOAM/memory/tmp/tmpI.H +++ b/src/OpenFOAM/memory/tmp/tmpI.H @@ -91,6 +91,19 @@ inline Foam::tmp::tmp(const tmp& t) } +template +inline Foam::tmp::tmp(const tmp&& t) +: + type_(t.type_), + ptr_(t.ptr_) +{ + if (isTmp()) + { + t.ptr_ = 0; + } +} + + template inline Foam::tmp::tmp(const tmp& t, bool allowTransfer) :