summaryrefslogtreecommitdiff
path: root/src/util/pointer.h
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-06-05 09:36:13 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-06-05 09:36:13 +0200
commit718121df91764c810dbc0556a3d216c5d849b4ff (patch)
tree896766290e850a6c95cad5f6f5cbcc6c426dfde8 /src/util/pointer.h
parentbfacfc20624a46f05193e7e036a58ec906450494 (diff)
downloadminetest-718121df91764c810dbc0556a3d216c5d849b4ff.tar.gz
minetest-718121df91764c810dbc0556a3d216c5d849b4ff.tar.bz2
minetest-718121df91764c810dbc0556a3d216c5d849b4ff.zip
Remove SharedPtr, it's not used and will be never used, we use C++11
Diffstat (limited to 'src/util/pointer.h')
-rw-r--r--src/util/pointer.h74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/util/pointer.h b/src/util/pointer.h
index 7f6654787..6614ca2c2 100644
--- a/src/util/pointer.h
+++ b/src/util/pointer.h
@@ -25,80 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <cstring>
template <typename T>
-class SharedPtr
-{
-public:
- SharedPtr(T *t=NULL)
- {
- refcount = new int;
- *refcount = 1;
- ptr = t;
- }
- SharedPtr(SharedPtr<T> &t)
- {
- //*this = t;
- drop();
- refcount = t.refcount;
- (*refcount)++;
- ptr = t.ptr;
- }
- ~SharedPtr()
- {
- drop();
- }
- SharedPtr<T> & operator=(T *t)
- {
- drop();
- refcount = new int;
- *refcount = 1;
- ptr = t;
- return *this;
- }
- SharedPtr<T> & operator=(SharedPtr<T> &t)
- {
- drop();
- refcount = t.refcount;
- (*refcount)++;
- ptr = t.ptr;
- return *this;
- }
- T* operator->()
- {
- return ptr;
- }
- T & operator*()
- {
- return *ptr;
- }
- bool operator!=(T *t)
- {
- return ptr != t;
- }
- bool operator==(T *t)
- {
- return ptr == t;
- }
- T & operator[](unsigned int i)
- {
- return ptr[i];
- }
-private:
- void drop()
- {
- assert((*refcount) > 0);
- (*refcount)--;
- if(*refcount == 0)
- {
- delete refcount;
- if(ptr != NULL)
- delete ptr;
- }
- }
- T *ptr;
- int *refcount;
-};
-
-template <typename T>
class Buffer
{
public: