diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-01 10:32:26 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-01 10:32:26 +0100 |
commit | c8d1519f31baed0fb399dac9333e48e2f9e910ad (patch) | |
tree | 1e2192f0b91d55512d26f4a14c8eae6b5a1f6ece /include/hiddenpointer.h | |
parent | 73945a9cb2b096a5379d17c028bda102b87aedce (diff) |
namespace implementation, compile issue for php 5.4 and higher
Diffstat (limited to 'include/hiddenpointer.h')
-rw-r--r-- | include/hiddenpointer.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/hiddenpointer.h b/include/hiddenpointer.h index 96bb26a..93fdc7c 100644 --- a/include/hiddenpointer.h +++ b/include/hiddenpointer.h @@ -94,7 +94,32 @@ public: * @param that * @return HiddenPointer */ - HiddenPointer<Type> operator=(const HiddenPointer &that) = delete; + HiddenPointer<Type> operator=(const HiddenPointer &that) + { + // skip self assignmend + if (this == &that) return *this; + + // deallocate current object + if (_allocated) delete[] _buffer; + + // copy allocated setting + _allocated = that._allocated; + + // is the other object allocated? + if (_allocated) + { + // allocate this object too, call constructor + HiddenPointer(that, that); + } + else + { + // just copy the data + _buffer = that._buffer; + } + + // done + return *this; + } /** * Retrieve the pointer |