Просмотр исходного кода

Use std::make_unique if C++14 is used

Tatsuhiro Tsujikawa 9 лет назад
Родитель
Сommit
e4d4eabd85
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      src/a2functional.h

+ 4 - 0
src/a2functional.h

@@ -150,6 +150,9 @@ struct RefLess {
   }
 };
 
+#if __cplusplus > 201103L
+using std::make_unique;
+#else  // __cplusplus <= 201103L
 template <typename T, typename... U>
 typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
 make_unique(U&&... u)
@@ -163,6 +166,7 @@ make_unique(size_t size)
 {
   return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
 }
+#endif // __cplusplus <= 201103L
 
 // User-defined literals for K, M, and G (powers of 1024)