summaryrefslogtreecommitdiff
path: root/src/utils/memory.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/memory.hpp')
-rw-r--r--src/utils/memory.hpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/utils/memory.hpp b/src/utils/memory.hpp
index 81e3757..e870b0b 100644
--- a/src/utils/memory.hpp
+++ b/src/utils/memory.hpp
@@ -1,23 +1,33 @@
#pragma once
+#include <stddef.h>
+
template <typename memType>
memType *malloc_s(unsigned int size);
template <class Target>
-class unique_ptr
+class UniquePtr
{
public:
- unique_ptr(Target *target);
- ~unique_ptr();
+ explicit UniquePtr();
+ explicit UniquePtr(Target *target);
+ UniquePtr(const UniquePtr &unique_ptr);
+ UniquePtr(UniquePtr &&unique_ptr) noexcept;
+
+ UniquePtr &operator=(const UniquePtr &unique_ptr);
+
+ UniquePtr &operator=(UniquePtr &&unique_ptr) noexcept;
+
+ ~UniquePtr();
- Target operator *() const;
- Target *operator ->() const;
+ Target operator*() const;
+ Target *operator->() const;
private:
- Target *_target;
+ Target *_target = nullptr;
};
-template<class Target, typename...Args>
-unique_ptr<Target> make_unique(Args&... args);
+template <typename Target, typename... Args>
+UniquePtr<Target> make_unique(Args... args);
#include "memory.tpp"