Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Array< T > Class Template Reference

Simple dynamic array with automatic resizing and functional operations. More...

#include <tpl_array.H>

Inheritance diagram for Aleph::Array< T >:
[legend]
Collaboration diagram for Aleph::Array< T >:
[legend]

Classes

struct  Iterator
 Iterator on the items of an array. More...
 

Public Types

using Item_Type = T
 
using Key_Type = T
 The type of element.
 
- Public Types inherited from StlAlephIterator< Array< T > >
using iterator = StlIterator< Array< T > >
 
using const_iterator = StlConstIterator< Array< T > >
 

Public Member Functions

 Array (size_t dim=32)
 The type of key.
 
 Array (size_t n, const T &value)
 Construct an array with n copies of value.
 
 Array (const Array &s)
 Copy constructor.
 
 Array (Array &&s) noexcept
 Move constructor.
 
template<template< typename > class List>
 Array (const List< T > &l)
 
template<class It >
 Array (It b, It e)
 
 Array (std::initializer_list< T > l)
 
template<typename ... Args>
 Array (const T &item, Args &... args)
 
template<typename ... Args>
 Array (T &&item, Args &... args)
 
Arrayoperator= (const Array &s)
 Assign by copy s to this
 
void swap (Array &s) noexcept
 Swap this with s
 
Arrayoperator= (Array &&s) noexcept
 Assign by moving s to this
 
Tappend (const T &data)
 Append a copy of data
 
Tappend (T &&data)
 Append data
 
Arrayappend (const Array &a)
 
Array append (const Array &a) const
 
Tinsert (const T &data)
 insert a copy of data at the beginning of the array.
 
Tinsert (T &&data)
 insert a copy of data at the beginning of the array.
 
void putn (const size_t n)
 Reserve n additional logical slots in the array without value-initializing them.
 
void reserve (size_t cap)
 Reserves cap cells into the array.
 
Tbase ()
 Return a reference to the first element of array.
 
const Tbase () const
 
void empty () noexcept
 Empty the stack.
 
constexpr bool is_empty () const noexcept
 Return true if stack is empty.
 
constexpr size_t size () const noexcept
 Return the number of elements stored in the stack.
 
constexpr size_t capacity () const noexcept
 Return the internal capacity.
 
Tget_first () noexcept
 return a modifiable reference to the first element.
 
const Tget_first () const noexcept
 return a constant reference to the first element.
 
Tget_last () noexcept
 return a modifiable reference to the last element.
 
const Tget_last () const noexcept
 return a constant reference to the last element.
 
T remove_last ()
 
T remove_first ()
 
Toperator[] (size_t i)
 Return a reference to the ith element.
 
const Toperator[] (size_t i) const
 Return a constant reference to the ith element.
 
constexpr Toperator() (const size_t i) noexcept
 Return a reference to the ith element. It does not perform bound_statics checks.
 
constexpr const Toperator() (const size_t i) const noexcept
 Return a constant reference to the ith element. It does not perform bound_statics checks.
 
Arrayreverse ()
 Reverse the order of items in array.
 
Array reverse () const
 Return a copy of this with its items reversed.
 
Arrayrev ()
 
Array rev () const
 
template<class Operation >
bool traverse (Operation &operation)
 Traverse all the items of the stack from the youngest to the oldest and conditionally performs an operation.
 
template<class Operation >
bool traverse (Operation &operation) const
 
template<class Operation >
bool traverse (Operation &&operation=Operation()) const
 
template<class Operation >
bool traverse (Operation &&operation=Operation())
 
bool is_valid () const noexcept
 
- Public Member Functions inherited from LocateFunctions< Array< T >, T >
auto get_it () const
 Return a properly initialized iterator positioned at the first item on the container.
 
auto get_it (const size_t pos) const
 Return a properly initialized iterator positioned at the pos item on the container.
 
auto get_itor () const
 Alias of get_it().
 
T & nth_ne (const size_t n) noexcept
 Return the n‑th element without bounds checking.
 
const T & nth_ne (const size_t n) const noexcept
 Const overload of nth_ne(size_t).
 
T & nth (const size_t n)
 Return the n-th item of container.
 
const T & nth (const size_t n) const
 Const overload of nth(size_t).
 
