19 #ifndef A_UTIL_UTIL_MEMORY_UNIQUE_PTR_HEADER_INCLUDED
20 #define A_UTIL_UTIL_MEMORY_UNIQUE_PTR_HEADER_INCLUDED
30 using ::std::unique_ptr;
32 #if (!defined(_MSC_VER) && !(__cplusplus > 201103L)) || \
33 (defined(_MSC_VER) && (_MSC_VER < 1800)) || defined(A_UTIL_ENABLE_MAKE_UNIQUE)
38 typedef unique_ptr<T> _Single_object;
42 struct _Unique_if<T[]> {
43 typedef unique_ptr<T[]> _Unknown_bound;
46 template <
class T,
size_t N>
47 struct _Unique_if<T[N]> {
48 typedef void _Known_bound;
67 template <
class T,
class... Args>
68 typename _Unique_if<T>::_Single_object
make_unique(Args&&... args)
70 return unique_ptr<T>(
new T(std::forward<Args>(args)...));
90 typedef typename std::remove_extent<T>::type U;
91 return unique_ptr<T>(
new U[n]());
107 template <
class T,
class... Args>
108 typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) =
delete;
_Unique_if< T >::_Single_object make_unique(Args &&... args)
Compatibility to C++14 std::make_unique for non-array types.
_Unique_if< T >::_Known_bound make_unique(Args &&...)=delete
Compatibility to C++14 std::make_unique to disallow construction of arrays of known bound.
Serves as the root component, with common functionality documented in core functionality.