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)
194 for (
size_t i = 0; i <
descending.size(); ++i)
201 explicit MoveOnlyOp(
bool *c) : called(c) {}
202 MoveOnlyOp(
const MoveOnlyOp &) =
delete;
203 MoveOnlyOp & operator=(
const MoveOnlyOp &) =
delete;
204 MoveOnlyOp(MoveOnlyOp &&) =
default;
205 MoveOnlyOp & operator=(MoveOnlyOp &&) =
default;
259 for (; it.has_curr(); it.next())
276 for (
size_t i = 0; i <
vec.size(); ++i)
285 DefaultInit() : v(123) {}
286 explicit DefaultInit(
int x) : v(x) {}
287 bool operator==(
const DefaultInit &
o)
const {
return v ==
o.v; }
294 const int value = 42;
297 for (
size_t i = 0; i < n; ++i)
304 const std::string value =
"abc";
307 for (
size_t i = 0; i < n; ++i)
315 static_assert(std::is_trivially_default_constructible_v<int>);
318 for (
size_t i = 0; i < arr.
size(); ++i)
319 arr[i] =
static_cast<int>(i * 3);
320 for (
size_t i = 0; i < arr.
size(); ++i)
321 EXPECT_EQ(arr[i],
static_cast<int>(i * 3));
328 static_assert(!std::is_trivially_default_constructible_v<DefaultInit>);
330 for (
size_t i = 0; i < n; ++i)
333 arr[0] = DefaultInit(7);
bool operator==(const Time &l, const Time &r)
Deduplicate sequential Aleph containers in-place.
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.
void swap(Array &s) noexcept
Swap this with s
bool traverse(Operation &operation)
Traverse all the items of the stack from the youngest to the oldest and conditionally performs an ope...
T & get_first() noexcept
return a modifiable reference to the first element.
Array & reverse()
Reverse the order of items in array.
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).
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.
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.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
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.