mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Remove custom implementation for enum hashing
This commit is contained in:
@@ -9,24 +9,10 @@
|
||||
#ifndef FAIR_MQ_TOOLS_CPPSTL_H
|
||||
#define FAIR_MQ_TOOLS_CPPSTL_H
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
namespace fair::mq::tools
|
||||
{
|
||||
|
||||
// provide an enum hasher to compensate std::hash not supporting enums in C++11
|
||||
template<typename Enum>
|
||||
struct HashEnum
|
||||
{
|
||||
auto operator()(const Enum& e) const noexcept
|
||||
-> typename std::enable_if<std::is_enum<Enum>::value, std::size_t>::type
|
||||
{
|
||||
using _type = typename std::underlying_type<Enum>::type;
|
||||
return std::hash<_type>{}(static_cast<_type>(e));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace fair::mq::tools
|
||||
|
||||
|
Reference in New Issue
Block a user