T * find_ptr (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Find a pointer to an item in the container according to a searching criteria.
 
const T * find_ptr (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Const overload of find_ptr(Operation&).
 
const T * find_ptr (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) const that accepts rvalues.
 
T * find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) that accepts rvalues.
 
size_t find_index (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Find the position of an item in the container according to a searching criteria.
 
size_t find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_index(Operation&) that accepts rvalues.
 
std::tuple< bool, T > find_item (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Safe sequential searching of an item matching a criteria.
 
std::tuple< bool, T > find_item (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 
std::tuple< bool, T > find_item (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 
std::tuple< bool, T > find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 
- Public Member Functions inherited from FunctionalMethods< Array< T >, T >
void emplace (Args &&... args)
 Appends a new element into the container by constructing it in-place with the given args.
 
void emplace_end (Args &&... args)
 
void emplace_ins (Args &&... args)
 Insert a new element into the container by constructing it in-place with the given args.
 
size_t ninsert (Args ... args)
 Insert n variadic items.
 
size_t nappend (Args ... args)
 Append n variadic items.
 
void for_each (Operation &operation)
 Traverse all the container and performs an operation on each element.
 
void for_each (Operation &operation) const
 Const overload of for_each(Operation&).
 
void for_each (Operation &&operation) const
 Overload of for_each(Operation&) const that accepts rvalues.
 
void for_each (Operation &&operation)
 Overload of for_each(Operation&) that accepts rvalues.
 
void each (Operation &operation)
 Alias of for_each(Operation&).
 
void each (Operation &operation) const
 Const alias of for_each(Operation&).
 
void each (Operation &&operation) const
 Const alias of for_each(Operation&) that accepts rvalues.
 
void each (Operation &&operation)
 Alias of for_each(Operation&) that accepts rvalues.
 
void each (size_t pos, const size_t slice, Operation &operation) const
 Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element.
 
void each (const size_t pos, const size_t slice, Operation &&operation) const
 
void mutable_for_each (Operation &operation)
 
void mutable_for_each (Operation &&operation)
 
bool all (Operation &operation) const
 Check if all the elements of container satisfy a condition.
 
bool all (Operation &&operation) const
 Overload of all(Operation&) that accepts rvalues.
 
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criteria.
 
bool exists (Operation &&op) const
 Overload of exists(Operation&) that accepts rvalues.
 
Aleph::DynList< __T > maps (Operation &op) const
 Map the elements of the container.
 
Aleph::DynList< __T > maps (Operation &&op) const
 Overload of maps(Operation&) that accepts rvalues.
 
Aleph::DynList< __Tmaps_if (Prop prop, Operation &op) const
 Conditional mapping of the elements of the container.
 
Aleph::DynList< __Tmaps_if (Prop prop, Operation &&op) const
 Overload of maps_if(Prop, Operation&) that accepts rvalues.
 
Aleph::DynList< T > to_dynlist () const
 Convert container to DynList.
 
std::vector< T > to_vector () const
 Convert container to std::vector.
 
__T foldl (const __T &init, Op &op) const
 Fold the elements of the container to a specific result.
 
__T foldl (const __T &init, Op &&op=Op()) const
 Overload of foldl(const __T&, Op&) that accepts rvalues.
 
__T fold_left (const __T &init, Op &op) const
 Alias for foldl with the same accumulator type.
 
__T fold_left (const __T &init, Op &&op=Op()) const
 Overload of fold_left(const __T&, Op&) that accepts rvalues.
 
fold (const T &init, Operation &operation) const
 Simplified version of foldl() where the folded type is the same type of elements stored in the container.
 
fold (const T &init, Operation &&operation) const
 Overload of fold(const T&, Operation&) that accepts rvalues.
 
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria.
 
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter(Operation&) that accepts rvalues.
 
Aleph::DynList< const T * > ptr_filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and return a pointer to the matched items in the container.
 
Aleph::DynList< const T * > ptr_filter (Operation &&operation) const
 Overload of ptr_filter(Operation&) that accepts rvalues.
 
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container.
 
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 Overload of pfilter(Operation&) that accepts rvalues.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &&op) const
 Overload of partition(Operation&) that accepts rvalues.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (size_t n) const
 Exclusive partition of container in the nth item.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > split_half () const
 Split the container into two halves by alternating elements.
 
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &&op) const
 Overload of tpartition(Operation&) that accepts rvalues.
 
size_t length () const noexcept
 Count the number of elements of a container.
 
Aleph::DynList< T > rev () const
 Return a list with the elements of container in reverse order respect to its traversal order.
 
Aleph::DynList< T > take (const size_t n) const
 Return a list with the first n elements seen in the container during its traversal.
 
Aleph::DynList< T > take (size_t i, const size_t j, const size_t step=1) const
 Return a list with elements seen in the container between i and j position respect to its traversal.
 
Aleph::DynList< T > drop (const size_t n) const
 Drop the first n elements seen in the container during its traversal.
 
void mutable_drop (const size_t n)
 Drop the first n elements seen from container.
 
- Public Member Functions inherited from GenericItems< Container, T >
Aleph::DynList< T > items () const
 Return a list of all the elements of a container sorted by traversal order.
 
Aleph::DynList< T > keys () const
 
- Public Member Functions inherited from EqualToMethod< Array< T > >
bool equal_to (const Array< T > &r) const noexcept
 Test if elements of this are exactly contained in another container.
 
bool operator== (const Array< T > &r) const noexcept
 
bool operator!= (const Array< T > &r) const noexcept
 Negation of equal_to()
 
- Public Member Functions inherited from StlAlephIterator< Array< T > >
iterator begin () noexcept
 Return an STL-compatible iterator to the first element.
 
const_iterator begin () const noexcept
 Return a const iterator to the first element.
 
iterator end () noexcept
 Return an STL-compatible end iterator.
 
const_iterator end () const noexcept
 Return a const end iterator.
 
const_iterator cbegin () const noexcept
 Return a const iterator to the first element.
 
const_iterator cend () const noexcept
 Return a const end iterator.
 

Static Public Member Functions

static Array create (size_t n)
 Create an array with n logical elements.
 

Private Attributes

MemArray< Tarray
 

Additional Inherited Members

Detailed Description

template<typename T>
class Aleph::Array< T >

Simple dynamic array with automatic resizing and functional operations.

Array<T> is a straightforward dynamic array implemented using a contiguous memory buffer that automatically grows or shrinks as elements are added or removed. It provides O(1) indexed access and amortized O(1) append.

This container offers a balance between simplicity and functionality, supporting both indexed access and a rich set of functional operations (map, filter, fold, etc.).

Template Parameters
TThe type of elements stored in the array.
Complexity:
  • Access by index: O(1)
  • append() / insert() at end: O(1) amortized
  • insert() at arbitrary position: O(n)
  • remove(): O(n) for search + O(n) for shift
  • size(): O(1)
  • Resize: O(n) when capacity is exceeded
Key Features:
  • O(1) indexed access via operator[]
  • Automatic capacity management
  • Functional programming operations (map, filter, fold, etc.)
  • STL-compatible iterators
  • Conversion to/from STL vectors and other containers
Comparison with Similar Containers:
  • Array vs DynArray: Array uses simple contiguous allocation; DynArray uses lazy three-level indexing for sparse arrays.
  • Array vs DynList: Array has O(1) indexed access but O(n) insertion in the middle; DynList has O(1) insertion/removal but O(n) indexed access.
  • Array vs std::vector: Similar behavior, but Array includes functional methods and integrates with Aleph-w ecosystem.
Example:
Array<int> arr(10); // Initial capacity of 10
// Add elements
arr.push(42);
arr.push(17);
arr.push(99);
// Indexed access (O(1))
std::cout << arr[1] << '\n'; // 17
arr[1] = 25;
// Functional operations
auto doubled = arr.maps<int>([](int x) { return x * 2; });
int sum = arr.foldl(0, [](int acc, int x) { return acc + x; });
auto evens = arr.filter([](int x) { return x % 2 == 0; });
// Convert to vector
std::vector<int> vec = arr.asVector();
// Range-based for
for (int x : arr)
std::cout << x << " ";
Simple dynamic array with automatic resizing and functional operations.
Definition tpl_array.H:138
Aleph::DynList< __T > maps(Operation &op) const
Map the elements of the container.
Definition ah-dry.H:904
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
STL namespace.
Note
Memory is contiguous, providing good cache locality.
Capacity grows automatically; manual control via reserve() if needed.
For sparse arrays with many gaps, consider DynArray instead.
See also
DynArray Lazy dynamic array with three-level indexing for sparse data.
DynList Doubly linked list alternative (O(1) insertion, O(n) access).
FunctionalMethods Inherited functional operations.
Author
Leandro Rabindranath León

Definition at line 133 of file tpl_array.H.

Member Typedef Documentation

◆ Item_Type

Definition at line 143 of file tpl_array.H.

◆ Key_Type

template<typename T >
using Aleph::Array< T >::Key_Type = T

The type of element.

Definition at line 144 of file tpl_array.H.

Constructor & Destructor Documentation

◆ Array() [1/9]

template<typename T >
Aleph::Array< T >::Array ( size_t  dim = 32)
inline

The type of key.

Initializes an array with a capacity of dim

Definition at line 147 of file tpl_array.H.

◆ Array() [2/9]

template<typename T >
Aleph::Array< T >::Array ( size_t  n,
const T value 
)
inline

Construct an array with n copies of value.

Creates an array of size n where each element is initialized by copy-constructing from value.

Parameters
[in]nNumber of elements to create.
[in]valueThe value to copy into each element.
Exceptions
std::bad_allocif memory allocation fails.
Note
Complexity: O(n) copies.
Exception safety: Strong guarantee (if allocation fails or T's copy constructor throws, no memory is leaked).
Thread safety: Safe to call concurrently on different instances; not thread-safe on the same instance.

Definition at line 161 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ Array() [3/9]

template<typename T >
Aleph::Array< T >::Array ( const Array< T > &  s)
inline

Copy constructor.

Definition at line 199 of file tpl_array.H.

◆ Array() [4/9]

template<typename T >
Aleph::Array< T >::Array ( Array< T > &&  s)
inlinenoexcept

Move constructor.

Definition at line 202 of file tpl_array.H.

◆ Array() [5/9]

template<typename T >
template<template< typename > class List>
Aleph::Array< T >::Array ( const List< T > &  l)
inline

Definition at line 205 of file tpl_array.H.

◆ Array() [6/9]

template<typename T >
template<class It >
Aleph::Array< T >::Array ( It  b,
It  e 
)
inline

Definition at line 205 of file tpl_array.H.

◆ Array() [7/9]

template<typename T >
Aleph::Array< T >::Array ( std::initializer_list< T l)
inline

Definition at line 205 of file tpl_array.H.

◆ Array() [8/9]

template<typename T >
template<typename ... Args>
Aleph::Array< T >::Array ( const T item,
Args &...  args 
)
inline

Definition at line 207 of file tpl_array.H.

◆ Array() [9/9]

template<typename T >
template<typename ... Args>
Aleph::Array< T >::Array ( T &&  item,
Args &...  args 
)
inline

Definition at line 207 of file tpl_array.H.

Member Function Documentation

◆ append() [1/4]

template<typename T >
Array & Aleph::Array< T >::append ( const Array< T > &  a)
inline

Definition at line 255 of file tpl_array.H.

References Aleph::Array< T >::append(), and Aleph::Array< T >::array.

◆ append() [2/4]

template<typename T >
Array Aleph::Array< T >::append ( const Array< T > &  a) const
inline

◆ append() [3/4]

◆ append() [4/4]

template<typename T >
T & Aleph::Array< T >::append ( T &&  data)
inline

Append data

Parameters
[in]datato be pushed by moving
Returns
a modifiable reference to the moved inserted data
Exceptions
bad_allocif there is no enough memory

Definition at line 250 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ base() [1/2]

template<typename T >
T & Aleph::Array< T >::base ( )
inline

Return a reference to the first element of array.

Definition at line 314 of file tpl_array.H.

References ah_underflow_error_if, Aleph::Array< T >::array, and Aleph::Array< T >::is_empty().

Referenced by LFit::LFit().

◆ base() [2/2]

template<typename T >
const T & Aleph::Array< T >::base ( ) const
inline

◆ capacity()

template<typename T >
constexpr size_t Aleph::Array< T >::capacity ( ) const
inlineconstexprnoexcept

Return the internal capacity.

Definition at line 336 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ create()

template<typename T >
static Array Aleph::Array< T >::create ( size_t  n)
inlinestatic

Create an array with n logical elements.

This static factory creates an array and then grows it with ret.putn(n). putn() delegates to MemArray::putn(), which only adjusts logical size (and backing storage if needed): it does NOT value-initialize new entries for any T.

All new elements are therefore uninitialized, and the caller MUST assign each position before reading it.

Parameters
[in]nNumber of elements to create.
Returns
Array with n logical elements (all uninitialized).
Exceptions
std::bad_allocif there is not enough memory.
Note
Complexity: O(n) for allocation; logical growth via putn() is O(1) here.
Exception safety: Strong guarantee.
Thread safety: Safe to call concurrently.
Example
auto arr = Array<int>::create(100);
// arr[0] is undefined (garbage)
arr[0] = 42; // Assign before read
static Array create(size_t n)
Create an array with n logical elements.
Definition tpl_array.H:191

Definition at line 191 of file tpl_array.H.

References FunctionalMethods< Array< T >, T >::maps().

Referenced by Aleph::Range_Fenwick_Tree< T >::Range_Fenwick_Tree(), Aleph::Range_Fenwick_Tree< T >::Range_Fenwick_Tree(), Aleph::Range_Fenwick_Tree< T >::build_from_diffs(), Aleph::Gen_Sparse_Table< T, Op >::build_log_table(), Aleph::dinic_blocking_flow(), TEST(), Aleph::Gen_Disjoint_Sparse_Table< T, Op >::values(), Aleph::Gen_Fenwick_Tree< T, Plus, Minus >::values(), Aleph::Range_Fenwick_Tree< T >::values(), and Aleph::Gen_Sparse_Table< T, Op >::values().

◆ empty()

template<typename T >
void Aleph::Array< T >::empty ( )
inlinenoexcept

Empty the stack.

Definition at line 327 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ get_first() [1/2]

template<typename T >
const T & Aleph::Array< T >::get_first ( ) const
inlinenoexcept

return a constant reference to the first element.

No bound_statics check is performed

Definition at line 344 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ get_first() [2/2]

template<typename T >
T & Aleph::Array< T >::get_first ( )
inlinenoexcept

return a modifiable reference to the first element.

No bound_statics check is performed

Definition at line 340 of file tpl_array.H.

References Aleph::Array< T >::array.

Referenced by TEST().

◆ get_last() [1/2]

template<typename T >
const T & Aleph::Array< T >::get_last ( ) const
inlinenoexcept

return a constant reference to the last element.

No bound_statics check is performed

Definition at line 352 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ get_last() [2/2]

template<typename T >
T & Aleph::Array< T >::get_last ( )
inlinenoexcept

return a modifiable reference to the last element.

No bound_statics check is performed

Definition at line 348 of file tpl_array.H.

References Aleph::Array< T >::array.

Referenced by TEST().

◆ insert() [1/2]

template<typename T >
T & Aleph::Array< T >::insert ( const T data)
inline

insert a copy of data at the beginning of the array.

All the items are moved

Parameters
[in]datato be pushed by copy
Returns
a modifiable reference to the copy of inserted data
Exceptions
bad_allocif there is no enough memory

Definition at line 274 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ insert() [2/2]

template<typename T >
T & Aleph::Array< T >::insert ( T &&  data)
inline

insert a copy of data at the beginning of the array.

All the items are moved

Parameters
[in]datato be pushed by moving
Returns
a modifiable reference to the moved inserted data
Exceptions
bad_allocif there is no enough memory

Definition at line 286 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ is_empty()

template<typename T >
constexpr bool Aleph::Array< T >::is_empty ( ) const
inlineconstexprnoexcept

Return true if stack is empty.

Definition at line 330 of file tpl_array.H.

References Aleph::Array< T >::array.

Referenced by Aleph::Array< T >::base(), and Aleph::Array< T >::base().

◆ is_valid()

template<typename T >
bool Aleph::Array< T >::is_valid ( ) const
inlinenoexcept

Definition at line 439 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ operator()() [1/2]

template<typename T >
constexpr const T & Aleph::Array< T >::operator() ( const size_t  i) const
inlineconstexprnoexcept

Return a constant reference to the ith element. It does not perform bound_statics checks.

Definition at line 379 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ operator()() [2/2]

template<typename T >
constexpr T & Aleph::Array< T >::operator() ( const size_t  i)
inlineconstexprnoexcept

Return a reference to the ith element. It does not perform bound_statics checks.

Definition at line 373 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ operator=() [1/2]

template<typename T >
Array & Aleph::Array< T >::operator= ( Array< T > &&  s)
inlinenoexcept

Assign by moving s to this

Definition at line 227 of file tpl_array.H.

References Aleph::Array< T >::array, and Aleph::Array< T >::swap().

◆ operator=() [2/2]

template<typename T >
Array & Aleph::Array< T >::operator= ( const Array< T > &  s)
inline

Assign by copy s to this

Definition at line 210 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ operator[]() [1/2]

template<typename T >
T & Aleph::Array< T >::operator[] ( size_t  i)
inline

Return a reference to the ith element.

Throws range_error if i is out of range

Definition at line 360 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ operator[]() [2/2]

template<typename T >
const T & Aleph::Array< T >::operator[] ( size_t  i) const
inline

Return a constant reference to the ith element.

Throws range_error if i is out of range

Definition at line 367 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ putn()

template<typename T >
void Aleph::Array< T >::putn ( const size_t  n)
inline

Reserve n additional logical slots in the array without value-initializing them.

The caller must assign to the new positions before reading them.

Parameters
[in]nnumber of cells to reserve
Exceptions
bad_allocif there is no enough memory

Definition at line 298 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ remove_first()

template<typename T >
T Aleph::Array< T >::remove_first ( )
inline

Definition at line 356 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ remove_last()

template<typename T >
T Aleph::Array< T >::remove_last ( )
inline

Definition at line 354 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ reserve()

template<typename T >
void Aleph::Array< T >::reserve ( size_t  cap)
inline

Reserves cap cells into the array.

Parameters
[in]capnew dimension
Exceptions
bad_allocif there is no enough memory

Definition at line 308 of file tpl_array.H.

References Aleph::Array< T >::array.

◆ rev() [1/2]

template<typename T >
Array & Aleph::Array< T >::rev ( )
inline

Definition at line 401 of file tpl_array.H.

References Aleph::Array< T >::reverse().

◆ rev() [2/2]

template<typename T >
Array Aleph::Array< T >::rev ( ) const
inline

Definition at line 403 of file tpl_array.H.

References Aleph::Array< T >::reverse().

◆ reverse() [1/2]

template<typename T >
Array & Aleph::Array< T >::reverse ( )
inline

Reverse the order of items in array.

Definition at line 385 of file tpl_array.H.

References Aleph::Array< T >::array, and Aleph::Array< T >::reverse().

Referenced by Aleph::Array< T >::rev(), Aleph::Array< T >::rev(), and Aleph::Array< T >::reverse().

◆ reverse() [2/2]

template<typename T >
Array Aleph::Array< T >::reverse ( ) const
inline

Return a copy of this with its items reversed.

Definition at line 392 of file tpl_array.H.

References Aleph::Array< T >::array, FunctionalMethods< Array< T >, T >::maps(), and Aleph::Array< T >::size().

◆ size()

◆ swap()

template<typename T >
void Aleph::Array< T >::swap ( Array< T > &  s)
inlinenoexcept

◆ traverse() [1/4]

template<typename T >
template<class Operation >
bool Aleph::Array< T >::traverse ( Operation &&  operation = Operation())
inline

◆ traverse() [2/4]

template<typename T >
template<class Operation >
bool Aleph::Array< T >::traverse ( Operation &&  operation = Operation()) const
inline

◆ traverse() [3/4]

template<typename T >
template<class Operation >
Aleph::Array< T >::traverse ( Operation operation)
inline

Traverse all the items of the stack from the youngest to the oldest and conditionally performs an operation.

Parameters
[in]operationto perform on the current element. If it returns true, then the traversal continues to the next item; otherwise the traversal stops

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 413 of file tpl_array.H.

References Aleph::Array< T >::array, and FunctionalMethods< Array< T >, T >::maps().

◆ traverse() [4/4]

template<typename T >
template<class Operation >
bool Aleph::Array< T >::traverse ( Operation operation) const
inline

Member Data Documentation

◆ array


The documentation for this class was generated from the following file: