35#include <gtest/gtest.h>
48 struct CopyTrackedValue
50 static inline int copy_assignments = 0;
51 static inline int moves = 0;
55 CopyTrackedValue() =
default;
57 CopyTrackedValue(
const CopyTrackedValue &) =
default;
59 CopyTrackedValue &operator = (
const CopyTrackedValue &
other)
noexcept
71 CopyTrackedValue &operator = (CopyTrackedValue &&
other)
noexcept
95 for (
size_t i = 0; i < vector.
size(); ++i)
96 out.push_back(vector.
get(i));
138 auto changed = base.set(1, 99);
150 for (
int i = 0; i < 40; ++i)
154 for (
int i = 0; i < 7; ++i)
169 for (
int i = 0; i < 1100; ++i)
190 for (
int i = 0; i < 10; ++i)
195 for (
size_t i = 0; i < array.size(); ++i)
196 EXPECT_EQ(array[i],
static_cast<int>(i));
202 const CopyTrackedValue one{1};
203 const CopyTrackedValue
two{2};
207 CopyTrackedValue::reset_counters();
212 EXPECT_EQ(CopyTrackedValue::copy_assignments, 2);
220 auto one = vector.
push_back(std::make_unique<int>(10));
236 std::mt19937
rng(0xFACEB00Cu);
237 std::uniform_int_distribution<int>
op_dist(0, 2);
238 std::uniform_int_distribution<int>
value_dist(-5000, 5000);
241 std::vector<int> reference;
253 const int op = reference.empty() ? 0 :
op_dist(
rng);
258 reference.push_back(
value);
262 std::uniform_int_distribution<size_t>
index_dist(0, reference.size() - 1);
266 reference[index] =
value;
271 reference.pop_back();
276 for (
size_t i = 0; i < reference.size(); ++i)
size_t size_t int32_t value
size_t size_t int32_t * out
Immutable vector backed by a 32-way bitmapped trie.
Array< T > to_array() const
Return all values in an Aleph array.
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.
bool verify() const noexcept
Verify trie shape and logical prefix invariants.
PersistentVector set(const size_t index, const T &value) const
Return a new version with one index replaced by copy.
size_t size() const noexcept
Return the number of values in this version.
bool is_empty() const noexcept
Return true when the vector has no values.
PersistentVector pop_back() const
Return a new version without the last value.
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.
bool operator==(const DynList< T > &l1, const DynList< T > &l2)
Equality operator for DynList.
std::vector< typename C::Item_Type > to_vector(const C &c)
Convert a container to a std::vector.
Immutable bitmapped-vector trie with structural sharing.