Zen C++ Libraries
Zero-dependency re-usable components for C++
Loading...
Searching...
No Matches
include
zen
hash.hpp
1
2
#include <functional>
3
#include <string>
4
5
namespace
std {
6
7
template
<
8
typename
CharT,
9
typename
Traits,
10
typename
Allocator
11
>
struct
hash<std::basic_string<CharT, Traits, Allocator>> {
12
13
std::size_t operator()(
const
std::basic_string<CharT, Traits, Allocator> str)
const
noexcept
{
14
std::size_t h = 17;
15
for
(
auto
ch: str) {
16
h = h * 19 + ch;
17
}
18
return
h;
19
}
20
21
};
22
23
}
24
25
Generated by
1.15.0