53 std::cout <<
"ids_v1 contains 10: " << ids_v1.
contains(10) <<
'\n';
54 std::cout <<
"ids_v2 contains 10: " << ids_v2.contains(10) <<
'\n';
57 auto names_v1 = names.
insert(1, std::string(
"Ada"));
60 std::cout <<
"old name: " << *names_v1.
find(1) <<
'\n';
61 std::cout <<
"new name: " << *names_v2.find(1) <<
'\n';
65 auto log_v2 = log_v1.
push_back(std::string(
"reviewed"));
66 auto log_v3 = log_v2.
set(1, std::string(
"approved"));
68 std::cout <<
"log_v2[1]: " << log_v2.
get(1) <<
'\n';
69 std::cout <<
"log_v3[1]: " << log_v3.get(1) <<
'\n';
71 return ids_v1.contains(10)
and not ids_v2.contains(10)
and
72 *names_v1.find(1) ==
"Ada" and *names_v2.find(1) ==
"Ada Lovelace" and
73 log_v2.get(1) ==
"reviewed" and log_v3.get(1) ==
"approved" ? 0 : 1;
Immutable ordered map backed by a path-copying treap.
const T * find(const Key &key) const
Find a mapped value.
and std::constructible_from< T, VArg && > PersistentTreapMap insert_or_assign(KArg &&key, VArg &&value) const
Return a new version with key assigned to value.
and std::constructible_from< T, VArg && > PersistentTreapMap insert(KArg &&key, VArg &&value) const
Return a new version with a binding inserted if absent.
Immutable ordered set backed by a path-copying treap.
PersistentTreapSet erase(const Key &key) const
Return a new version without key.
PersistentTreapSet insert(const Key &key) const
Return a new version with key inserted by copy.
bool contains(const Key &key) const
Test whether key is present.
Immutable vector backed by a 32-way bitmapped trie.
PersistentVector push_back(const T &value) const
Return a new version with value appended by copy.
const T & get(const size_t index) const
Read a value by index.
PersistentVector set(const size_t index, const T &value) const
Return a new version with one index replaced by copy.
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_log_function > > log(const __gmp_expr< T, U > &expr)
and
Check uniqueness with explicit hash + equality functors.
Immutable path-copying treap set and map.
Immutable bitmapped-vector trie with structural sharing.