From fd14a695bdce3295750ecd0ff7f95418785d2eda Mon Sep 17 00:00:00 2001 From: scorpioblood <77296181+scorpioblood@users.noreply.github.com> Date: Tue, 21 May 2024 22:42:24 +0200 Subject: [PATCH] Add shared_ptr and unique_ptr alias --- Engine/src/Runtime/Core/Core.h | 23 +++++++++- .../Runtime/Core/public/Math/Boilerplate.h | 45 ++++++++++++++++--- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/Engine/src/Runtime/Core/Core.h b/Engine/src/Runtime/Core/Core.h index d8339dd..d15bfba 100644 --- a/Engine/src/Runtime/Core/Core.h +++ b/Engine/src/Runtime/Core/Core.h @@ -37,4 +37,25 @@ #error The target system must be defined. (See https://github.com/scorpioblood/PhanesEngine for more information) -#endif // P_WIN_BUILD \ No newline at end of file +#endif // P_WIN_BUILD + + +namespace Phanes +{ + + template + using Ref = std::shared_ptr; + + template + constexpr Ref MakeRef(Args&& ...args) + { + return std::make_shared(std::forward(args)...); + } + + +} + +int test() +{ + +} \ No newline at end of file diff --git a/Engine/src/Runtime/Core/public/Math/Boilerplate.h b/Engine/src/Runtime/Core/public/Math/Boilerplate.h index 8306552..74621e1 100644 --- a/Engine/src/Runtime/Core/public/Math/Boilerplate.h +++ b/Engine/src/Runtime/Core/public/Math/Boilerplate.h @@ -47,10 +47,43 @@ -// Typenames with RealType constrain have to be floating point numbers. -template -concept RealType = std::is_floating_point_v; -// Typenames with IntType constrain have to be integer number. -template -concept IntType = std::is_integral_v; \ No newline at end of file + + +namespace Phanes::Core::Math +{ + + // Typenames with RealType constrain have to be floating point numbers. + template + concept RealType = std::is_floating_point_v; + + // Typenames with IntType constrain have to be integer number. + template + concept IntType = std::is_integral_v; + + + + + + // Alias for shared_ptr + template + using Ref = std::shared_ptr; + + // Alias for make_shared + template + constexpr Ref MakeRef(Args&& ...args) + { + return std::make_shared(std::forward(args)...); + } + + // Alias for unique ptr + template + using Scope = std::unique_ptr; + + // Alias for make_unique + template + constexpr Scope MakeScope(Args&& ...args) + { + return std::make_unique(std::forward(args)...); + } +} \ No newline at end of file