7 #ifndef GDCORE_MAKEUNIQUE_H
8 #define GDCORE_MAKEUNIQUE_H
19 typedef std::unique_ptr<T> _Single_object;
24 typedef std::unique_ptr<T[]> _Unknown_bound;
27 template <
class T,
size_t N>
29 typedef void _Known_bound;
32 template <
class T,
class... Args>
33 typename _Unique_if<T>::_Single_object make_unique(Args&&... args) {
34 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
38 typename _Unique_if<T>::_Unknown_bound make_unique(
size_t n) {
39 typedef typename std::remove_extent<T>::type U;
40 return std::unique_ptr<T>(
new U[n]());
43 template <
class T,
class... Args>
44 typename _Unique_if<T>::_Known_bound make_unique(Args&&...) =
delete;
Definition: CommonTools.h:24
Definition: MakeUnique.h:18