blob: d1ca762b1546eb7d9290beb048e756325988e583 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include <stddef.h>
template <typename memType>
memType *malloc_s(unsigned int size);
template <class Target>
class UniquePtr
{
public:
explicit UniquePtr() = default;
explicit UniquePtr(Target *target);
// 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;
Target *operator->() const;
private:
Target *_target = nullptr;
};
template <typename Target, typename... Args>
UniquePtr<Target> make_unique(Args... args);
#include "memory.tpp"
|