Sfoglia il codice sorgente

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

Tatsuhiro Tsujikawa 9 anni fa
parent
commit
e4d4eabd85
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  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)