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

const-ness of the stored object is checked at run-time.
This commit is contained in:
Henry Weller
2016-05-21 23:10:58 +01:00
parent 7c6b0e684f
commit f8f39d54ae
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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())
{ {