mirror of https://github.com/aria2/aria2
Use std::make_unique if C++14 is used
parent
83aae472fa
commit
e4d4eabd85
|
@ -150,6 +150,9 @@ struct RefLess {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if __cplusplus > 201103L
|
||||||
|
using std::make_unique;
|
||||||
|
#else // __cplusplus <= 201103L
|
||||||
template <typename T, typename... U>
|
template <typename T, typename... U>
|
||||||
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
|
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
|
||||||
make_unique(U&&... u)
|
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]());
|
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)
|
// User-defined literals for K, M, and G (powers of 1024)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue