38#include <gtest/gtest.h>
71 const auto &
carr = arr;
83 for (
size_t i = 0; i <
copy.size(); ++i)
143 for (
size_t i = 0; i < arr.
size(); ++i)
144 arr[i] =
static_cast<int>(i * 10);
174 for (
int i = 1; i <= 5; ++i)
177 const std::array<int, 5>
ascending = {1, 2, 3, 4, 5};
178 const std::array<int, 5>
descending = {5, 4, 3, 2, 1};
181 for (
size_t i = 0; i <
descending.size(); ++i)
186 for (
size_t i = 0; i <
ascending.size(); ++i)
190 for (
size_t i = 0; i <
ascending.size(); ++i)
191 EXPECT_EQ(arr[i],
ascending[i]) <<
"reverse_in_place() alias should behave like reverse()";
194 for (
size_t i = 0; i <
descending.size(); ++i)
213 explicit MoveOnlyOp(
bool *c) : called(c) {}
214 MoveOnlyOp(
const MoveOnlyOp &) =
delete;
215 MoveOnlyOp & operator=(
const MoveOnlyOp &) =
delete;
216 MoveOnlyOp(MoveOnlyOp &&) =
default;
217 MoveOnlyOp & operator=(MoveOnlyOp &&) =
default;
281template <
class Container,
class Operation>
287struct MutableArrayOperation
289 bool operator () (
int &)
const {
return true; }
314 for (; it.has_curr(); it.next())
331 for (
size_t i = 0; i <
vec.size(); ++i)
340 DefaultInit() : v(123) {}
341 explicit DefaultInit(
int x) : v(x) {}
342 bool operator==(
const DefaultInit &
o)
const {
return v ==
o.v; }
349 const int value = 42;
352 for (
size_t i = 0; i < n; ++i)
359 const std::string
value =
"abc";
362 for (
size_t i = 0; i < n; ++i)
370 static_assert(std::is_trivially_default_constructible_v<int>);
373 for (
size_t i = 0; i < arr.
size(); ++i)
374 arr[i] =
static_cast<int>(i * 3);
375 for (
size_t i = 0; i < arr.
size(); ++i)
376 EXPECT_EQ(arr[i],
static_cast<int>(i * 3));
383 static_assert(!std::is_trivially_default_constructible_v<DefaultInit>);
385 for (
size_t i = 0; i < n; ++i)
388 arr[0] = DefaultInit(7);
bool operator==(const Time &l, const Time &r)
Deduplicate sequential Aleph containers in-place.
size_t size_t int32_t value
Simple dynamic array with automatic resizing and functional operations.
static Array create(size_t n)
Create an array with n logical elements.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
void empty() noexcept
Empties the container.
constexpr bool is_empty() const noexcept
Checks if the container is empty.
T & base()
Return a reference to the first element of array.
T & insert(const T &data)
insert a copy of data at the beginning of the array.
Array & rev()
Reverse this array in place.
void swap(Array &s) noexcept
Swap this with s
Array & reverse_in_place()
Alias for reverse().
bool traverse(Op &op)
Traverse mutable elements from first to last.
T & get_first() noexcept
return a modifiable reference to the first element.
Array & reverse()
Reverse the order of items in this array, in place.
T & append(const T &data)
Append a copy of data
T & get_last() noexcept
return a modifiable reference to the last element.
constexpr size_t capacity() const noexcept
Return the internal capacity.
void reserve(size_t cap)
Reserves cap cells into the array.
void putn(const size_t n)
Reserve n additional logical slots in the array without value-initializing them.
Array to_array() const
Copy to Aleph::Array (requires copyable elements).
Minimal std::expected-style result type for C++20.
bool contains(const Type &item) const
Test if an item is present in the container using equality.
bool contains_if(Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
Test if an item satisfying a criterion is present in the container.
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.
void in_place_unique(Container &c, Compare cmp={})
Remove duplicates in-place preserving first occurrence order.
Itor2 copy(Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg)
Copy elements from one range to another.
T accumulate(Itor beg, Itor end, T initValue)
Accumulate values in a range.
std::vector< typename Container::Item_Type > to_stdvector(const Container &c)
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
Iterator on the items of an array.
Dynamic array container with automatic resizing.