aboutsummaryrefslogtreecommitdiff
path: root/src/Core/Memory.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-14 00:42:05 +0200
committerhachem <im@hachem.wtf>2025-08-14 00:42:05 +0200
commite050dce79b67ae6386240567a994454711ab998d (patch)
tree4b5f55471d86b8ee80d531696e65dcea3b713e7a /src/Core/Memory.h
parent2e246683df3b18e8e129adb0ada25be5f82f5b59 (diff)
[add]: Custom memory managers and fix includes
Diffstat (limited to 'src/Core/Memory.h')
-rw-r--r--src/Core/Memory.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Core/Memory.h b/src/Core/Memory.h
new file mode 100644
index 0000000..0abc6b1
--- /dev/null
+++ b/src/Core/Memory.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <memory>
+
+namespace Donut
+{
+ template<typename T>
+ using Ref = std::shared_ptr<T>;
+
+ template<typename T>
+ using Scope = std::unique_ptr<T>;
+
+ template<typename T, typename ... Args>
+ constexpr Scope<T> CreateScope(Args&& ... args)
+ {
+ return std::make_unique<T>(std::forward<Args>(args)...);
+ }
+
+ template<typename T, typename ... Args>
+ constexpr Ref<T> CreateRef(Args&& ... args)
+ {
+ return std::make_shared<T>(std::forward<Args>(args)...);
+ }
+}; \ No newline at end of file