|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
#include <tpl_dynArray.H>
Inherits LocateFunctions< DynArray< T >, T >, FunctionalMethods< DynArray< T >, T >, GenericItems< Container, T >, EqualSequenceMethod< DynArray< T > >, and StlAlephIterator< DynArray< T > >.
Inherited by Aleph::DynArray_Set< T, Equal >.
Classes | |
| class | Iterator |
| Iterator on the items of array. More... | |
| class | Proxy |
Public Types | |
| using | Item_Type = T |
| using | Key_Type = T |
| The type of element stored in the array. | |
| using | Const_Iterator = Aleph::Const_Iterator< Iterator > |
| Read-only iterator: the iterator of a constant array; it never allocates. | |
Public Types inherited from StlAlephIterator< DynArray< T > > | |
| using | iterator = StlIterator< DynArray< T > > |
| using | const_iterator = StlConstIterator< DynArray< T > > |
Public Member Functions | |
| size_t | get_dir_size () const noexcept |
| Return the directory size. | |
| size_t | get_seg_size () const noexcept |
| Return the segment size. | |
| size_t | get_block_size () const noexcept |
| Return the block size. | |
| size_t | size () const noexcept |
| Return the current dimension of array. | |
| size_t | max_size () const noexcept |
| Return the maximum allowed dimension (or the maximum number of elements that could have the array treated as a container). | |
| size_t | get_num_blocks () const noexcept |
| Return the number of blocks consumed by the array. | |
| void | set_default_initial_value (const T &value) noexcept(std::is_nothrow_copy_assignable_v< T >) |
| Set the default value. | |
| void | set_default_initial_value (T &&value=T()) noexcept(std::is_nothrow_swappable_v< T >) |
See set_default_initial_value(const T & value). | |
| DynArray (const size_t _pow_dir, const size_t _pow_seg, const size_t _pow_block) | |
| Construct a dynamic array given directory, segment and block sizes. | |
| DynArray () | |
| Construct an empty array with the default geometry. | |
| DynArray (const size_t dim) | |
| Construct an array of logical size dim without allocating entries. | |
| DynArray (const size_t n, const T &value) | |
| Construct an array of n copies of value; every entry is allocated. | |
| template<template< typename > class List> | |
| DynArray (const List< T > &l) | |
| template<class It > requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; }) | |
| DynArray (It b, It e) | |
| DynArray (std::initializer_list< T > l) | |
| ~DynArray () | |
| void | copy_array (const DynArray< T > &src_array) |
Copy the items of src_array to this | |
| DynArray (const DynArray< T > &array) | |
| Copy constructor: build an exact copy of array. | |
| DynArray< T > & | operator= (const DynArray< T > &array) |
Copy assignment: *this becomes an exact copy of array. | |
| void | swap (DynArray< T > &array) noexcept(std::is_nothrow_swappable_v< T >) |
Swap in constant time array with this | |
| DynArray (DynArray &&other) noexcept(std::is_nothrow_default_constructible_v< T > and std::is_nothrow_swappable_v< T >) | |
| Move constructor; allocates nothing. | |
| DynArray & | operator= (DynArray &&other) noexcept(std::is_nothrow_swappable_v< T >) |
Move assignment: swap the contents with other. | |
| T & | access (const size_t i) noexcept |
| Fast access without checking allocation and bound_min_clock checking. | |
| const T & | access (const size_t i) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const. | |
| T & | operator() (const size_t i) noexcept |
See access(const size_t i). | |
| const T & | operator() (const size_t i) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const. | |
| bool | exist (const size_t i) const |
Return true if the i-th entry is accessible. | |
| T * | test (const size_t i) const noexcept |
| Test if the i-th entry es writable,. | |
| T & | touch (const size_t i) |
| Touch the entry i. | |
| void | reserve (const size_t l, const size_t r) |
| Allocate a range of entries. | |
| void | reserve (const size_t dim) |
| Allocate the first dim entries and make size() at least dim. | |
| void | cut_ne (const size_t new_dim=0) |
| void | cut (const size_t new_dim=0) |
| Cut the array to a new dimension; that is, it reduces the dimension of array and frees the remaining memory. | |
| void | adjust (const size_t dim) |
| Set a new dimension. | |
| void | empty () noexcept |
| Empty the array. | |
| void | clear () noexcept |
| Empties the container. | |
| const T & | read (const size_t i) const |
| Read entry i without allocating memory. | |
| const T & | operator[] (const size_t i) const |
| Read entry i of a constant array; equivalent to read(i). | |
| Proxy | operator[] (const size_t i) |
| Access entry i of a modifiable array through a proxy. | |
| T & | nth (const size_t n) |
| Return a modifiable reference to entry n. | |
| const T & | nth (const size_t n) const |
| Return entry n of a constant array; equivalent to read(n). | |
| T & | nth_ne (const size_t n) |
| Return a modifiable reference to entry n without checking n. | |
| const T & | nth_ne (const size_t n) const noexcept |
| Return entry n of a constant array without checking n. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, T &> | |
| T * | find_ptr (Operation &operation) |
| Return a pointer to the first entry satisfying a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| const T * | find_ptr (Operation &operation) const |
| Constant overload of find_ptr(); it never allocates memory. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, T &> | |
| T * | find_ptr (Operation &&operation) |
See find_ptr(Operation & operation). | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| const T * | find_ptr (Operation &&operation) const |
See find_ptr(Operation & operation) const. | |
| T & | append () |
| Allocate a new entry to the end of array. | |
| T & | append (const T &data) |
Copy data to the end of array, increase the dimension and return a modifiable reference to the copied data. | |
| T & | append (T &&data) |
Move data to the end of array, increase the dimension and return a modifiable reference to the copied data. | |
| T & | insert (const T &item) |
Insert a copy of item at the beginning of the array. | |
| T & | insert (T &&item) |
Move item to the beginning of the array. | |
| void | push (const T &data) |
See append(const T & data). | |
| T & | push (T &&data) |
See append(T && data). | |
| void | put (const T &data) |
See append(const T & data). | |
| T & | put (T &&data) |
See append(T && data). | |
| void | remove (T &item) |
| Given a valid reference to an item in the array, it removes it and decrease the dimension. | |
| void | erase (T &item) |
See remove(T & item). | |
| bool | is_empty () const noexcept |
Return true if the array is empty. | |
| Array< T > | to_array () const |
| Copy contents into Aleph::Array (requires copyable elements). | |
| DynArray & | reverse () |
| Reverse the order of items in an array. | |
| T | pop () |
| Remove the last item of array (as if this was a stack) | |
| T & | top () |
| Return a modifiable reference to the last item of stack. | |
| const T & | top () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates. | |
| T & | get_first () |
| Return a modifiable reference to the first item of array (as if this was a queue) | |
| const T & | get_first () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates. | |
| T & | get_last () |
| Return a modifiable reference to the last item of array (as if this was a queue) | |
| const T & | get_last () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates. | |
| Iterator | get_it () |
| Iterator on the modifiable array, positioned on entry 0. | |
| Const_Iterator | get_it () const |
| Iterator on the constant array, positioned on entry 0. | |
| Iterator | get_it (const size_t pos) |
| Iterator on the modifiable array, positioned on entry pos. | |
| Const_Iterator | get_it (const size_t pos) const |
| Iterator on the constant array, positioned on entry pos. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation &operation) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >) |
| Traverse a constant array and execute a conditioned operation, which must have the signature: | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation &operation) |
Traverse a modifiable array; operation receives modifiable references, with the signature bool operation(T & item). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation &&operation) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >) |
See traverse(Operation & operation) const. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation &&operation) |
See traverse(Operation & operation). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &operation) const |
| Alias of for_each(); see FunctionalMethods::for_each(). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &&operation) const |
See each(Operation & operation) const. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
| Visit the entries at positions pos, pos + slice, ... of a constant array; see FunctionalMethods::each(). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| void | each (const size_t pos, const size_t slice, Operation &operation) |
| Visit, and possibly modify, the entries at positions pos, pos + slice, pos + 2 slice, ... of a modifiable array. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
Public Member Functions inherited from LocateFunctions< DynArray< T >, T > | |
| auto | get_it () |
| Return a properly initialized iterator positioned at the first item on the container. | |
| auto | get_it () const |
| Read-only iterator positioned at the first item. | |
| auto | get_it (const size_t pos) |
Return a properly initialized iterator positioned at the pos item on the container. | |
| auto | get_it (const size_t pos) const |
Read-only iterator positioned at the pos item. | |
| auto | get_itor () |
Alias of get_it(). | |
| auto | get_itor () const |
See get_itor(). | |
| T & | nth_ne (const size_t n) noexcept(Aleph::dry_detail::mutable_traversal_is_noexcept< C, T >) |
| Return the n‑th element without bounds checking. | |
| const T & | nth_ne (const size_t n) const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< DynArray< T >, T >) |
Constant overload of nth_ne(size_t). | |
| T & | nth (const size_t n) |
| Return the n-th item of the container. | |
| const T & | nth (const size_t n) const |
Const overload of nth(size_t). | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > T * | find_ptr (Operation &operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Find a pointer to an item in the container according to a searching criterion. | |
| const T * | find_ptr (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
Const overload of find_ptr(Operation&). | |
| const T * | find_ptr (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_ptr() const that accepts rvalues. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > T * | find_ptr (Operation &&operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Overload of find_ptr() that accepts rvalues. | |
| size_t | find_index (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Find the position of an item in the container according to a searching criterion. | |
| size_t | find_index (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_index() that accepts rvalues. | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > | find_item (Operation &operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Safe sequential searching of an item matching a criterion. | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > | find_item (Operation &&operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Overload of find_item() that accepts rvalues. | |
| and std::copy_constructible< T > std::optional< T > | find_opt (Operation &operation) const |
| Copy of the first item satisfying a criterion, if any. | |
| and std::copy_constructible< T > std::optional< T > | find_opt (Operation &&operation) const |
| Overload of find_opt() that accepts rvalues. | |
| bool | contains_if (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Test if an item satisfying a criterion is present in the container. | |
| bool | contains (const T &item) const |
| Test if an item is present in the container using equality. | |
Public Member Functions inherited from FunctionalMethods< DynArray< T >, T > | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it from the given args. | |
| void | emplace_end (Args &&... args) |
See emplace(Args && ... args). | |
| void | emplace_ins (Args &&... args) |
| size_t | ninsert (Args &&... args) |
| Insert n variadic items. | |
| size_t | nappend (Args &&... args) |
| Append n variadic items. | |
| void | for_each (Operation &operation) const |
| Traverse all the container and performs an operation on each element. | |
| void | for_each (Operation &&operation) const |
| Overload of for_each() that accepts rvalues. | |
| void | each (Operation &operation) const |
| Alias of for_each(). | |
| void | each (Operation &&operation) const |
| Alias of for_each() that accepts rvalues. | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing an operation on each visited element. | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &operation) |
Traverse the container starting at pos taking one item every slice, performing an operation that may modify each visited item. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | mutable_for_each (Operation &operation) |
| Apply a mutable operation to each element of the container. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | mutable_for_each (Operation &&operation) |
See mutable_for_each(Operation & operation). | |
| bool | all (Operation &operation) const |
| Check if all the elements of the container satisfy a condition. | |
| bool | all (Operation &&operation) const |
| Overload of all() that accepts rvalues. | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criterion. | |
| bool | exists (Operation &&op) const |
| Overload of exists() that accepts rvalues. | |
| bool | none (Operation &op) const |
| Test that no element satisfies a criterion. | |
| bool | none (Operation &&op) const |
| Overload of none() that accepts rvalues. | |
| size_t | count_if (Operation &op) const |
| Count the elements that satisfy a criterion. | |
| size_t | count_if (Operation &&op) const |
| Overload of count_if() that accepts rvalues. | |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &&op) const |
| auto | flat_map (Operation &op) const |
| Map each element to a container and concatenate the results. | |
| auto | flat_map (Operation &&op) const |
| Overload of flat_map() that accepts rvalues. | |
| Aleph::DynList< T > | to_dynlist () const |
| Convert container to DynList. | |
| std::vector< T > | to_vector () const |
| Convert container to std::vector. | |
| Acc | foldl (const Acc &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| Acc | foldl (const Acc &init, Op &&op) const |
| Overload of foldl() that accepts rvalues. | |
| Acc | fold_left (const Acc &init, Op &op) const |
| Alias for foldl(). | |
| Acc | fold_left (const Acc &init, Op &&op) const |
| Overload of fold_left() that accepts rvalues. | |
| T | 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. | |
| T | fold (const T &init, Operation &&operation) const |
| Overload of fold() that accepts rvalues. | |
| Acc | foldr (const Acc &init, Op &op) const |
| Fold the elements from the last to the first. | |
| Acc | foldr (const Acc &init, Op &&op) const |
| Overload of foldr() that accepts rvalues. | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &op) const |
| Fold the elements with no initial value. | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &&op) const |
| Overload of reduce() that accepts rvalues. | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion. | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
| Overload of filter() that accepts rvalues. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and return a pointer to the matched items in the container. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
| Overload of ptr_filter() that accepts rvalues. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and determine its positions respect to the traversal of container. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
| Overload of pfilter() that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
| Overload of partition() 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 criterion. | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
| Overload of tpartition() that accepts rvalues. | |
| size_t | length () const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< DynArray< T >, T >) |
| 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 the elements at positions i, i + step, i + 2 step, ... that are not greater than j, respect to the traversal order. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take_while (Operation &op) const |
| The longest prefix of elements that satisfy a criterion. | |
| Aleph::DynList< T > | take_while (Operation &&op) const |
| Overload of take_while() that accepts rvalues. | |
| Aleph::DynList< T > | drop_while (Operation &op) const |
| The elements after the longest prefix that satisfies a criterion. | |
| Aleph::DynList< T > | drop_while (Operation &&op) const |
| Overload of drop_while() that accepts rvalues. | |
| 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 |
See items(). | |
Public Member Functions inherited from EqualSequenceMethod< DynArray< T > > | |
| bool | equal_to (const DynArray< T > &r) const |
Equality test between this and r. | |
Public Member Functions inherited from StlAlephIterator< DynArray< 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 void | compute_sizes (const size_t n, size_t &d, size_t &s, size_t &b) |
Given a dimension n, it proposes values for the directory, segment and block sizes. | |
| static std::tuple< size_t, size_t, size_t > | compute_sizes (const size_t n) |
Given a dimension n, it proposes values for the directory, segment and block sizes. | |
Static Public Member Functions inherited from FunctionalMethods< DynArray< T >, T > | |
| static DynArray< T > | build (Items &&... items) |
| Build a container that holds the given items. | |
| static D | build_as (Items &&... items) |
Build a D, a class derived from the container, holding the given items. | |
Static Public Attributes | |
| static const size_t | Default_Pow_Dir = 6 |
| The type of element stored in the array. | |
| static const size_t | Default_Pow_Seg = 8 |
| Default two power for directory size. | |
| static const size_t | Default_Pow_Block = 12 |
| Default two power for segment size. | |
| static const unsigned long long | Max_Dim_Allowed = 256 * 1024 * 1024 * 1024ull |
| Maximum dimension allowed. | |
Private Member Functions | |
| size_t | index_in_dir (const size_t i) const noexcept |
| size_t | modulus_from_index_in_dir (const size_t i) const noexcept |
| size_t | index_in_seg (const size_t &i) const noexcept |
| size_t | index_in_block (const size_t i) const noexcept |
| void | fill_dir_to_null () noexcept |
| void | fill_seg_to_null (T **seg) noexcept |
| void | allocate_dir () |
| void | ensure_dir () |
| Allocate the directory if the array has none. | |
| void | resize_dir (const size_t i) |
| void | allocate_segment (T **&seg) |
| void | allocate_block (T *&block) |
| Allocate a block filled with the default value. | |
| void | release_segment (T **&seg) noexcept |
| void | release_block (T *&block) noexcept |
| void | release_blocks_and_segment (T **&seg) noexcept |
| void | ensure_not_empty (const char *context) const |
| void | release_all_segments_and_blocks () noexcept |
| void | release_dir () noexcept |
| size_t | divide_by_block_size (const size_t number) const noexcept |
| size_t | modulus_by_block_size (const size_t number) const noexcept |
| void | allocate_block (T *&block, T *src_block) |
| void | allocate_segment (T **&seg, T **src_seg) |
| template<class Operation > | |
| size_t | index_of_first (Operation &operation) const |
| template<class Operation > | |
| bool | const_traverse (Operation &operation) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >) |
| template<class Operation > | |
| bool | mutable_traverse (Operation &operation) |
Static Private Member Functions | |
| static size_t | two_raised (const size_t n) |
| Return 2^n. | |
| static size_t | compute_dim (size_t d, size_t s, size_t b) |
| Return the number of entries of a d/s/b geometry. | |
| static size_t | next2Pow (const size_t number) noexcept |
Private Attributes | |
| size_t | pow_dir = Default_Pow_Dir |
| size_t | pow_seg = Default_Pow_Seg |
| size_t | pow_block = std::min(Default_Pow_Block, Max_Pow_Block) |
| size_t | seg_plus_block_pow = pow_seg + pow_block |
| size_t | mask_seg_plus_block = two_raised(seg_plus_block_pow) - 1 |
| size_t | dir_size = two_raised(pow_dir) |
| size_t | seg_size = two_raised(pow_seg) |
| size_t | block_size = two_raised(pow_block) |
| unsigned long long | max_dim = two_raised(seg_plus_block_pow + pow_dir) |
| size_t | mask_seg = seg_size - 1 |
| size_t | mask_block = block_size - 1 |
| size_t | current_dim |
| size_t | num_segs = 0 |
| size_t | num_blocks = 0 |
| T *** | dir = nullptr |
| T | default_initial_value = T() |
| T * | default_initial_value_ptr = &default_initial_value |
Static Private Attributes | |
| static const size_t | Max_Bits_Allowed = 8 * sizeof(size_t) |
| Default two power for block size. | |
| static const size_t | Max_Pow_Block = (Max_Bits_Allowed - Default_Pow_Dir - Default_Pow_Seg - 1) |
Additional Inherited Members | |
Public Attributes inherited from FunctionalMethods< DynArray< T >, T > | |
| and | |
| Insert a new element into the container by constructing it from the given args. | |
| and Aleph::InvocableWith< Operation &, const T & > | and |
| Conditional mapping of the elements of the container. | |
This class implements a very versatile dynamic array which would represent a good trade-off between fast and constant access time and memory consumption. The array is lazy in the sense that the dimension grows dynamically and the required memory for a cell could be allocated at the first writing.
The data structure consists of three array types. A first array type is called block, and it is a contiguous chunk of block_size data entries. if an array occupies n entries then there are n/block_size + 1 blocks allocated. The blocks are indexed by segments of seg_size blocks which in turn are indexed by a directory of dir_size segment. For accessing to entry i the following calculations are done:
block_size. This gives the index in the segment.So, there are always four operations for each access what gives a constant access time.
In order to faster perform the calculations, the directory, segment and block size are adjusted to two powers. In this way, the division and modulus can be done with shifting and masking.
For lazy writing, that is to allocate the block just when it is certain that this will be used, the operator [] is used. A read of an entry whose block was never allocated, through read(i) or [] on a constant array, some such as:
std::cout << a.read(i) << endl;
returns the default initialization value without allocating anything. This value is the result of the default constructor call, unless set_default_initial_value() changed it. On a modifiable array, a[i] returns a proxy that cannot tell a read from a write, so using it as a value allocates the block (it then holds the default value). Traversals and iterators of a constant array never allocate; on a modifiable array they hand out modifiable references, so they allocate the blocks they visit. Use std::as_const(a) to traverse or iterate without allocating.
At the contrary, if the first time that a writing is done, some such as:
a[i] = value;
Then the block, and eventually the segment will be allocated. So is the directory, by the first write of the array: an array that was built and never written holds no memory, as one that was moved from.
Eventually the array could be fragmented and to consume memory some proportional to the writes done. Suppose for example that you only perform:
a[0] = value; a[100000000] = value;
In this case, the registered dimension of array will be 100000000, but only two blocks will be allocated. If you only performs reads between \((0, 100000000)\) with read(), on a constant array or by traversing a constant array (for instance std::as_const(a)), always it will be returned the default value and neither a segment nor a block will be allocated, since they have not been written. Traversing the modifiable array instead allocates every block it visits.
Access through [] operator perform bound_min_clock checks and it requires to test if the segment and/or block have been allocated and eventually to allocate them.
If you know (you are absolutely sure of) that the entry has already been written, and consequently it has already its block allocated, then you could use the operator () for direct access.
Access with () operator does not perform any check (bounds and blocks and segment existence). This way is faster but unsure.
() operator is an alias of access(i) method.
In order to assure that a range of entries is already allocated, you could use reserve(l, r) method, which test and eventually allocates the needed memory for the entries comprised in the range \([l,r]\).
From a functional perspective, an dynamic array could be treated as a list.
Initially, the array is empty.
A new item can be inserted with append(item. This method copy (or moves) the item to the next available entry (at the end). The dimension is increased in one unit.
You can also to treat the dynamic array as stack or queue.
The interface offer a default constructor which normally sets the sizes and serves for almost all situations.
However, sometimes is desirable to set oneself these parameter. The principal justification is given for situations where the memory is very limited.
Note that a memory manager could have enough memory dispersed through the total of available chunks, but it could not exist a contiguous block of a given size. The more large is the block size, the higher is the probability for failing to allocate. So, there are circumstances where you could be interested in setting a small block size, to facilitate the block's allocation.
Of course, these settings restrict the maximum dimension, which eventually could be composed with a larger directory. As example, consider a directory of 1024 segments of 512 blocks of 4096 entries. This gives a total of
\(1024 \times 512 \times 4096 = 2147483648\) entries.
Now suppose that you think that 4096 is too much for a block, then you could set the block to 128 and displace the difference to the directory. This gives sizes of 32768, 512 and 128 respectively and thus to obtain the same maximum capacity.
You could think that failure probability is displaced to the directory allocation, but the directory is allocated once at construction time.
Definition at line 215 of file tpl_dynArray.H.
| using Aleph::DynArray< T >::Const_Iterator = Aleph::Const_Iterator<Iterator> |
Read-only iterator: the iterator of a constant array; it never allocates.
Definition at line 2033 of file tpl_dynArray.H.
| using Aleph::DynArray< T >::Item_Type = T |
Definition at line 223 of file tpl_dynArray.H.
| using Aleph::DynArray< T >::Key_Type = T |
The type of element stored in the array.
Definition at line 224 of file tpl_dynArray.H.
|
inline |
Construct a dynamic array given directory, segment and block sizes.
It allocates no directory: the first write does. It builds the default value, an item built by default.
| [in] | _pow_dir | two power for directory size |
| [in] | _pow_seg | two power for segment size |
| [in] | _pow_block | two power for block size |
| length_error | if the given sizes exceed the maximum possible dimension |
| overflow_error | if it happens an arithmetic overflow with the bits operations |
| Any | exception from the default constructor of T, which builds the default value. |
Definition at line 800 of file tpl_dynArray.H.
References ah_length_error_if, Aleph::DynArray< T >::max_dim, and Aleph::DynArray< T >::Max_Dim_Allowed.
|
inline |
Construct an empty array with the default geometry.
It allocates no directory: the first write does. It builds the default value, an item built by default.
| Any | exception from the default constructor of T, which builds the default value. |
DynArray<T> a = {}; and omitted aggregate members still work. Definition at line 827 of file tpl_dynArray.H.
|
inlineexplicit |
Construct an array of logical size dim without allocating entries.
Segments and blocks are allocated lazily, on the first write that falls in them, and the directory, on the first write of the array: this constructor allocates none of them. The size of the directory covers the whole logical size from the start, so size() <= max_size(). Like std::vector<T>(dim), append() then writes at index dim. Entries that were never written have no storage; check them with exist() or test() before reading them with access().
The constructor is explicit: an integer never becomes a DynArray implicitly, so DynArray<T> a = n; and passing an integer where a DynArray is expected do not compile.
| [in] | dim | initial logical size; zero builds an empty array. |
| length_error | if dim is greater than Max_Dim_Allowed. |
| overflow_error | if it happens an arithmetic overflow with the bits operations |
| Any | exception from the default constructor of T, which builds the default value. |
Definition at line 852 of file tpl_dynArray.H.
References ah_length_error_if, Aleph::DynArray< T >::compute_dim(), dim(), Aleph::DynArray< T >::dir_size, Aleph::DynArray< T >::max_dim, Aleph::DynArray< T >::Max_Dim_Allowed, Aleph::DynArray< T >::pow_block, Aleph::DynArray< T >::pow_dir, Aleph::DynArray< T >::pow_seg, and Aleph::DynArray< T >::two_raised().
|
inline |
Construct an array of n copies of value; every entry is allocated.
| [in] | n | number of entries; size() is n. |
| [in] | value | value copied into each entry. |
| bad_alloc | if there is no enough memory. |
| length_error | if n is greater than Max_Dim_Allowed. |
| Any | exception from copy-assigning T; nothing is leaked. |
std::vector<T>(n, value). Definition at line 885 of file tpl_dynArray.H.
References Aleph::DynArray< T >::access(), Aleph::DynArray< T >::reserve(), and value.
|
inline |
Definition at line 895 of file tpl_dynArray.H.
|
inline |
Definition at line 895 of file tpl_dynArray.H.
|
inline |
Definition at line 895 of file tpl_dynArray.H.
|
inline |
Definition at line 897 of file tpl_dynArray.H.
References Aleph::DynArray< T >::release_dir().
|
inline |
Copy constructor: build an exact copy of array.
The copy has the geometry, logical size and default value of array and allocates exactly the blocks that array has allocated, so an entry that array never wrote is not written in the copy either.
| [in] | array | source of copy |
| bad_alloc | if there is no enough memory |
| Any | exception from copy-assigning T; nothing is leaked, since the delegated constructor has already completed. |
Definition at line 924 of file tpl_dynArray.H.
References Aleph::DynArray< T >::allocate_dir(), Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::dir, and Aleph::DynArray< T >::dir_size.
|
inlinenoexcept |
Move constructor; allocates nothing.
| [in,out] | other | source; it is left empty and reusable, without a directory, which its first write allocates again. |
| anything | that the default constructor of T or swapping two T throws. |
Definition at line 1007 of file tpl_dynArray.H.
References Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::default_initial_value_ptr, and Aleph::DynArray< T >::swap().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
Definition at line 1052 of file tpl_dynArray.H.
References Aleph::DynArray< T >::dir, Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), and Aleph::DynArray< T >::index_in_seg().
|
inlinenoexcept |
Fast access without checking allocation and bound_min_clock checking.
The purpose of this method is to access the i-th entry in the fastest possible way. For that, no checks are done.
| [in] | i | index of entry to be accessed |
Definition at line 1042 of file tpl_dynArray.H.
References Aleph::DynArray< T >::dir, Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), and Aleph::DynArray< T >::index_in_seg().
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::Floyd_All_Shortest_Paths(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::Loaded_Nodes::add(), Aleph::Compiler_Line_Frontend::analyze(), Aleph::analyze_dataflow_function(), Aleph::Compiler_Semantic_Analyzer::analyze_imports(), Aleph::Compiler_Typed_Semantic_Analyzer::analyze_stmt(), Aleph::Compiler_Module_Semantic_Environment_Detail::append_unique_name(), Aleph::Compiler_Type_Substitution::apply(), Aleph::Compiler_IR_Lowering::Module_Builder::bind(), Aleph::Interpreter_Runtime::call_hir_function(), Aleph::Compiler_Typed_Semantic_Analyzer::collect_binding_free_type_variables(), Aleph::Compiler_Typed_Semantic_Analyzer::collect_environment_free_type_variables(), Aleph::compiler_dump_bytecode_globals(), Aleph::compiler_dump_cfg_function(), Aleph::compiler_dump_dataflow_analysis(), Aleph::compiler_dump_ir_function(), Aleph::compiler_dump_ssa_function(), Aleph::compiler_link_module_surfaces(), Aleph::compiler_render_module_order(), Aleph::compiler_resolve_module_order(), Aleph::Compute_Cut_Nodes< GT, SA >::compute_blocks(), Aleph::Compiler_SSA_Detail::compute_dominance_info(), Aleph::Compiler_Dataflow_Detail::compute_predecessor_lists(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Detail::compute_reachable_blocks(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::connect(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::connect(), Random_Network_Flow< Net >::connect_ranks(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::DynArray< T >::copy_array(), Aleph::DynArray_Set< T, Equal >::count(), Random_Network_Flow< Net >::create_ranks(), Aleph::eliminate_dead_code(), Aleph::Compiler_C_Backend::Emitter::emit_instruction(), Aleph::Compiler_C_Backend::Emitter::emit_terminator(), Aleph::Compiler_Driver::execute_files(), Aleph::Compiler_Generic_Driver::execute_files(), Aleph::Compiler_Bytecode_VM::execute_host_call(), Aleph::Compiler_Driver::find_artifact(), Aleph::Compiler_Line_Frontend::find_artifact(), Aleph::Compiler_IR_Lowering::Module_Builder::find_function_id(), Aleph::Compiler_Driver::find_source_index(), Aleph::Compiler_Line_Frontend::find_source_index(), Aleph::Compiler_MVP_Frontend::find_source_index(), Aleph::Compiler_Line_Frontend::flatten_program_in_import_order(), Aleph::Compiler_Dataflow_Detail::format_slot_constants(), Aleph::Compiler_C_Backend::Emitter::function_descriptor_symbol(), Aleph::Compiler_C_Backend::Emitter::function_symbol(), Aleph::Compiler_Typed_Semantic_Analyzer::instantiate_type(), Aleph::Compiler_Bytecode_Detail::intern_constant(), Aleph::interpreter_values_equal(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_any_odd_nodes(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join_any_unbalanced_nodes(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), Aleph::kosaraju_connected_components(), Aleph::Compiler_Line_Frontend::load_sources(), Aleph::Compiler_MVP_Frontend::load_sources(), Aleph::Compiler_IR_Lowering::Module_Builder::lookup(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr(), Aleph::Compiler_Bytecode_Lowering::lower_function(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_function_body(), Aleph::Compiler_SSA_Lowering::lower_function_internal(), Aleph::Compiler_Line_Frontend::lower_hir(), Aleph::Compiler_Line_Frontend::lower_ir(), Aleph::Compiler_CFG_Lowering::lower_statement_sequence(), Aleph::Compiler_CFG_Lowering::lower_stmt(), main(), main(), Aleph::Compiler_Bytecode_VM::make_validation_error(), Aleph::Compiler_Dataflow_Detail::mark_value_used(), Aleph::Compiler_Driver::merge_modules_from_order(), Aleph::Compiler_MVP_Frontend::merge_modules_from_order(), Aleph::Compiler_SSA_Detail::normalize_ir_function(), Aleph::DynArray< T >::operator()(), Aleph::DynArray< T >::operator()(), Aleph::Matrix_Graph< GT, SA >::operator()(), Aleph::Matrix_Graph< GT, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Compiler_Line_Frontend::parse(), Aleph::Compiler_MVP_Frontend::parse(), Aleph::Compiler_Line_Frontend::parse_function_line(), Aleph::Compiler_Line_Frontend::parse_import_line(), Aleph::Compiler_Line_Frontend::parse_let_line(), Aleph::Compiler_Driver::parse_registered_sources(), Aleph::Compiler_SSA_Detail::predecessor_index(), Aleph::Compiler_Typed_Semantic_Analyzer::predeclare_function(), Aleph::Compiler_IR_Lowering::Module_Builder::preload_global_bindings(), Aleph::Compiler_Driver::prepare_inputs(), Aleph::Compiler_Bytecode_VM::push_frame(), Aleph::Compiler_Bytecode_VM::read_callee_and_arguments(), Aleph::matgraph_detail::read_matrix(), Aleph::Compiler_Driver::record_ast_artifacts(), Aleph::Compiler_MVP_Frontend::record_ast_artifacts(), Aleph::DynArray_Set< T, Equal >::remove_all(), Aleph::Compiler_SSA_Detail::rename_recursive(), Aleph::Compiler_Driver_Detail::render_messages(), Aleph::Compiler_Ast_Context::reset(), Aleph::Compiler_Driver::resolve_import_order(), Aleph::Compiler_Typed_Semantic_Analyzer::resolve_module_type_declaration(), Aleph::Compiler_Module_Resolver_Detail::resolve_visit(), Aleph::DynArray_Set< T, Equal >::search(), Aleph::Compiler_Dataflow_Bit_Set::set(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Compiler_Dataflow_Bit_Set::test(), TEST(), TEST(), TEST(), Aleph::validate_cfg_function(), Aleph::validate_dataflow_analysis(), Aleph::validate_dead_code_elimination(), Aleph::validate_ir_function(), Aleph::validate_ssa_function(), Aleph::Compiler_Dataflow_Detail::value_constant(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
inline |
Set a new dimension.
If dimension is greater than the current, then more memory is allocated; otherwise the remaining memory is freed. In both cases, the current dimension is adjusted.
| [in] | dim | new dimension value |
| bad_alloc | if there is no enough memory. |
| length_error | if dim is greater than Max_Dim_Allowed; the array is then as it was. |
Definition at line 1417 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::cut(), dim(), and Aleph::DynArray< T >::reserve().
Referenced by TEST().
|
inlineprivate |
Allocate a block filled with the default value.
The array takes the block, and counts it, once it is whole: if a copy of the default value throws, the block is released, and the array is as it was.
| [out] | block | where the block goes: an entry of a segment, or the pointer of a caller that then writes that entry. |
| bad_alloc | if there is no memory for the block. |
| Any | exception from copy-assigning T; nothing is leaked. |
Definition at line 457 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::default_initial_value_ptr, StlAlephIterator< DynArray< T > >::end(), and Aleph::DynArray< T >::num_blocks.
Referenced by Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::Proxy::operator->(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::reserve(), and Aleph::DynArray< T >::touch().
|
inlineprivate |
Definition at line 546 of file tpl_dynArray.H.
References Aleph::DynArray< T >::allocate_block(), and Aleph::DynArray< T >::block_size.
|
inlineprivate |
Definition at line 381 of file tpl_dynArray.H.
References ah_bad_alloc_unless, Aleph::DynArray< T >::dir, Aleph::DynArray< T >::dir_size, and Aleph::DynArray< T >::fill_dir_to_null().
Referenced by Aleph::DynArray< T >::DynArray(), and Aleph::DynArray< T >::ensure_dir().
|
inlineprivate |
Definition at line 434 of file tpl_dynArray.H.
References Aleph::DynArray< T >::fill_seg_to_null(), Aleph::DynArray< T >::num_segs, and Aleph::DynArray< T >::seg_size.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::Proxy::operator->(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::reserve(), and Aleph::DynArray< T >::touch().
|
inlineprivate |
Definition at line 553 of file tpl_dynArray.H.
References Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::allocate_segment(), and Aleph::DynArray< T >::seg_size.
|
inline |
Allocate a new entry to the end of array.
Increase the dimension and return a modifiable reference to the last entry
Definition at line 1639 of file tpl_dynArray.H.
References Aleph::DynArray< T >::size(), and Aleph::DynArray< T >::touch().
Referenced by Aleph::Two_Sat< GT >::add_at_most_one(), Aleph::analyze_dataflow_function(), Aleph::Compiler_Typed_Semantic_Analyzer::analyze_expr(), Aleph::Compiler_Semantic_Analyzer::analyze_imports(), Aleph::Compiler_Typed_Semantic_Analyzer::analyze_stmt(), Aleph::DynArray< T >::append(), Aleph::DynArray< T >::append(), Aleph::Compiler_Driver_Detail::append_artifact(), Aleph::Compiler_Driver::append_error(), Aleph::Compiler_Generic_Driver::append_error(), Aleph::Compiler_Line_Frontend::append_error(), Aleph::Compiler_MVP_Frontend::append_error(), Aleph::Compiler_Generic_Driver::append_run_failure_if_needed(), Aleph::Compiler_Module_Semantic_Environment_Detail::append_unique_name(), Aleph::Compiler_Typed_Semantic_Analyzer::append_unique_type_id(), Aleph::Compiler_Driver::append_warning(), Aleph::Compiler_Type_Substitution::apply(), Aleph::array_to_DynArray(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), Aleph::Compiler_Typed_Semantic_Analyzer::collect_environment_free_type_variables(), Aleph::Compiler_Generic_Driver::collect_frontend_state(), Aleph::compiler_link_module_surfaces(), Aleph::compiler_resolve_module_order(), Aleph::Compiler_SSA_Detail::compute_dominance_info(), Aleph::Source_Manager::compute_line_starts(), Aleph::Compiler_Dataflow_Detail::compute_predecessor_lists(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Detail::compute_reachable_blocks(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::connect(), demo_calculator(), demo_city_coordinates(), demo_convex_hull_cities(), demo_convex_hull_performance(), demo_department_codes(), demo_dynarray(), demo_encoding_decoding(), demo_hash_dispatcher(), demo_regions_menu(), demo_text_processor(), demo_variadic_dispatcher(), demo_vector_dynarray(), Aleph::deque_to_DynArray(), Aleph::dyndlist_to_DynArray(), Aleph::dynlist_to_DynArray(), Aleph::eliminate_dead_code(), Aleph::Compiler_C_Backend::emit_module(), Aleph::Compiler_Typed_Semantic_Analyzer::enter_scope(), Aleph::Compiler_IR_Lowering::Module_Builder::enter_scope(), Aleph::Interpreter_Runtime::evaluate_expr(), Aleph::Compiler_Driver::execute_files(), Aleph::Compiler_Generic_Driver::execute_files(), Aleph::Compiler_Bytecode_VM::execute_host_call(), Aleph::Compiler_Driver::execute_source(), Aleph::Compiler_Generic_Driver::execute_source(), Aleph::Compiler_C_Backend::Emitter::fail(), DataGenerator::few_unique(), Aleph::Diagnostic_Builder::help(), Aleph::init_to_DynArray(), Aleph::Compiler_C_Backend::Emitter::initialize_symbols(), Aleph::DynArray< T >::insert(), Aleph::DynArray_Set< T, Equal >::insert(), Aleph::DynArray< T >::insert(), Aleph::DynArray_Set< T, Equal >::insert(), Aleph::Compiler_Typed_Semantic_Analyzer::instantiate_type(), Aleph::Compiler_Bytecode_Detail::intern_constant(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_any_odd_nodes(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join_any_unbalanced_nodes(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), Aleph::Compiler_Type_Context::list_to_array(), LLVMFuzzerTestOneInput(), Aleph::Compiler_Line_Frontend::load_sources(), Aleph::Compiler_MVP_Frontend::load_sources(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr(), Aleph::Compiler_Bytecode_Lowering::lower_function(), Aleph::Compiler_SSA_Lowering::lower_function_internal(), Aleph::Compiler_Line_Frontend::lower_ir(), Aleph::Compiler_CFG_Lowering::lower_stmt(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_stmt(), main(), main(), Aleph::Compiler_Ast_Context::make(), Aleph::Compiler_Dataflow_Detail::make_constant_vector(), make_dynarray(), Aleph::Compiler_Driver_Detail::merge_report(), Aleph::Compiler_SSA_Detail::normalize_ir_function(), Aleph::Diagnostic_Builder::note(), Aleph::Compiler_MVP_Frontend::parse(), Aleph::Compiler_Driver::parse_registered_sources(), populate_dynarray(), Aleph::Compiler_Typed_Semantic_Analyzer::predeclare_function(), Aleph::Compiler_IR_Lowering::Module_Builder::predeclare_function(), Aleph::Compiler_Driver::prepare_inputs(), Aleph::DynArray< T >::push(), Aleph::DynArray< T >::push(), Aleph::DynArray< T >::put(), Aleph::DynArray< T >::put(), DataGenerator::random(), Aleph::Compiler_Bytecode_VM::read_callee_and_arguments(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph(), Aleph::Compiler_Driver::record_import_order_artifact(), Aleph::Compiler_SSA_Detail::rename_recursive(), Aleph::Compiler_Bytecode_Interpreter_Detail::reset_values(), Aleph::Compiler_Dataflow_Bit_Set::resize(), Aleph::Compiler_Driver::resolve_import_order(), Aleph::Compiler_Line_Frontend::resolve_import_order(), Aleph::Compiler_MVP_Frontend::resolve_import_order(), Aleph::Compiler_Typed_Semantic_Analyzer::resolve_module_type_declaration(), Aleph::Compiler_Typed_Semantic_Analyzer::resolve_type_annotation(), Aleph::Compiler_Module_Resolver_Detail::resolve_visit(), DataGenerator::sawtooth(), Aleph::Compiler_Typed_Semantic_Analyzer::seed_function_annotation_type_variables(), Aleph::set_to_DynArray(), Aleph::sethash_to_DynArray(), Aleph::settree_to_DynArray(), DataGenerator::sorted_asc(), DataGenerator::sorted_desc(), Aleph::Compiler_Line_Frontend::split_tokens(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), test_DynSetLinHash(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::to_DynArray(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::validate_bytecode_function(), Aleph::validate_bytecode_module(), Aleph::validate_cfg_function(), Aleph::validate_cfg_module(), Aleph::validate_dataflow_analysis(), Aleph::validate_dead_code_elimination(), Aleph::validate_ir_function(), Aleph::validate_ir_module(), Aleph::validate_ssa_function(), Aleph::validate_ssa_module(), Aleph::vector_to_DynArray(), Aleph::vector_to_DynArray(), and Aleph::Compiler_C_Backend::Emitter::warn().
|
inline |
Copy data to the end of array, increase the dimension and return a modifiable reference to the copied data.
Definition at line 1646 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append().
|
inline |
Move data to the end of array, increase the dimension and return a modifiable reference to the copied data.
Definition at line 1655 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append().
|
inlinenoexcept |
Empties the container.
| none |
Definition at line 1437 of file tpl_dynArray.H.
References Aleph::DynArray< T >::empty().
Referenced by Aleph::Compiler_Driver::clear(), Aleph::Compiler_Generic_Driver::clear(), Aleph::Compiler_Typed_Semantic_Analyzer::clear(), Aleph::Compiler_Line_Frontend::clear(), Aleph::Compiler_MVP_Frontend::clear(), Aleph::Compiler_SSA_Detail::normalize_ir_function(), Aleph::Compiler_Line_Frontend::parse(), Aleph::Compiler_Driver::parse_registered_sources(), Aleph::Compiler_Bytecode_VM::read_callee_and_arguments(), Aleph::Compiler_Ast_Context::reset(), Aleph::Compiler_Bytecode_Interpreter_Detail::reset_values(), Aleph::Compiler_Dataflow_Bit_Set::resize(), Aleph::Compiler_Driver::resolve_import_order(), Aleph::Compiler_Line_Frontend::resolve_import_order(), and Aleph::Compiler_MVP_Frontend::resolve_import_order().
|
inlinestaticprivate |
Return the number of entries of a d/s/b geometry.
| [in] | d | Power of two of the directory size. |
| [in] | s | Power of two of the segment size. |
| [in] | b | Power of two of the block size. |
| std::overflow_error | if a power does not fit in a size_t. |
Definition at line 270 of file tpl_dynArray.H.
References Aleph::DynArray< T >::two_raised().
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::compute_sizes(), and Aleph::DynArray< T >::resize_dir().
|
inlinestatic |
Given a dimension n, it proposes values for the directory, segment and block sizes.
| [in] | n | proposed dimension |
| overflow_error | if n is greater than 2^63 |
Definition at line 315 of file tpl_dynArray.H.
References Aleph::DynArray< T >::compute_sizes().
|
inlinestatic |
Given a dimension n, it proposes values for the directory, segment and block sizes.
| [in] | n | proposed dimension |
| [out] | d | power of two of the directory size |
| [out] | s | power of two of the segment size |
| [out] | b | power of two of the block size |
| overflow_error | if n is greater than 2^63, so that no geometry of size_t entries can hold it |
Definition at line 286 of file tpl_dynArray.H.
References Aleph::DynArray< T >::compute_dim(), Aleph::DynArray< T >::Default_Pow_Block, Aleph::DynArray< T >::Default_Pow_Dir, and Aleph::DynArray< T >::Default_Pow_Seg.
Referenced by Aleph::DynArray< T >::compute_sizes(), and Aleph::DynMatrix< T >::set_dimension().
|
inlineprivatenoexcept |
Definition at line 2082 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::count(), Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::index_in_block(), k, and test().
Referenced by Aleph::DynArray< T >::index_of_first(), and Aleph::DynArray< T >::traverse().
|
inline |
Copy the items of src_array to this
| [in] | src_array | source array |
Definition at line 906 of file tpl_dynArray.H.
References Aleph::DynArray< T >::access(), Aleph::DynArray< T >::current_dim, and Aleph::DynArray< T >::exist().
|
inline |
Cut the array to a new dimension; that is, it reduces the dimension of array and frees the remaining memory.
| [in] | new_dim | new dimension value |
| domain_error | if new_dim is greater than current dim |
Definition at line 1394 of file tpl_dynArray.H.
References ah_length_error_if, Aleph::DynArray< T >::current_dim, and Aleph::DynArray< T >::cut_ne().
Referenced by Aleph::DynArray< T >::adjust(), Pointer_Table::allocate_above_heap(), build_tree(), Pointer_Table::cleanup_free_table(), Pointer_Table::clear(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Map_Matrix_Graph< GT, SA >::copy_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes(), Aleph::DynArray< T >::empty(), file_to_dynarrays(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), LLVMFuzzerTestOneInput(), Aleph::DynArray< T >::pop(), and Pointer_Table::remove_pointer().
|
inline |
Definition at line 1320 of file tpl_dynArray.H.
References FunctionalMethods< DynArray< T >, T >::and, Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::dir, StlAlephIterator< DynArray< T > >::end(), Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), k, Aleph::DynArray< T >::release_all_segments_and_blocks(), Aleph::DynArray< T >::release_block(), Aleph::DynArray< T >::release_segment(), Aleph::DynArray< T >::seg_size, and test().
Referenced by Aleph::DynArray< T >::cut(), and Aleph::DynArray< T >::remove().
|
inlineprivatenoexcept |
Definition at line 532 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, and Aleph::DynArray< T >::pow_block.
|
inline |
See each(size_t pos, size_t slice, Operation & operation).
Definition at line 2262 of file tpl_dynArray.H.
|
inline |
See each(size_t pos, size_t slice, Operation & operation) const.
Definition at line 2226 of file tpl_dynArray.H.
References Aleph::DynArray< T >::each().
|
inline |
Visit, and possibly modify, the entries at positions pos, pos + slice, pos + 2 slice, ... of a modifiable array.
Unlike the generic FunctionalMethods::each(pos, slice, op), whose modifiable traversal would allocate every block of the array, only the blocks of the visited entries are allocated, as a[i] does.
| [in] | pos | position of the first visited entry. |
| [in] | slice | distance between two consecutive visited entries; nothing is visited if it is zero. |
| [in] | operation | operation with signature void(T &). |
| bad_alloc | if the block of a visited entry cannot be allocated, and anything that operation throws. |
Definition at line 2247 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, and Aleph::DynArray< T >::touch().
|
inline |
Visit the entries at positions pos, pos + slice, ... of a constant array; see FunctionalMethods::each().
It never allocates memory.
| [in] | pos | position of the first visited entry. |
| [in] | slice | distance between two consecutive visited entries. |
| [in] | operation | operation with signature void(const T &). |
| anything | that operation throws. |
Definition at line 2218 of file tpl_dynArray.H.
References Aleph::DynArray< T >::each().
|
inline |
See each(Operation & operation) const.
Definition at line 2203 of file tpl_dynArray.H.
References FunctionalMethods< DynArray< T >, T >::for_each().
|
inline |
Alias of for_each(); see FunctionalMethods::for_each().
| [in] | operation | operation with signature void(const T &). |
| anything | that operation throws. |
Definition at line 2195 of file tpl_dynArray.H.
References FunctionalMethods< DynArray< T >, T >::for_each().
Referenced by Aleph::DynArray< T >::each(), and Aleph::DynArray< T >::each().
|
inlinenoexcept |
Empty the array.
All the occupied memory is freed and the dimension is to set to zero
Definition at line 1427 of file tpl_dynArray.H.
References Aleph::DynArray< T >::cut().
Referenced by Aleph::DynArray< T >::clear(), DataGenerator::few_unique(), DataGenerator::random(), DataGenerator::sawtooth(), Fixed_Relation::set_n(), DataGenerator::sorted_asc(), and DataGenerator::sorted_desc().
|
inlineprivate |
Allocate the directory if the array has none.
An array that was built and has not written yet has no directory, so that building it allocates nothing; nor has one that was moved from, so that moving needs no allocation and stays noexcept. Every writer calls this before indexing the directory; readers treat a missing directory as an array without segments.
| bad_alloc | if the directory cannot be allocated. |
Definition at line 399 of file tpl_dynArray.H.
References Aleph::DynArray< T >::allocate_dir(), and Aleph::DynArray< T >::dir.
Referenced by Aleph::DynArray< T >::operator[](), Aleph::DynArray< T >::reserve(), Aleph::DynArray< T >::resize_dir(), and Aleph::DynArray< T >::touch().
|
inlineprivate |
Definition at line 499 of file tpl_dynArray.H.
References ah_underflow_error_if, and Aleph::DynArray< T >::is_empty().
Referenced by Aleph::DynArray< T >::get_first(), Aleph::DynArray< T >::get_first(), Aleph::DynArray< T >::get_last(), Aleph::DynArray< T >::get_last(), Aleph::DynArray< T >::pop(), Aleph::DynArray< T >::remove(), Aleph::DynArray< T >::top(), and Aleph::DynArray< T >::top().
|
inline |
See remove(T & item).
Definition at line 1737 of file tpl_dynArray.H.
References Aleph::DynArray< T >::remove().
|
inline |
Return true if the i-th entry is accessible.
By accessible is understood that either the entry has been previously written or the block than would contain it is already allocated,
| [in] | i | index to test |
Definition at line 1080 of file tpl_dynArray.H.
References Aleph::DynArray< T >::dir, Aleph::DynArray< T >::dir_size, Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), Aleph::DynArray< T >::max_dim, and Aleph::DynArray< T >::seg_size.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::DynArray< T >::copy_array(), Aleph::Matrix_Graph< GT, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::matgraph_detail::read_matrix(), Aleph::sequential_search(), TEST(), and TEST_F().
|
inlineprivatenoexcept |
Definition at line 365 of file tpl_dynArray.H.
References Aleph::DynArray< T >::dir, and Aleph::DynArray< T >::dir_size.
Referenced by Aleph::DynArray< T >::allocate_dir().
|
inlineprivatenoexcept |
Definition at line 373 of file tpl_dynArray.H.
References Aleph::DynArray< T >::seg_size.
Referenced by Aleph::DynArray< T >::allocate_segment().
|
inline |
See find_ptr(Operation & operation).
Definition at line 1624 of file tpl_dynArray.H.
|
inline |
See find_ptr(Operation & operation) const.
Definition at line 1632 of file tpl_dynArray.H.
|
inline |
Return a pointer to the first entry satisfying a criterion.
Hides LocateFunctions::find_ptr(), whose modifiable traversal would allocate every block it visits. The search reads the entries without allocating; only if an entry never written matches is its block allocated, as a[i] does, so that the pointer refers to the entry. A criterion that only accepts T & is evaluated through the modifiable traversal instead, which allocates the blocks it visits.
| [in] | operation | criterion with signature bool(const T &); it may also be a pointer to member. |
nullptr if no entry satisfies it. | bad_alloc | if the block of the found entry cannot be allocated, and anything that operation throws. |
Definition at line 1596 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::find_ptr(), Aleph::DynArray< T >::index_of_first(), and Aleph::DynArray< T >::touch().
Referenced by Aleph::DynArray< T >::find_ptr().
|
inline |
Constant overload of find_ptr(); it never allocates memory.
| [in] | operation | criterion with signature bool(const T &). |
nullptr if no entry satisfies it. | anything | that operation throws. |
Definition at line 1615 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::index_of_first(), and Aleph::DynArray< T >::read().
|
inlinenoexcept |
Return the block size.
Definition at line 725 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size.
|
inlinenoexcept |
Return the directory size.
Definition at line 713 of file tpl_dynArray.H.
References Aleph::DynArray< T >::dir_size.
|
inline |
Return a modifiable reference to the first item of array (as if this was a queue)
Definition at line 1800 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_not_empty(), and Aleph::DynArray< T >::touch().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates.
Definition at line 1808 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_not_empty(), and Aleph::DynArray< T >::read().
|
inline |
Iterator on the modifiable array, positioned on entry 0.
Definition at line 2038 of file tpl_dynArray.H.
Referenced by Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), main(), and TEST().
|
inline |
Iterator on the constant array, positioned on entry 0.
Definition at line 2046 of file tpl_dynArray.H.
|
inline |
Iterator on the modifiable array, positioned on entry pos.
| [in] | pos | position of the iterator. |
| out_of_range | if pos >= size(). |
Definition at line 2056 of file tpl_dynArray.H.
References ah_out_of_range_error_if, Aleph::DynArray< T >::Iterator::set_pos(), and Aleph::DynArray< T >::size().
|
inline |
Iterator on the constant array, positioned on entry pos.
| [in] | pos | position of the iterator. |
| out_of_range | if pos >= size(). |
Definition at line 2069 of file tpl_dynArray.H.
References ah_out_of_range_error_if, Aleph::Const_Iterator< It >::set_pos(), and Aleph::DynArray< T >::size().
|
inline |
Return a modifiable reference to the last item of array (as if this was a queue)
Definition at line 1816 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_not_empty(), Aleph::DynArray< T >::size(), and Aleph::DynArray< T >::touch().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates.
Definition at line 1824 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_not_empty(), Aleph::DynArray< T >::read(), and Aleph::DynArray< T >::size().
|
inlinenoexcept |
Return the number of blocks consumed by the array.
Definition at line 748 of file tpl_dynArray.H.
References Aleph::DynArray< T >::num_blocks.
|
inlinenoexcept |
Return the segment size.
Definition at line 719 of file tpl_dynArray.H.
References Aleph::DynArray< T >::seg_size.
|
inlineprivatenoexcept |
Definition at line 351 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::mask_block, Aleph::DynArray< T >::modulus_from_index_in_dir(), and Aleph::DynArray< T >::seg_size.
Referenced by Aleph::DynArray< T >::access(), Aleph::DynArray< T >::access(), Aleph::DynArray< T >::const_traverse(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::mutable_traverse(), Aleph::DynArray< T >::test(), and Aleph::DynArray< T >::touch().
|
inlineprivatenoexcept |
Definition at line 326 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::pow_block, Aleph::DynArray< T >::pow_seg, Aleph::DynArray< T >::seg_plus_block_pow, Aleph::DynArray< T >::seg_size, and Aleph::DynArray< T >::two_raised().
Referenced by Aleph::DynArray< T >::access(), Aleph::DynArray< T >::access(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::exist(), Aleph::DynArray< T >::reserve(), Aleph::DynArray< T >::test(), and Aleph::DynArray< T >::touch().
|
inlineprivatenoexcept |
Definition at line 343 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::modulus_from_index_in_dir(), Aleph::DynArray< T >::pow_block, Aleph::DynArray< T >::seg_size, and Aleph::DynArray< T >::two_raised().
Referenced by Aleph::DynArray< T >::access(), Aleph::DynArray< T >::access(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::exist(), Aleph::DynArray< T >::reserve(), Aleph::DynArray< T >::test(), and Aleph::DynArray< T >::touch().
|
inlineprivate |
Definition at line 1563 of file tpl_dynArray.H.
References Aleph::DynArray< T >::const_traverse().
Referenced by Aleph::DynArray< T >::find_ptr(), and Aleph::DynArray< T >::find_ptr().
|
inline |
Insert a copy of item at the beginning of the array.
| [in] | item | Value to insert; it may be an entry of this array, as in a.insert(a.access(1)). |
| std::bad_alloc,std::length_error | if the array has already Max_Dim_Allowed entries, or an exception from T. |
Definition at line 1671 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append(), Aleph::open_gap(), and Aleph::DynArray< T >::touch().
Referenced by Aleph::to_set().
|
inline |
Move item to the beginning of the array.
| [in] | item | Value to insert; it may be an entry of this array, which is then left moved from. |
| std::bad_alloc,std::length_error | if the array has already Max_Dim_Allowed entries, or an exception from T. |
item is untouched if the allocation throws. Definition at line 1690 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append(), Aleph::DynArray< T >::current_dim, Aleph::open_gap(), and Aleph::DynArray< T >::touch().
|
inlinenoexcept |
Return true if the array is empty.
Definition at line 1743 of file tpl_dynArray.H.
References Aleph::DynArray< T >::size().
Referenced by Aleph::Compiler_IR_Lowering::Module_Builder::bind(), Aleph::compiler_dump_cfg_function(), Aleph::compiler_dump_ir_function(), Aleph::compiler_dump_ssa_function(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Detail::compute_reachable_blocks(), Aleph::Compiler_C_Backend::Emitter::emit_instruction(), Aleph::DynArray< T >::ensure_not_empty(), Aleph::Compiler_Driver::execute_files(), Aleph::Compiler_Dataflow_Detail::format_slot_constants(), Aleph::Compiler_IR_Lowering::Module_Builder::leave_scope(), Aleph::Compiler_Line_Frontend::load_sources(), Aleph::Compiler_MVP_Frontend::load_sources(), Aleph::Compiler_Bytecode_Lowering::lower_function(), Aleph::Compiler_SSA_Lowering::lower_function_internal(), Aleph::Compiler_Line_Frontend::lower_ir(), Aleph::Compiler_CFG_Lowering::lower_stmt(), Aleph::Compiler_Bytecode_VM::make_validation_error(), Aleph::Compiler_Driver::ok(), Aleph::Compiler_Generic_Driver::ok(), Aleph::Compiler_MVP_Frontend::parse(), Aleph::Compiler_Driver::parse_registered_sources(), Aleph::Compiler_Driver::prepare_inputs(), Aleph::Compiler_Bytecode_VM::read_callee_and_arguments(), Aleph::Compiler_Driver_Detail::render_messages(), Aleph::Compiler_Line_Frontend::resolve_import_order(), TEST(), TYPED_TEST(), Aleph::validate_cfg_function(), and Aleph::validate_ir_function().
|
inlinenoexcept |
Return the maximum allowed dimension (or the maximum number of elements that could have the array treated as a container).
Be careful with the fact that this bound_min_clock is not related to available memory
Definition at line 742 of file tpl_dynArray.H.
References Aleph::DynArray< T >::max_dim.
|
inlineprivatenoexcept |
Definition at line 539 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, and Aleph::DynArray< T >::mask_block.
|
inlineprivatenoexcept |
Definition at line 335 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::mask_seg_plus_block, and Aleph::DynArray< T >::seg_size.
Referenced by Aleph::DynArray< T >::index_in_block(), and Aleph::DynArray< T >::index_in_seg().
|
inlineprivate |
Definition at line 2109 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::count(), Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::index_in_block(), k, and Aleph::DynArray< T >::touch().
Referenced by Aleph::DynArray< T >::traverse().
|
inlinestaticprivatenoexcept |
Definition at line 527 of file tpl_dynArray.H.
|
inline |
Return a modifiable reference to entry n.
Hides LocateFunctions::nth(), whose traversal would keep the address of the short-lived copy handed out for an entry never written. As a[i] does, this modifiable access allocates the entry's block; the constant overload and read() do not.
| [in] | n | index of the entry. |
| out_of_range | if n >= size(). |
| bad_alloc | if the block of entry n cannot be allocated. |
Definition at line 1514 of file tpl_dynArray.H.
References ah_out_of_range_error_if, Aleph::DynArray< T >::current_dim, and Aleph::DynArray< T >::touch().
|
inline |
Return entry n of a constant array; equivalent to read(n).
| [in] | n | index of the entry. |
| out_of_range | if n >= size(). |
Definition at line 1528 of file tpl_dynArray.H.
References Aleph::DynArray< T >::read().
|
inline |
Return a modifiable reference to entry n without checking n.
| [in] | n | index of the entry; it must be smaller than size(). |
| bad_alloc | if the block of entry n cannot be allocated. |
Definition at line 1538 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, and Aleph::DynArray< T >::touch().
|
inlinenoexcept |
Return entry n of a constant array without checking n.
| [in] | n | index of the entry; it must be smaller than size(). |
Definition at line 1550 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::default_initial_value, and test().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
Definition at line 1068 of file tpl_dynArray.H.
References Aleph::DynArray< T >::access().
|
inlinenoexcept |
Definition at line 1061 of file tpl_dynArray.H.
References Aleph::DynArray< T >::access().
|
inline |
Copy assignment: *this becomes an exact copy of array.
| [in] | array | source of copy |
*this | bad_alloc | if there is no enough memory |
*this is unchanged if copying throws. The default value is copied, and entries that array never wrote are not left with the previous contents of *this. Definition at line 950 of file tpl_dynArray.H.
References Aleph::copy(), and Aleph::DynArray< T >::swap().
|
inlinenoexcept |
Move assignment: swap the contents with other.
| [in,out] | other | source; it receives the previous contents. |
*this. | anything | that swapping two T throws. |
Definition at line 1025 of file tpl_dynArray.H.
References Aleph::DynArray< T >::swap().
|
inline |
Access entry i of a modifiable array through a proxy.
Assigning to the proxy writes the entry and extends size() to i + 1 if needed. Converting it to T &, as in a[i] += 1 or int x = a[i], allocates the entry's block, since a read cannot be told apart from a write; read() reads without allocating.
| [in] | i | index of the entry; it may be greater than size(). |
| bad_alloc | if the directory cannot be grown. |
| length_error | if i is not less than Max_Dim_Allowed; the array is then as it was. |
Definition at line 1490 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_dir(), Aleph::DynArray< T >::max_dim, and Aleph::DynArray< T >::resize_dir().
|
inline |
Read entry i of a constant array; equivalent to read(i).
| [in] | i | index of the entry, smaller than size(). |
| out_of_range | if i >= size(). |
const T &, not a proxy, so writing through a constant array does not compile. Definition at line 1472 of file tpl_dynArray.H.
References Aleph::DynArray< T >::read().
|
inline |
Remove the last item of array (as if this was a stack)
Definition at line 1772 of file tpl_dynArray.H.
References Aleph::DynArray< T >::cut(), Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::ensure_not_empty(), Aleph::DynArray< T >::size(), and test().
Referenced by Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Detail::compute_reachable_blocks(), Aleph::Compiler_Typed_Semantic_Analyzer::leave_scope(), Aleph::Compiler_IR_Lowering::Module_Builder::leave_scope(), LLVMFuzzerTestOneInput(), Aleph::Compiler_SSA_Lowering::lower_function_internal(), Aleph::Compiler_CFG_Lowering::lower_stmt(), Aleph::validate_cfg_function(), and Aleph::validate_ir_function().
|
inline |
See append(const T & data).
Definition at line 1701 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append().
|
inline |
See append(T && data).
Definition at line 1707 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append().
|
inline |
See append(const T & data).
Definition at line 1713 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append().
|
inline |
See append(T && data).
Definition at line 1719 of file tpl_dynArray.H.
References Aleph::DynArray< T >::append().
|
inline |
Read entry i without allocating memory.
Neither the directory, nor a segment, nor a block is allocated: an entry whose block was never allocated reads as the default value (see set_default_initial_value()). Every other entry that was never written holds the default value too, since new blocks are filled with it.
| [in] | i | index of the entry, smaller than size(). |
| out_of_range | if i >= size(). |
Definition at line 1454 of file tpl_dynArray.H.
References ah_out_of_range_error_if, Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::default_initial_value, and test().
Referenced by Aleph::DynArray< T >::find_ptr(), Aleph::DynArray< T >::get_first(), Aleph::DynArray< T >::get_last(), Aleph::DynArray< T >::nth(), Aleph::DynArray< T >::operator[](), TEST(), TEST(), and Aleph::DynArray< T >::top().
|
inlineprivatenoexcept |
Definition at line 504 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::dir, Aleph::DynArray< T >::dir_size, and Aleph::DynArray< T >::release_blocks_and_segment().
Referenced by Aleph::DynArray< T >::cut_ne(), and Aleph::DynArray< T >::release_dir().
|
inlineprivatenoexcept |
Definition at line 479 of file tpl_dynArray.H.
References Aleph::DynArray< T >::num_blocks.
Referenced by Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::release_blocks_and_segment(), and Aleph::DynArray< T >::reserve().
|
inlineprivatenoexcept |
Definition at line 488 of file tpl_dynArray.H.
References Aleph::DynArray< T >::release_block(), Aleph::DynArray< T >::release_segment(), and Aleph::DynArray< T >::seg_size.
Referenced by Aleph::DynArray< T >::release_all_segments_and_blocks().
|
inlineprivatenoexcept |
Definition at line 514 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::dir, and Aleph::DynArray< T >::release_all_segments_and_blocks().
Referenced by Aleph::DynArray< T >::~DynArray().
|
inlineprivatenoexcept |
Definition at line 470 of file tpl_dynArray.H.
References Aleph::DynArray< T >::num_segs.
Referenced by Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::Proxy::operator->(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::release_blocks_and_segment(), Aleph::DynArray< T >::reserve(), and Aleph::DynArray< T >::touch().
|
inline |
Given a valid reference to an item in the array, it removes it and decrease the dimension.
| [in] | item | valid reference to the item to remove |
Definition at line 1729 of file tpl_dynArray.H.
References Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::ensure_not_empty(), Aleph::DynArray< T >::size(), and Aleph::DynArray< T >::touch().
Referenced by Aleph::DynArray< T >::erase(), main(), Aleph::DynArray_Set< T, Equal >::remove_all(), Aleph::DynArray_Set< T, Equal >::remove_one(), and TEST().
|
inline |
Allocate the first dim entries and make size() at least dim.
After the call, every entry in [0, dim) can be accessed with access() or operator()(), which do not check allocation. Entries that were never written hold the default value.
| [in] | dim | number of entries to allocate. |
| bad_alloc | if there is no enough memory. |
| length_error | if dim is greater than Max_Dim_Allowed; the array is then as it was. |
std::vector::reserve() and Array::reserve(), this does not just reserve capacity: size() becomes dim if it was smaller. Do not follow it with append(), which writes after those dim entries; write them with a(i) = ... or a[i] = .... To fill a DynArray with append() there is nothing to reserve: each block is allocated when needed. Definition at line 1314 of file tpl_dynArray.H.
References dim(), and Aleph::DynArray< T >::reserve().
|
inline |
Allocate a range of entries.
reserve(l, r) assures that all the entries comprised between l and r are allocated. After a successful call, any entry between l and r can be surely accessed with access(), and size() is at least r + 1 (see the warning of reserve(size_t)).
| [in] | l | lower index |
| [in] | r | upper index |
| bad_alloc | if there is no enough memory. If allocating a segment or a block fails, the segments and blocks previously allocated by this call are released before the exception propagates. |
| domain_error | if l is greater than r |
| length_error | if r is not less than Max_Dim_Allowed; the array is then as it was. |
Definition at line 1202 of file tpl_dynArray.H.
References ah_domain_error_if, Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::allocate_segment(), FunctionalMethods< DynArray< T >, T >::and, Aleph::Array< T >::append(), Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::dir, Aleph::DynArray< T >::ensure_dir(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), k, l, Aleph::DynArray< T >::max_dim, r, Aleph::DynArray< T >::release_block(), Aleph::DynArray< T >::release_segment(), Aleph::Array< T >::reserve(), Aleph::DynArray< T >::resize_dir(), Aleph::DynArray< T >::seg_size, and Aleph::Array< T >::size().
Referenced by Aleph::DynArray< T >::DynArray(), Fixed_Relation::Fixed_Relation(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::Floyd_All_Shortest_Paths(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::Loaded_Nodes::Loaded_Nodes(), Aleph::DynArray< T >::adjust(), DynArraySortTest::build_array(), check(), Aleph::Compute_Cut_Nodes< GT, SA >::compute_blocks(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::connect(), create_graph(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::extract_min_spanning_tree(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), LLVMFuzzerTestOneInput(), main(), Aleph::DynArray< T >::reserve(), Fixed_Relation::set_n(), Aleph::settree_to_vector(), DynArraySortTest::SetUp(), HashStats< HashTbl >::stats(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), Relation::verify_if_add_new_points(), Aleph::Prefix_Tree_Map< T >::words(), and Aleph::Cnode::words().
|
inlineprivate |
Definition at line 405 of file tpl_dynArray.H.
References ah_bad_alloc_unless, ah_length_error_if, Aleph::DynArray< T >::compute_dim(), Aleph::DynArray< T >::dir, Aleph::DynArray< T >::dir_size, Aleph::DynArray< T >::ensure_dir(), k, Aleph::DynArray< T >::max_dim, Aleph::DynArray< T >::Max_Dim_Allowed, Aleph::DynArray< T >::pow_block, Aleph::DynArray< T >::pow_dir, Aleph::DynArray< T >::pow_seg, and Aleph::DynArray< T >::two_raised().
Referenced by Aleph::DynArray< T >::operator[](), Aleph::DynArray< T >::reserve(), and Aleph::DynArray< T >::touch().
|
inline |
Reverse the order of items in an array.
Definition at line 1760 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim, and Aleph::DynArray< T >::touch().
Referenced by LLVMFuzzerTestOneInput().
|
inlinenoexcept |
Set the default value.
The default value of a dynamic array is the value to be returned when entries not still written are accessed.
| [in] | value | default value |
| anything | that the copy assignment of T throws. |
Definition at line 765 of file tpl_dynArray.H.
References Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::default_initial_value_ptr, and value.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::copy(), and TEST().
|
inlinenoexcept |
See set_default_initial_value(const T & value).
| anything | that swapping two T throws. |
Definition at line 775 of file tpl_dynArray.H.
References Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::default_initial_value_ptr, and value.
|
inlinenoexcept |
Return the current dimension of array.
According to usage style, this could represent the number of items stored in the array seen as a container
Definition at line 733 of file tpl_dynArray.H.
References Aleph::DynArray< T >::current_dim.
Referenced by OhashCommon< HashTbl, Key >::Stats::Stats(), Pointer_Table::allocate_above_heap(), Aleph::Compiler_Line_Frontend::analyze(), Aleph::analyze_dataflow_function(), Aleph::Compiler_Semantic_Analyzer::analyze_imports(), Aleph::Compiler_Typed_Semantic_Analyzer::analyze_stmt(), Aleph::DynArray< T >::append(), Aleph::Compiler_Module_Semantic_Environment_Detail::append_unique_name(), assign_arcs(), assign_distance(), assign_parrectangle(), assign_rectangle(), assign_scratch(), assign_shadow(), assign_tag(), assign_triangle(), assign_without_arc(), assign_without_node(), assign_xoffset(), assign_yoffset(), Aleph::Compiler_IR_Lowering::Module_Builder::bind(), Aleph::bubble_sort(), build_tree(), Aleph::Interpreter_Runtime::call_hir_function(), Pointer_Table::cleanup_free_table(), Aleph::Compiler_Typed_Semantic_Analyzer::collect_binding_free_type_variables(), Aleph::compiler_dump_bytecode_globals(), Aleph::compiler_dump_cfg_function(), Aleph::compiler_dump_dataflow_analysis(), Aleph::compiler_dump_ir_function(), Aleph::compiler_dump_ssa_function(), Aleph::compiler_link_module_surfaces(), Aleph::compiler_render_module_metadata(), Aleph::compiler_render_module_order(), Aleph::compiler_resolve_module_order(), Aleph::Compiler_SSA_Detail::compute_dominance_info(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Detail::compute_reachable_blocks(), Random_Network_Flow< Net >::connect_ranks(), Aleph::DynArray_Set< T, Equal >::count(), demo_city_coordinates(), demo_convex_hull_cities(), demo_convex_hull_performance(), demo_department_codes(), demo_dynarray(), demo_encoding_decoding(), demo_hash_dispatcher(), demo_performance(), demo_prefix_search(), demo_regions_menu(), demo_text_processor(), demo_variadic_dispatcher(), Aleph::dynarray_to_Array(), Aleph::dynarray_to_DynDlist(), Aleph::dynarray_to_DynList(), Aleph::DynArray_to_vector(), Aleph::eliminate_dead_code(), Aleph::Compiler_C_Backend::Emitter::emit_instruction(), Aleph::DynArray< T >::Iterator::end(), Aleph::Compiler_Driver::execute_files(), Aleph::Compiler_Generic_Driver::execute_files(), Aleph::Compiler_Bytecode_VM::execute_host_call(), file_to_dynarrays(), Aleph::Compiler_Driver::find_artifact(), Aleph::Compiler_Line_Frontend::find_artifact(), Aleph::Compiler_IR_Lowering::Module_Builder::find_function_id(), Aleph::Compiler_Driver::find_source_index(), Aleph::Compiler_Line_Frontend::find_source_index(), Aleph::Compiler_MVP_Frontend::find_source_index(), Aleph::Compiler_Line_Frontend::flatten_program_in_import_order(), Aleph::Compiler_Dataflow_Detail::format_slot_constants(), Pointer_Table::frees(), generate_split_lines(), Aleph::DynArray< T >::Iterator::get_curr(), Aleph::DynArray< T >::get_it(), Aleph::DynArray< T >::get_it(), Aleph::DynArray< T >::get_last(), Aleph::DynArray< T >::get_last(), Aleph::DynArray< T >::Iterator::has_curr(), Aleph::heapsort(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::index_node(), Pointer_Table::insert_in_free_table(), Aleph::Compiler_Typed_Semantic_Analyzer::instantiate_type(), Aleph::Compiler_Bytecode_Detail::intern_constant(), Aleph::interpreter_values_equal(), Aleph::introsort(), Pointer_Table::invariant(), Aleph::DynArray< T >::is_empty(), Moved_From_Case< Floyd_All_Shortest_Paths< Dgraph > >::is_empty(), Aleph::DynArray< T >::Iterator::is_last(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_any_odd_nodes(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join_any_unbalanced_nodes(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), Aleph::Compiler_Typed_Semantic_Analyzer::leave_scope(), LLVMFuzzerTestOneInput(), load_key_option(), Aleph::Compiler_Line_Frontend::load_sources(), Aleph::Compiler_MVP_Frontend::load_sources(), Aleph::Compiler_IR_Lowering::Module_Builder::lookup(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr(), Aleph::Compiler_Bytecode_Lowering::lower_function(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_function_body(), Aleph::Compiler_Line_Frontend::lower_hir(), Aleph::Compiler_Line_Frontend::lower_ir(), Aleph::Compiler_CFG_Lowering::lower_statement_sequence(), Aleph::Compiler_CFG_Lowering::lower_stmt(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_stmt(), main(), main(), Aleph::Compiler_Dataflow_Detail::mark_value_used(), Aleph::Compiler_Driver::merge_modules_from_order(), Aleph::Compiler_MVP_Frontend::merge_modules_from_order(), Aleph::DynArray< T >::Iterator::next(), Aleph::Compiler_SSA_Detail::normalize_ir_function(), Aleph::Compiler_Line_Frontend::parse(), Aleph::Compiler_MVP_Frontend::parse(), Aleph::Compiler_Line_Frontend::parse_function_line(), Aleph::Compiler_Line_Frontend::parse_import_line(), Aleph::Compiler_Line_Frontend::parse_let_line(), Aleph::Compiler_Driver::parse_registered_sources(), Aleph::DynArray< T >::pop(), Aleph::Compiler_SSA_Detail::predecessor_index(), Aleph::Compiler_Typed_Semantic_Analyzer::predeclare_function(), Aleph::Compiler_IR_Lowering::Module_Builder::preload_global_bindings(), Aleph::Compiler_Driver::prepare_inputs(), print_dynarray(), OhashCommon< HashTbl, Key >::print_stats(), HashStats< HashTbl >::print_stats(), Aleph::Compiler_Bytecode_VM::push_frame(), Aleph::quicksort(), Aleph::random_select(), Aleph::Compiler_Bytecode_VM::read_callee_and_arguments(), reassign_key(), Aleph::Compiler_Driver::record_ast_artifacts(), Aleph::Compiler_Driver::record_import_order_artifact(), Aleph::Compiler_Typed_Semantic_Analyzer::remember_function_annotation_type_variables(), Aleph::DynArray< T >::remove(), Aleph::DynArray_Set< T, Equal >::remove_all(), Pointer_Table::remove_pointer(), Aleph::Compiler_Driver_Detail::render_messages(), Aleph::Compiler_Ast_Context::reset(), Aleph::DynArray< T >::Iterator::reset_last(), Aleph::Compiler_Driver::resolve_import_order(), Aleph::DynArray_Set< T, Equal >::search(), Aleph::selection_sort(), Aleph::Compiler_Dataflow_Bit_Set::set(), Aleph::Compiler_Type_Context::set_struct_fields(), Aleph::shellsort(), Aleph::Compiler_Dataflow_Bit_Set::size(), Pointer_Table::size(), Dynamic_Event_Table< Signature >::size(), HashStats< HashTbl >::stats(), Aleph::ODhashTable< Key, Cmp >::stats(), Aleph::OLhashTable< Key, Cmp >::stats(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Compiler_Dataflow_Bit_Set::test(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), test_DynSetLinHash(), TEST_F(), Aleph::DynArray< T >::to_array(), to_array(), to_dyndlist(), to_dynlist(), Aleph::DynArray< T >::top(), Aleph::DynArray< T >::top(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Moved_From_Case< Floyd_All_Shortest_Paths< Dgraph > >::use(), Aleph::validate_cfg_function(), Aleph::validate_dataflow_analysis(), Aleph::validate_ir_function(), Aleph::validate_ssa_function(), Aleph::Compiler_Dataflow_Detail::value_constant(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
inlinenoexcept |
Swap in constant time array with this
| [in] | array | to swap |
| anything | that swapping the default values of T throws. When that swap may throw, it goes first, so that, if it throws, nothing else is exchanged, and both arrays are left as they were if it left its arguments as they were. |
Definition at line 970 of file tpl_dynArray.H.
References Aleph::DynArray< T >::block_size, Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::default_initial_value, Aleph::DynArray< T >::default_initial_value_ptr, Aleph::DynArray< T >::dir, Aleph::DynArray< T >::dir_size, Aleph::DynArray< T >::mask_block, Aleph::DynArray< T >::mask_seg, Aleph::DynArray< T >::mask_seg_plus_block, Aleph::DynArray< T >::max_dim, Aleph::DynArray< T >::num_blocks, Aleph::DynArray< T >::num_segs, Aleph::DynArray< T >::pow_block, Aleph::DynArray< T >::pow_dir, Aleph::DynArray< T >::pow_seg, Aleph::DynArray< T >::seg_plus_block_pow, Aleph::DynArray< T >::seg_size, and Aleph::DynArray< T >::swap().
Referenced by Aleph::DynArray< T >::DynArray(), main(), Aleph::DynArray< T >::operator=(), Aleph::DynArray< T >::operator=(), Aleph::DynArray< T >::swap(), and Pointer_Table::swap().
|
inlinenoexcept |
Test if the i-th entry es writable,.
test(i) inspects if the entry i is already allocated. If affirmative, then a pointer to the entry in the array is returned. Otherwise, nullptr is returned.
| [in] | i | index to test. |
nullptr if the entry is not allocated; a valid pointer inside the array otherwise Definition at line 1112 of file tpl_dynArray.H.
References Aleph::DynArray< T >::dir, Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), and Aleph::DynArray< T >::max_dim.
Referenced by Aleph::DynArray< T >::Iterator::get_curr_ne().
|
inline |
Copy contents into Aleph::Array (requires copyable elements).
Definition at line 1749 of file tpl_dynArray.H.
References Aleph::Array< T >::append(), Aleph::Array< T >::reserve(), and Aleph::DynArray< T >::size().
Referenced by Aleph::Two_Sat< GT >::add_at_most_one().
|
inline |
Return a modifiable reference to the last item of stack.
Definition at line 1784 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_not_empty(), Aleph::DynArray< T >::size(), and Aleph::DynArray< T >::touch().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates.
Definition at line 1792 of file tpl_dynArray.H.
References Aleph::DynArray< T >::ensure_not_empty(), Aleph::DynArray< T >::read(), and Aleph::DynArray< T >::size().
|
inline |
Touch the entry i.
touch(i) testes if the block that would contain to i is already allocated. If this is not the case, then the block, and eventually the segment, is allocated. If everything is ok, the method returns a valid pointer to the entry inside the array.
touch(i) is a concise and effective way to test and eventually to allocate memory for a new entry.
| [in] | i | index to touch |
| bad_alloc | if there is no enough memory |
| length_error | if i is not less than Max_Dim_Allowed; the array is then as it was. |
Definition at line 1145 of file tpl_dynArray.H.
References Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::current_dim, Aleph::DynArray< T >::dir, Aleph::DynArray< T >::ensure_dir(), Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), Aleph::DynArray< T >::max_dim, Aleph::DynArray< T >::release_segment(), and Aleph::DynArray< T >::resize_dir().
Referenced by Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::Loaded_Nodes::add(), Aleph::DynArray< T >::append(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::DynArray< T >::each(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::extract_min_spanning_tree(), Aleph::DynArray< T >::find_ptr(), Aleph::DynArray< T >::Iterator::get_curr_ne(), Aleph::DynArray< T >::get_first(), Aleph::DynArray< T >::get_last(), Aleph::DynArray< T >::insert(), Aleph::DynArray< T >::insert(), main(), Aleph::DynArray< T >::mutable_traverse(), Aleph::DynArray< T >::nth(), Aleph::DynArray< T >::nth_ne(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_list_graph(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_list_graph(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_matrix(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_matrix(), Aleph::Matrix_Graph< GT, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::DynArray< T >::remove(), Aleph::DynArray< T >::reverse(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), Aleph::DynArray< T >::top(), and HashStats< HashTbl >::update_stat_len().
|
inline |
See traverse(Operation & operation).
Definition at line 2180 of file tpl_dynArray.H.
|
inlinenoexcept |
See traverse(Operation & operation) const.
Definition at line 2171 of file tpl_dynArray.H.
|
inline |
Traverse a modifiable array; operation receives modifiable references, with the signature bool operation(T & item).
| [in] | operation |
true if all items are traversed; false otherwise | bad_alloc | if the block of an entry never written cannot be allocated, and anything that operation throws. |
operation writes stays in the array. To read without allocating, traverse a constant reference, as std::as_const(a).traverse(op). Definition at line 2163 of file tpl_dynArray.H.
References Aleph::DynArray< T >::mutable_traverse().
|
inlinenoexcept |
Traverse a constant array and execute a conditioned operation, which must have the signature:
If
returns false then the traversal is stopped; otherwise the traverse move to the next item.
| [in] | operation |
true if all items are traversed; false otherwise | anything | that operation throws. |
Definition at line 2143 of file tpl_dynArray.H.
References Aleph::DynArray< T >::const_traverse().
Referenced by TEST().
|
inlinestaticprivate |
Return 2^n.
| [in] | n | Exponent. |
n. | std::overflow_error | if 2^n does not fit in a size_t. |
Definition at line 257 of file tpl_dynArray.H.
References ah_overflow_error_if, and Aleph::DynArray< T >::Max_Bits_Allowed.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::compute_dim(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), and Aleph::DynArray< T >::resize_dir().
|
mutableprivate |
Definition at line 247 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::const_traverse(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::divide_by_block_size(), Aleph::DynArray< T >::get_block_size(), Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), Aleph::DynArray< T >::modulus_by_block_size(), Aleph::DynArray< T >::modulus_from_index_in_dir(), Aleph::DynArray< T >::mutable_traverse(), and Aleph::DynArray< T >::swap().
|
private |
Definition at line 360 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::adjust(), Aleph::DynArray< T >::const_traverse(), Aleph::DynArray< T >::copy_array(), Aleph::DynArray< T >::cut(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::each(), Aleph::DynArray< T >::find_ptr(), Aleph::DynArray< T >::find_ptr(), Aleph::DynArray< T >::insert(), Aleph::DynArray< T >::mutable_traverse(), Aleph::DynArray< T >::nth(), Aleph::DynArray< T >::nth_ne(), Aleph::DynArray< T >::nth_ne(), Aleph::DynArray< T >::Proxy::operator->(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::read(), Aleph::DynArray< T >::release_all_segments_and_blocks(), Aleph::DynArray< T >::release_dir(), Aleph::DynArray< T >::reserve(), Aleph::DynArray< T >::reverse(), Aleph::DynArray< T >::size(), Aleph::DynArray< T >::swap(), and Aleph::DynArray< T >::touch().
|
private |
Definition at line 443 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::const_traverse(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::Iterator::get_curr_ne(), Aleph::DynArray< T >::nth_ne(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::pop(), Aleph::DynArray< T >::read(), Aleph::DynArray< T >::set_default_initial_value(), Aleph::DynArray< T >::set_default_initial_value(), and Aleph::DynArray< T >::swap().
|
private |
Definition at line 444 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::set_default_initial_value(), Aleph::DynArray< T >::set_default_initial_value(), and Aleph::DynArray< T >::swap().
|
static |
Default two power for segment size.
Definition at line 228 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::compute_sizes().
|
static |
The type of element stored in the array.
Definition at line 226 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::compute_sizes().
|
static |
Default two power for directory size.
Definition at line 227 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::compute_sizes().
|
private |
Definition at line 363 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::access(), Aleph::DynArray< T >::access(), Aleph::DynArray< T >::allocate_dir(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::ensure_dir(), Aleph::DynArray< T >::exist(), Aleph::DynArray< T >::fill_dir_to_null(), Aleph::DynArray< T >::Proxy::operator->(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::Proxy::operator=(), Aleph::DynArray< T >::release_all_segments_and_blocks(), Aleph::DynArray< T >::release_dir(), Aleph::DynArray< T >::reserve(), Aleph::DynArray< T >::resize_dir(), Aleph::DynArray< T >::swap(), Aleph::DynArray< T >::test(), and Aleph::DynArray< T >::touch().
|
mutableprivate |
Definition at line 245 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::allocate_dir(), Aleph::DynArray< T >::exist(), Aleph::DynArray< T >::fill_dir_to_null(), Aleph::DynArray< T >::get_dir_size(), Aleph::DynArray< T >::release_all_segments_and_blocks(), Aleph::DynArray< T >::resize_dir(), and Aleph::DynArray< T >::swap().
|
private |
Definition at line 324 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::modulus_by_block_size(), and Aleph::DynArray< T >::swap().
|
private |
Definition at line 323 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::swap().
|
mutableprivate |
Definition at line 244 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::modulus_from_index_in_dir(), and Aleph::DynArray< T >::swap().
|
staticprivate |
Default two power for block size.
Definition at line 231 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::two_raised().
|
private |
Definition at line 250 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::exist(), Aleph::DynArray< T >::max_size(), Aleph::DynArray< T >::operator[](), Aleph::DynArray< T >::reserve(), Aleph::DynArray< T >::resize_dir(), Aleph::DynArray< T >::swap(), Aleph::DynArray< T >::test(), and Aleph::DynArray< T >::touch().
|
static |
Maximum dimension allowed.
Definition at line 235 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::DynArray(), and Aleph::DynArray< T >::resize_dir().
|
staticprivate |
Definition at line 238 of file tpl_dynArray.H.
|
private |
Definition at line 362 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::allocate_block(), Aleph::DynArray< T >::get_num_blocks(), Aleph::DynArray< T >::release_block(), and Aleph::DynArray< T >::swap().
|
private |
Definition at line 361 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::release_segment(), and Aleph::DynArray< T >::swap().
|
mutableprivate |
Definition at line 242 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::divide_by_block_size(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), Aleph::DynArray< T >::resize_dir(), and Aleph::DynArray< T >::swap().
|
mutableprivate |
Definition at line 240 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::resize_dir(), and Aleph::DynArray< T >::swap().
|
mutableprivate |
Definition at line 241 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::DynArray(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::resize_dir(), and Aleph::DynArray< T >::swap().
|
mutableprivate |
Definition at line 243 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::index_in_dir(), and Aleph::DynArray< T >::swap().
|
mutableprivate |
Definition at line 246 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::allocate_segment(), Aleph::DynArray< T >::cut_ne(), Aleph::DynArray< T >::exist(), Aleph::DynArray< T >::fill_seg_to_null(), Aleph::DynArray< T >::get_seg_size(), Aleph::DynArray< T >::index_in_block(), Aleph::DynArray< T >::index_in_dir(), Aleph::DynArray< T >::index_in_seg(), Aleph::DynArray< T >::modulus_from_index_in_dir(), Aleph::DynArray< T >::release_blocks_and_segment(), Aleph::DynArray< T >::reserve(), and Aleph::DynArray< T >::swap().