summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-04-14 16:36:06 +0200
committerCharles Pigott <charlespigott@googlemail.com>2019-04-15 22:52:50 +0100
commit38729297f98f6abb154a6acd37b6c5a1b9dea134 (patch)
treef102e34858e04034090bd8c0cf6fce84da8ab70b /src/core
parent4e85ccf3c049cb508873bb8320f770c328e76513 (diff)
downloadopenttd-38729297f98f6abb154a6acd37b6c5a1b9dea134.tar.xz
Codechange: No need for AutoFreePtr if there's std::unique_ptr.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/alloc_type.hpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp
index 1da080d98..e351bf360 100644
--- a/src/core/alloc_type.hpp
+++ b/src/core/alloc_type.hpp
@@ -117,38 +117,4 @@ public:
inline void operator delete[](void *ptr) { free(ptr); }
};
-/**
- * A smart pointer class that free()'s the pointer on destruction.
- * @tparam T Storage type.
- */
-template <typename T>
-class AutoFreePtr
-{
- T *ptr; ///< Stored pointer.
-
-public:
- AutoFreePtr(T *ptr) : ptr(ptr) {}
- ~AutoFreePtr() { free(this->ptr); }
-
- /**
- * Take ownership of a new pointer and free the old one if needed.
- * @param ptr NEw pointer.
- */
- inline void Assign(T *ptr)
- {
- free(this->ptr);
- this->ptr = ptr;
- }
-
- /** Dereference pointer. */
- inline T *operator ->() { return this->ptr; }
- /** Dereference pointer. */
- inline const T *operator ->() const { return this->ptr; }
-
- /** Cast to underlaying regular pointer. */
- inline operator T *() { return this->ptr; }
- /** Cast to underlaying regular pointer. */
- inline operator const T *() const { return this->ptr; }
-};
-
#endif /* ALLOC_TYPE_HPP */