mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-12-15 07:20:17 +00:00
add array variant of fair::mq::tools::make_unique()
This commit is contained in:
committed by
Dennis Klein
parent
9b4c5deb0b
commit
9b326c7a71
@@ -27,6 +27,13 @@ std::unique_ptr<T> make_unique(Args&& ...args)
|
|||||||
return std::unique_ptr<T>(new T(std::forward<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
|
// provide an enum hasher to compensate std::hash not supporting enums in C++11
|
||||||
template<typename Enum>
|
template<typename Enum>
|
||||||
struct HashEnum
|
struct HashEnum
|
||||||
|
|||||||
Reference in New Issue
Block a user