38#include <gtest/gtest.h>
70 const auto &
carr = arr;
128 for (
size_t i = 0; i < arr.
size(); ++i)
129 arr[i] =
static_cast<int>(i * 10);
159 for (
int i = 1; i <= 5; ++i)
162 const std::array<int, 5>
ascending = {1, 2, 3, 4, 5};
163 const std::array<int, 5>
descending = {5, 4, 3, 2, 1};
186 explicit MoveOnlyOp(
bool *c) : called(c) {}
187 MoveOnlyOp(
const MoveOnlyOp &) =
delete;
188 MoveOnlyOp & operator=(
const MoveOnlyOp &) =
delete;
189 MoveOnlyOp(MoveOnlyOp &&) =
default;
190 MoveOnlyOp & operator=(MoveOnlyOp &&) =
default;
231 for (; it.has_curr(); it.next())
248 for (
size_t i = 0; i <
vec.
size(); ++i)
257 DefaultInit() : v(123) {}
258 explicit DefaultInit(
int x) : v(x) {}
259 bool operator==(
const DefaultInit &
o)
const {
return v ==
o.v; }
266 const int value = 42;
269 for (
size_t i = 0; i < n; ++i)
276 const std::string value =
"abc";
279 for (
size_t i = 0; i < n; ++i)
287 static_assert(std::is_trivially_default_constructible_v<int>);
290 for (
size_t i = 0; i < arr.
size(); ++i)
291 arr[i] =
static_cast<int>(i * 3);
292 for (
size_t i = 0; i < arr.
size(); ++i)
293 EXPECT_EQ(arr[i],
static_cast<int>(i * 3));
300 static_assert(!std::is_trivially_default_constructible_v<DefaultInit>);
302 for (
size_t i = 0; i < n; ++i)
305 arr[0] = DefaultInit(7);
bool operator==(const Time &l, const Time &r)
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
Empty the stack.
constexpr bool is_empty() const noexcept
Return true if stack 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
T & append(const T &data)
Append a copy of data
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 & 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.
T & append(const T &item)
Append a new item by copy.
T & get_last() const
Return the last item of the list.
T & get_first() const
Return the first item of the list.
DynList & reverse() noexcept
size_t size() const noexcept
Count the number of elements of the list.
LocateFunctions< Container, Type > * base() const
Main namespace for Aleph-w library functions.
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)
DynList< T > maps(const C &c, Op op)
Classic map operation.
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.