EnumHashSpecialization.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 
6 #include <functional>
7 
8 template<typename E>
9 class enum_hash
10 {
11 public:
12  size_t operator()(const E& e) const
13  {
14  using UnderlyingType = typename std::underlying_type<E>::type;
15 
16  return std::hash<UnderlyingType>()(static_cast<UnderlyingType>(e));
17  }
18 };
Definition: EnumHashSpecialization.h:10
size_t operator()(const E &e) const
Definition: EnumHashSpecialization.h:12

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.