mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 16:40:39 +08:00
add couple examples
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#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';
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user