summaryrefslogtreecommitdiff
path: root/src/std/memory.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-07 09:24:37 +0100
committerHampusM <hampus@hampusmat.com>2022-03-07 09:26:17 +0100
commit4b4605df15ce7061a08d7911069927bf49778d05 (patch)
tree5f853e2d7508e073bd12175a7d18ab9e6bf2ea82 /src/std/memory.hpp
parentfaa501905e2fb554a2444b5e396d9e979ce0be0e (diff)
fix: prevent invalid UniquePtr usage
Diffstat (limited to 'src/std/memory.hpp')
-rw-r--r--src/std/memory.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/std/memory.hpp b/src/std/memory.hpp
index 0c5719c..d1ca762 100644
--- a/src/std/memory.hpp
+++ b/src/std/memory.hpp
@@ -11,13 +11,19 @@ class UniquePtr
public:
explicit UniquePtr() = default;
explicit UniquePtr(Target *target);
- UniquePtr(const UniquePtr &unique_ptr);
- UniquePtr(UniquePtr &&unique_ptr) noexcept;
- UniquePtr &operator=(const UniquePtr &unique_ptr);
+ // Move constructor
+ UniquePtr(UniquePtr &&unique_ptr) noexcept;
+ // Move assignment operator
UniquePtr &operator=(UniquePtr &&unique_ptr) noexcept;
+ // Disable the copy constructor
+ UniquePtr(const UniquePtr &unique_ptr) = delete;
+
+ // Disable the copy assignment operator
+ UniquePtr &operator=(const UniquePtr &unique_ptr) = delete;
+
~UniquePtr();
Target operator*() const;