From f8f39d54ae1e6e1cc93c2c52b5d65d5d51a822f3 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 21 May 2016 23:10:58 +0100 Subject: [PATCH] tmp: Allow '.ref()' for const 'tmp' const-ness of the stored object is checked at run-time. --- src/OpenFOAM/memory/tmp/tmp.H | 2 +- src/OpenFOAM/memory/tmp/tmpI.H | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/memory/tmp/tmp.H b/src/OpenFOAM/memory/tmp/tmp.H index 28d6fb50f3..6a145158a7 100644 --- a/src/OpenFOAM/memory/tmp/tmp.H +++ b/src/OpenFOAM/memory/tmp/tmp.H @@ -124,7 +124,7 @@ public: //- Return non-const reference or generate a fatal error // if the object is const. - inline T& ref(); + inline T& ref() const; //- Return tmp pointer for reuse. // Returns a clone if the object is not a temporary diff --git a/src/OpenFOAM/memory/tmp/tmpI.H b/src/OpenFOAM/memory/tmp/tmpI.H index b1add8e8c3..e08214bcd1 100644 --- a/src/OpenFOAM/memory/tmp/tmpI.H +++ b/src/OpenFOAM/memory/tmp/tmpI.H @@ -158,7 +158,7 @@ inline Foam::word Foam::tmp::typeName() const template -inline T& Foam::tmp::ref() +inline T& Foam::tmp::ref() const { if (isTmp()) {