mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 08:34:39 +08:00
26 lines
574 B
C++
26 lines
574 B
C++
|
|
#ifndef phmap_example_hash_value_
|
||
|
|
#define phmap_example_hash_value_
|
||
|
|
|
||
|
|
#include <parallel_hashmap/phmap_utils.h> // minimal header providing phmap::HashState()
|
||
|
|
#include <string>
|
||
|
|
using std::string;
|
||
|
|
|
||
|
|
struct Person
|
||
|
|
{
|
||
|
|
bool operator==(const Person &o) const
|
||
|
|
{
|
||
|
|
return _first == o._first && _last == o._last && _age == o._age;
|
||
|
|
}
|
||
|
|
|
||
|
|
friend size_t hash_value(const Person &p)
|
||
|
|
{
|
||
|
|
return phmap::HashState().combine(0, p._first, p._last, p._age);
|
||
|
|
}
|
||
|
|
|
||
|
|
string _first;
|
||
|
|
string _last;
|
||
|
|
int _age;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // phmap_example_hash_value_
|