mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 08:34:39 +08:00
update comments
This commit is contained in:
Vendored
+2
-1
@@ -20,7 +20,8 @@ struct Person
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
// inject specialization of std::hash for Person into namespace std
|
// inject specialization of std::hash for Person into namespace std
|
||||||
// ----------------------------------------------------------------
|
// An alternative is to provide a hash_value() friend function (see hash_value.h)
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
template<> struct hash<Person>
|
template<> struct hash<Person>
|
||||||
{
|
{
|
||||||
std::size_t operator()(Person const &p) const
|
std::size_t operator()(Person const &p) const
|
||||||
|
|||||||
Vendored
+3
@@ -12,6 +12,9 @@ struct Person
|
|||||||
return _first == o._first && _last == o._last && _age == o._age;
|
return _first == o._first && _last == o._last && _age == o._age;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Demonstrates how to provide the hash function as a friend member function of the class
|
||||||
|
// This can be used as an alternative to providing a std::hash<Person> specialization
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
friend size_t hash_value(const Person &p)
|
friend size_t hash_value(const Person &p)
|
||||||
{
|
{
|
||||||
return phmap::HashState().combine(0, p._first, p._last, p._age);
|
return phmap::HashState().combine(0, p._first, p._last, p._age);
|
||||||
|
|||||||
Reference in New Issue
Block a user