8 #if __cplusplus <= 201103L 9 #define __cpp_lib_make_unique 201304 11 template <
typename _Tp>
struct _MakeUniq {
12 typedef unique_ptr<_Tp> __single_object;
15 template <
typename _Tp>
struct _MakeUniq<_Tp[]> {
16 typedef unique_ptr<_Tp[]> __array;
19 template <
typename _Tp,
size_t _Bound>
struct _MakeUniq<_Tp[_Bound]> {
20 struct __invalid_type {
25 template <
typename _Tp,
typename... _Args>
inline typename _MakeUniq<_Tp>::__single_object make_unique(_Args &&... __args)
27 return unique_ptr<_Tp>(
new _Tp(std::forward<_Args>(__args)...));
31 template <
typename _Tp>
inline typename _MakeUniq<_Tp>::__array make_unique(
size_t __num)
33 return unique_ptr<_Tp>(
new typename remove_extent<_Tp>::type[__num]());
37 template <
typename _Tp,
typename... _Args>
inline typename _MakeUniq<_Tp>::__invalid_type make_unique(_Args &&...) =
delete;