Browse Source

Fix array version make_unique is invoked for 1 size_t arg accidentally

Tatsuhiro Tsujikawa 12 years ago
parent
commit
05d75ed218
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/a2functional.h

+ 4 - 2
src/a2functional.h

@@ -181,13 +181,15 @@ struct RefLess {
 };
 
 template<typename T, typename... U>
-std::unique_ptr<T> make_unique(U&&... u)
+typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
+make_unique(U&&... u)
 {
   return std::unique_ptr<T>(new T(std::forward<U>(u)...));
 }
 
 template<typename T>
-std::unique_ptr<T> make_unique(size_t size)
+typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type
+make_unique(size_t size)
 {
   return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
 }