15 #ifndef SERIALBOX_CORE_STLEXTRAS_H 16 #define SERIALBOX_CORE_STLEXTRAS_H 21 #include <type_traits> 27 #if !defined(SERIALBOX_COMPILER_MSVC) && __cplusplus <= 201103L 41 template <
class T,
class... Args>
42 typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
43 make_unique(Args&&... args) {
44 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
57 typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0,
58 std::unique_ptr<T>>::type
59 make_unique(std::size_t n) {
60 return std::unique_ptr<T>(
new typename std::remove_extent<T>::type[n]());
64 template <
class T,
class... Args>
65 typename std::enable_if<std::extent<T>::value != 0>::type make_unique(Args&&...) =
delete;