From 10c1d5697f5c9a4b0584e71c9c2bff76bc6b82ea Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 16 Mar 2017 20:49:21 +0000 Subject: [PATCH] autoPtr: Added assignment to pointer --- src/OpenFOAM/memory/autoPtr/autoPtr.H | 5 ++++- src/OpenFOAM/memory/autoPtr/autoPtrI.H | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H index 77dd1966c..76afd531c 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtr.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,6 +125,9 @@ public: //- Return const object pointer inline const T* operator->() const; + //- Take over the object pointer from parameter + inline void operator=(T*); + //- Take over the object pointer from parameter inline void operator=(const autoPtr&); }; diff --git a/src/OpenFOAM/memory/autoPtr/autoPtrI.H b/src/OpenFOAM/memory/autoPtr/autoPtrI.H index 7c35448f7..7eaa605a8 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtrI.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtrI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -190,6 +190,13 @@ inline const T* Foam::autoPtr::operator->() const } +template +inline void Foam::autoPtr::operator=(T* p) +{ + reset(p); +} + + template inline void Foam::autoPtr::operator=(const autoPtr& ap) {