cginternals / cginternals/cppassist

Provide generic hasher for enum classes

Open
#22 4 comments 0 reactions 0 assignees View on GitHub
decision required
Dominant language
C++
Stars
29
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Possible implementation:
```cpp
template
struct EnumClassHash
{
std::hash::result_type operator()(
const EnumClass & arg) const
{
static std::hash hasher;
return hasher(static_cast(arg));
}
};
```

Possible usage:
```cpp
template <>
struct hash : EnumClassHash {};
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.