55 #if !defined(COMPILER_SUPPORTS_MAKE_UNIQUE) 58 #if _MSC_VER >= 1800 // MSVC 12.0 (Visual Studio 2013) 59 #define COMPILER_SUPPORTS_MAKE_UNIQUE 61 #elif defined(__clang__) 65 #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) 66 #if defined(__APPLE__) && CLANG_VERSION >= 60000 67 #define COMPILER_SUPPORTS_MAKE_UNIQUE 68 #elif !defined(__APPLE__) && CLANG_VERSION >= 30400 69 #define COMPILER_SUPPORTS_MAKE_UNIQUE 71 #elif defined(__GNUC__) 74 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 75 #if GCC_VERSION >= 40900 && __cplusplus > 201103L 76 #define COMPILER_SUPPORTS_MAKE_UNIQUE 81 #if defined(COMPILER_SUPPORTS_MAKE_UNIQUE) 92 #include <type_traits> 109 template <
class _Ty,
size_t N>
120 #if defined(_MSC_VER) && (_MSC_VER < 1800) 124 #define _MAKE_UNIQUE(TEMPLATE_LIST, PADDING_LIST, LIST, COMMA, X1, X2, X3, X4) \ 125 template <class _Ty COMMA LIST(_CLASS_TYPE)> \ 126 inline typename _Unique_if<_Ty>::_Single_object make_unique(LIST(_TYPE_REFREF_ARG)) \ 128 return unique_ptr<_Ty>(new _Ty(LIST(_FORWARD_ARG))); \ 131 _VARIADIC_EXPAND_0X(_MAKE_UNIQUE, , , , )
134 #else // not MSVC 11.0 or earlier 136 template <
class _Ty,
class... Args>
139 return unique_ptr<_Ty>(
new _Ty(std::forward<Args>(args)...));
150 typedef typename remove_extent<_Ty>::type U;
151 return unique_ptr<_Ty>(
new U[n]());
159 #if !(defined(_MSC_VER) && (_MSC_VER < 1800)) 161 template <
class T,
class... Args>
168 #endif // !COMPILER_SUPPORTS_MAKE_UNIQUE unique_ptr< _Ty[]> _Unknown_bound
unique_ptr< _Ty > _Single_object
_Unique_if< _Ty >::_Single_object make_unique(Args &&...args)