52#include <initializer_list>
215 requires(std::is_copy_constructible_v<T>
and std::is_copy_assignable_v<T>)
218 for (
size_t i = 0; i < n; ++i)
254 requires(std::is_copy_constructible_v<T>
and std::is_copy_assignable_v<T>)
269 template <
template <
typename>
class List>
282 template <std::input_iterator It, std::sentinel_for<It> Sentinel>
285 for (; first != last; ++first)
296 for (
const auto &item :
items)
302 requires(std::is_copy_constructible_v<T>
and std::is_copy_assignable_v<T>)
332 requires std::is_copy_assignable_v<T>
334 return array.put(data);
345 return array.put(std::forward<T>(data));
370 return array.push(data);
382 return array.push(std::forward<T>(data));
411 return *
array.get_ptr();
417 return *
array.get_ptr();
444 [[nodiscard]]
constexpr bool is_empty() const noexcept
446 return array.size() == 0;
450 [[nodiscard]]
constexpr size_t size() const noexcept
456 [[nodiscard]]
constexpr size_t capacity() const noexcept
458 return array.capacity();
467 return array.first();
476 return array.first();
499 return array.remove_last();
504 return array.remove_first();
528 [[nodiscard]]
constexpr const T &
operator () (
const size_t i)
const noexcept
559 for (
size_t i = 0; i < n; ++i)
616 requires std::predicate<Op &, T &>
619 return array.traverse(op);
635 requires std::predicate<Op &, const T &>
638 for (
size_t i = 0; i <
size(); ++i)
639 if (not op((*
this)[i]))
659 requires std::predicate<Op &, T &>
662 return traverse<Op>(op);
678 requires std::predicate<Op &, const T &>
681 return traverse<Op>(op);
686 return array.is_valid();
691 requires
std::copy_constructible<
T>
722template <
typename T,
typename... Args>
725 return build_container<Array<T>>(std::forward<Args>(args)...);
728template <
class Container>
731 std::vector<typename Container::Item_Type> ret(c.size());
732 for (
size_t i = 0; i < c.size(); ++i)
Variadic constructor macros for containers.
Container traversal and functional operation mixins.
#define ah_underflow_error_if(C)
Throws std::underflow_error if condition holds.
STL-compatible iterator adapters for Aleph containers.
Core header for the Aleph-w library.
size_t size_t int32_t value
Simple dynamic array with automatic resizing and functional operations.
static Array create_reserved(const size_t cap)
Build an empty array with room for at least cap items.
Array rev() const
Alias for reverse() const.
bool traverse(Op &&op) const
Traverse const elements with a temporary operation.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
void empty() noexcept
Empties the container.
void clear() noexcept
Empties the container.
T & append(T &&data)
Append data
constexpr bool is_empty() const noexcept
Checks if the container is empty.
Array(const List< T > &items)
Copy elements from an Aleph container in traversal order.
T & base()
Return a reference to the first element of array.
Array(size_t n, const T &value)
Construct an array with n copies of value.
T Key_Type
The type of element.
T & insert(const T &data)
insert a copy of data at the beginning of the array.
const T & get_last() const
Return a constant reference to the last element.
Array(size_t)=delete
Deleted: a single integer argument is not accepted.
Array & rev()
Reverse this array in place.
Array(Reserve_Tag, const size_t cap)
Construct an empty array with at least cap slots of capacity.
Array(Array &&s) noexcept
Move constructor.
Array(std::initializer_list< T > items)
Construct from the listed elements in order.
void swap(Array &s) noexcept
Swap this with s
Array & reverse_in_place()
Alias for reverse().
bool traverse(Op &op) const
Traverse const elements from first to last.
T & get_last()
Return a modifiable reference to the last element.
const T & get_first() const
Return a constant reference to the first element.
Array append(const Array &a) const
bool traverse(Op &op)
Traverse mutable elements from first to last.
bool traverse(Op &&op)
Traverse mutable elements with a temporary operation.
Array & append(const Array &a)
T & insert(T &&data)
insert a copy of data at the beginning of the array.
T & operator[](size_t i)
Return a reference to the ith element.
static Array create(const size_t n)
Create an array with n logical elements.
constexpr T & operator()(const size_t i) noexcept
Return element i; requires i < size(), asserted in Debug builds.
Array(const Array &s)
Copy constructor.
Array & reverse()
Reverse the order of items in this array, in place.
bool is_valid() const noexcept
Array & operator=(const Array &s)
Assign by copy s to this
T & append(const T &data)
Append a copy of data
constexpr size_t capacity() const noexcept
Return the internal capacity.
Array reverse() const
Return a copy of this array with its items reversed.
Array(It first, Sentinel last)
Construct from an input iterator range [first, last).
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 & get_first()
Return a modifiable reference to the first element.
Array to_array() const
Copy to Aleph::Array (requires copyable elements).
Read-only view of an Aleph iterator: the iterator of a constant container.
Node belonging to a double circular linked list with header node.
Simple, scalable and fast dynamic array.
Mixin providing equality comparison for sequence containers.
Common methods to the Aleph-w ( ) containers.
and
Insert a new element into the container by constructing it from the given args.
void for_each(Operation &operation) const
Traverse all the container and performs an operation on each element.
Common sequential searching methods on containers.
Mixin that adds STL begin()/end() and cbegin()/cend() to Aleph containers.
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
Array< T > build_array(Args &&... args)
std::decay_t< typename HeadC::Item_Type > T
std::vector< typename Container::Item_Type > to_stdvector(const Container &c)
Iterator on the items of an array.
Iterator(Array< T > &s) noexcept
Iterator on the modifiable array s.
Iterator(const Array< T > &)=delete
A constant array is iterated through Const_Iterator.
typename MemArray< T >::Iterator Base
Tag that selects the capacity constructor used by create_reserved().
Simple iterator on elements of array.
Generic list of items stored in a container.
Aleph::DynList< T > items() const
Return a list of all the elements of a container sorted by traversal order.
Dynamic doubly linked list implementation.
Simple, scalable, contiguous dynamic array.