Explorar el Código

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

Tatsuhiro Tsujikawa hace 9 años
padre
commit
e4d4eabd85
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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)