Files
parallel-hashmap/examples/hash_std.cc
T
2019-03-30 14:10:57 -04:00

22 lines
577 B
C++

#include <iostream>
#include <string>
#include "hash_std.h" // defines Person with std::hash specialization
#include <parallel_hashmap/phmap.h>
int main()
{
// As we have defined a specialization of std::hash() for Person,
// we can now create sparse_hash_set or sparse_hash_map of Persons
// ----------------------------------------------------------------
phmap::flat_hash_set<Person> persons =
{ { "John", "Galt" },
{ "Jane", "Doe" }
};
for (auto& p: persons)
std::cout << p._first << ' ' << p._last << '\n';
}