Commit 8e040421 authored by Henry Weller's avatar Henry Weller
Browse files

tmp: Allow '.ref()' for const 'tmp'

const-ness of the stored object is checked at run-time.
parent f73a8e61
...@@ -124,7 +124,7 @@ public: ...@@ -124,7 +124,7 @@ public:
//- Return non-const reference or generate a fatal error //- Return non-const reference or generate a fatal error
// if the object is const. // if the object is const.
inline T& ref(); inline T& ref() const;
//- Return tmp pointer for reuse. //- Return tmp pointer for reuse.
// Returns a clone if the object is not a temporary // Returns a clone if the object is not a temporary
......
...@@ -158,7 +158,7 @@ inline Foam::word Foam::tmp<T>::typeName() const ...@@ -158,7 +158,7 @@ inline Foam::word Foam::tmp<T>::typeName() const
template<class T> template<class T>
inline T& Foam::tmp<T>::ref() inline T& Foam::tmp<T>::ref() const
{ {
if (isTmp()) if (isTmp())
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment