Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
1003 B
Referenced Files
None
Subscribers
None
diff --git a/util/pointer.h b/util/pointer.h
new file mode 100644
index 00000000..3bec30a8
--- /dev/null
+++ b/util/pointer.h
@@ -0,0 +1,47 @@
+#ifndef _paintown_util_pointer_h
+#define _paintown_util_pointer_h
+
+namespace Util{
+
+/* Some helpful pointer classes, probably equivalent to stuff in boost */
+
+/* Initializes its pointer to NULL and deletes the data in the destructor */
+template <class Data>
+class ClassPointer{
+public:
+ ClassPointer():
+ data(NULL){
+ }
+
+ ClassPointer & operator=(Data * him){
+ data = him;
+ return *this;
+ }
+
+ Data & operator*() const {
+ return *data;
+ }
+
+ bool operator==(const void * what) const {
+ return data == what;
+ }
+
+ bool operator!=(const void * what) const {
+ return !(*this == what);
+ }
+
+ Data* operator->() const {
+ return data;
+ }
+
+ virtual ~ClassPointer(){
+ delete data;
+ }
+
+private:
+ Data* data;
+};
+
+}
+
+#endif

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jun 11, 12:18 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
68995
Default Alt Text
(1003 B)

Event Timeline