add array variant of fair::mq::tools::make_unique()

This commit is contained in:
Gvozden Neskovic 2019-05-14 13:46:46 +02:00 committed by Dennis Klein
parent 9b4c5deb0b
commit 9b326c7a71

View File

@ -27,6 +27,13 @@ std::unique_ptr<T> make_unique(Args&& ...args)
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
// make_unique implementation (array variant), until C++14 is default
template<typename T>
std::unique_ptr<T> make_unique(std::size_t size)
{
return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
}
// provide an enum hasher to compensate std::hash not supporting enums in C++11
template<typename Enum>
struct HashEnum