summaryrefslogtreecommitdiff
path: root/include/hiddenpointer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hiddenpointer.h')
-rw-r--r--include/hiddenpointer.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/hiddenpointer.h b/include/hiddenpointer.h
index 93fdc7c..cf6bea0 100644
--- a/include/hiddenpointer.h
+++ b/include/hiddenpointer.h
@@ -81,6 +81,16 @@ public:
}
/**
+ * Move constructor
+ * @param that
+ */
+ HiddenPointer(HiddenPointer<Type> &&that) : _allocated(that._allocated), _buffer(that._buffer)
+ {
+ // the other object is no longer allocated
+ that._allocated = false;
+ }
+
+ /**
* Destructor
*/
virtual ~HiddenPointer()
@@ -141,6 +151,16 @@ public:
return _buffer + sizeof(Type *);
}
+ /**
+ * Derefence the pointer
+ * @return Type*
+ */
+ Type *operator->() const
+ {
+ // type is stored in front of the buffer
+ return *((Type **)_buffer);
+ }
+
private:
/**
* Buffer that holds both the pointer and the text - the text starts