49 cout <<
"Aleph-w PersistentHashMap Example" <<
endl;
50 cout <<
"=================================" <<
endl;
58 cout <<
"m1 has " <<
m1.
size() <<
" bindings." <<
endl;
67 auto duplicate =
m1.insert(
"apple", 15);
68 assert(*duplicate.find(
"apple") == 10);
71 auto m2 =
m1.insert_or_assign(
"apple", 15).insert(
"grape", 40);
73 cout <<
"m2 has " <<
m2.size() <<
" bindings after update/insert." <<
endl;
81 auto m3 =
m2.erase(
"orange").erase(
"banana");
83 cout <<
"m3 has " <<
m3.size() <<
" bindings after erasing." <<
endl;
92 cout <<
"All persistent structural-sharing invariants are valid." <<
endl;
Immutable unordered map backed by a Hash Array Mapped Trie (HAMT).
PersistentHashMap insert(const Key &key, const T &value) const
Return a new version with key inserted if absent.
size_t size() const noexcept
Return the number of bindings stored in this version.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Immutable path-copying hash map backed by a HAMT.