summaryrefslogtreecommitdiff
path: root/src/std/memory.hpp
blob: 0c5719c6d46d8114ab1c3bc311f81ae2966c4ff5 (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
#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);
	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;

private:
	Target *_target = nullptr;
};

template <typename Target, typename... Args>
UniquePtr<Target> make_unique(Args... args);

#include "memory.tpp"