too tired to think
This commit is contained in:
24
open_engine/include/open_engine/ref_scope.hpp
Normal file
24
open_engine/include/open_engine/ref_scope.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef REF_SCOPE_HPP
|
||||
#define REF_SCOPE_HPP
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OpenEngine {
|
||||
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>
|
||||
using Ref = std::shared_ptr<T>;
|
||||
template<typename T, typename ... Args>
|
||||
constexpr Ref<T> CreateRef(Args&& ... args)
|
||||
{
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // REF_SCOPE_HPP
|
||||
Reference in New Issue
Block a user