forked from gameguild-gg/SDL3-CPM-CMake-Example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemory.h
More file actions
34 lines (27 loc) · 932 Bytes
/
Memory.h
File metadata and controls
34 lines (27 loc) · 932 Bytes
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
#pragma once
#include <memory>
#include <unordered_set>
// rename "std::shared_ptr<T>" to shared<T>
template <typename T>
using shared = std::shared_ptr<T>;
// rename "std::unique_ptr<T>" to unique<T>
template <typename T>
using unique = std::unique_ptr<T>;
// rename "std::weak_ptr<T>" to weak<T>
template <typename T>
using weak = std::weak_ptr<T>;
// rename "std::make_shared<T>" to make_shared<T>
template <typename T, typename... Args>
requires std::constructible_from<T, Args...>
shared<T> make_shared(Args&&... args) {
return std::make_shared<T>(std::forward<Args>(args)...);
}
// rename "std::make_unique<T>" to make_unique<T>
template <typename T, typename... Args>
requires std::constructible_from<T, Args...>
unique<T> make_unique(Args&&... args) {
return std::make_unique<T>(std::forward<Args>(args)...);
}
// rename "std::unordered_set<T>" to uset<T>
template <typename T>
using uset = std::unordered_set<T>;