Toggle navigation
Home
Documentation
FAQ
Releases
Download
GitHub
Main Page
Related Pages
Modules
Classes
projects
biogears
libBiogears
include
biogears
cdm
utils
EnumHashSpecialization.h
1
/**************************************************************************************
2
Copyright 2015 Applied Research Associates, Inc.
3
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
this file except in compliance with the License. You may obtain a copy of the License
5
at:
6
http://www.apache.org/licenses/LICENSE-2.0
7
Unless required by applicable law or agreed to in writing, software distributed under
8
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
specific language governing permissions and limitations under the License.
11
**************************************************************************************/
12
13
#pragma once
14
15
#include <functional>
16
17
namespace
biogears
{
18
template
<
typename
E>
19
class
enum_hash
{
20
public
:
21
size_t
operator()
(
const
E& e)
const
22
{
23
using
UnderlyingType =
typename
std::underlying_type<E>::type;
24
25
return
std::hash<UnderlyingType>()(static_cast<UnderlyingType>(e));
26
}
27
};
28
}
biogears::enum_hash::operator()
size_t operator()(const E &e) const
Definition:
EnumHashSpecialization.h:21
biogears::enum_hash
Definition:
EnumHashSpecialization.h:19
biogears
Definition:
SEElectricalCircuit.h:18