From: Anthony Geay Date: Fri, 30 Dec 2016 06:47:00 +0000 (+0100) Subject: a useful method X-Git-Tag: V8_3_0a2~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bab86dc8d745263299949590db82952942c5c79d;p=tools%2Fmedcoupling.git a useful method --- diff --git a/src/MEDCoupling/MCAuto.hxx b/src/MEDCoupling/MCAuto.hxx index 99de255ca..913024e84 100644 --- a/src/MEDCoupling/MCAuto.hxx +++ b/src/MEDCoupling/MCAuto.hxx @@ -40,6 +40,7 @@ namespace MEDCoupling bool operator==(const T *other) const { return _ptr==other; } MCAuto &operator=(const MCAuto& other) { if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; } MCAuto &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; } + void takeRef(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; if(_ptr) _ptr->incrRef(); } } T *operator->() { return _ptr ; } const T *operator->() const { return _ptr; } T& operator*() { return *_ptr; }