aboutsummaryrefslogtreecommitdiff
path: root/src/Core/Memory.h
blob: 0abc6b112b714da59b2b88112299770da720992a (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
#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)...);
	}
};