|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Contiguous dynamic array with N elements of inline storage.
More...
#include <tpl_small_vector.H>
Public Types | |
| using | Item_Type = T |
| Aleph convention: element type. | |
| using | value_type = T |
| STL convention: value type. | |
| using | size_type = size_t |
| STL convention: size type. | |
| using | iterator = T * |
| Random-access iterator. | |
| using | const_iterator = const T * |
| Random-access const iterator. | |
Public Member Functions | |
| SmallVector () noexcept | |
| Construct an empty vector using the inline storage. Never allocates. | |
| SmallVector (const size_t n, const T &value) | |
Construct with n copies of value. | |
| SmallVector (std::initializer_list< T > l) | |
| Construct from an initializer list. | |
| template<std::input_iterator It> | |
| SmallVector (It first, It last) | |
| Construct from an iterator range. | |
| SmallVector (const SmallVector &v) | |
Copy constructor (requires copyable T). | |
| SmallVector (SmallVector &&v) noexcept(std::is_nothrow_move_constructible_v< T >) | |
| Move constructor. | |
| SmallVector & | operator= (const SmallVector &v) |
Copy assignment (requires copyable T). | |
| SmallVector & | operator= (SmallVector &&v) noexcept(std::is_nothrow_move_constructible_v< T >) |
| Move assignment. The source is left empty. | |
| ~SmallVector () | |
| void | swap (SmallVector &v) noexcept(std::is_nothrow_move_constructible_v< T >) |
Swap contents with v. | |
| size_t | size () const noexcept |
| Return the number of stored elements. O(1). | |
| size_t | capacity () const noexcept |
| Return the current capacity (inline or heap). O(1). | |
| bool | is_empty () const noexcept |
Return true if no elements are stored. O(1). | |
| bool | is_small () const noexcept |
Return true while the elements still live in the inline buffer. O(1). | |
| void | reserve (const size_t cap) |
Reserve capacity for at least cap elements. | |
| void | empty () noexcept |
| Destroy all elements (Aleph convention). | |
| void | clear () noexcept |
Destroy all elements. Alias of empty(). Capacity is kept. | |
| T & | operator[] (size_t i) |
| Checked access to the i-th element. | |
| const T & | operator[] (size_t i) const |
Checked const access to the i-th element (throws std::out_of_range). | |
| T & | operator() (size_t i) noexcept |
Unchecked access to the i-th element (must be < size()). | |
| const T & | operator() (size_t i) const noexcept |
Unchecked const access to the i-th element (must be < size()). | |
| T & | get_first () |
| First element (checked). | |
| const T & | get_first () const |
See get_first(). | |
| T & | get_last () |
| Last element (checked). | |
| const T & | get_last () const |
See get_last(). | |
| T * | data () noexcept |
| Pointer to the contiguous element storage. O(1). | |
| const T * | data () const noexcept |
See data(). | |
| template<class... Args> | |
| T & | emplace_back (Args &&...args) |
| Construct an element in place at the end. | |
| T & | append (const T &item) |
Append a copy of item. | |
| T & | append (T &&item) |
Append item by moving. | |
| void | append_range (const T *first, const size_t count) |
Append count copies from [first, first + count), in order. | |
| T & | push_back (const T &item) |
STL-style alias of append(const T &). | |
| T & | push_back (T &&item) |
STL-style alias of append(T &&). | |
| T | remove_last () |
| Remove and return the last element. | |
| void | pop_back () |
| Remove the last element (STL style). | |
| T & | insert (size_t pos, T item) |
Insert an element at position pos, shifting the tail right. | |
| void | erase (const size_t pos) |
Remove the element at position pos, shifting the tail left. | |
| iterator | begin () noexcept |
| Iterator to the first element. O(1). | |
| iterator | end () noexcept |
| Iterator past the last element. O(1). | |
| const_iterator | begin () const noexcept |
| Const iterator to the first element. O(1). | |
| const_iterator | end () const noexcept |
| Const iterator past the last element. O(1). | |
| const_iterator | cbegin () const noexcept |
| Const iterator to the first element. O(1). | |
| const_iterator | cend () const noexcept |
| Const iterator past the last element. O(1). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation operation) |
Traverse elements in order while operation returns true. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation operation) const |
Const traversal in order while operation returns true. | |
| template<size_t M> | |
| bool | operator== (const SmallVector< T, M > &v) const |
| Equality: same size and pairwise equal elements. | |
| template<size_t M> | |
| bool | operator!= (const SmallVector< T, M > &v) const |
Inequality: negation of operator==. | |
Private Member Functions | |
| T * | inline_ptr () noexcept |
| const T * | inline_ptr () const noexcept |
| void | relocate (const size_t new_cap) |
| void | grow (const size_t min_cap) |
| void | steal (SmallVector &&o) noexcept(std::is_nothrow_move_constructible_v< T >) |
| void | release () noexcept |
Static Private Member Functions | |
| static T * | allocate (size_t m) |
| static void | deallocate (T *p, size_t m) noexcept |
Private Attributes | |
| std::byte | storage_ [N *sizeof(T)] |
| T * | ptr_ |
| size_t | n_ = 0 |
| size_t | cap_ = N |
Contiguous dynamic array with N elements of inline storage.
Elements live inside the object until the size exceeds N, at which point the contents move to a heap buffer that grows geometrically (factor 2). The container never returns to inline storage once spilled (even if it shrinks below N), so pointers into a heap-mode vector are only invalidated by growth.
| T | Element type. Must be move-constructible. Copy operations additionally require copy-constructible/assignable T. |
| N | Number of inline slots (must be positive). Choose it from the common-case size of the data, not the worst case. |
T * / const T *): contiguous, random access. Growth reallocates and invalidates all iterators and references.Array), empty() clears the container and is_empty() is the emptiness predicate. Both append and push_back names are provided.T has a non-throwing move constructor or is copyable (std::move_if_noexcept semantics).Definition at line 118 of file tpl_small_vector.H.
| using Aleph::SmallVector< T, N >::const_iterator = const T * |
Random-access const iterator.
Definition at line 241 of file tpl_small_vector.H.
| using Aleph::SmallVector< T, N >::Item_Type = T |
Aleph convention: element type.
Definition at line 237 of file tpl_small_vector.H.
| using Aleph::SmallVector< T, N >::iterator = T * |
Random-access iterator.
Definition at line 240 of file tpl_small_vector.H.
| using Aleph::SmallVector< T, N >::size_type = size_t |
STL convention: size type.
Definition at line 239 of file tpl_small_vector.H.
| using Aleph::SmallVector< T, N >::value_type = T |
STL convention: value type.
Definition at line 238 of file tpl_small_vector.H.
|
inlinenoexcept |
Construct an empty vector using the inline storage. Never allocates.
Definition at line 244 of file tpl_small_vector.H.
|
inline |
Construct with n copies of value.
| n | Number of elements. |
| value | Value copied into each element. |
| std::bad_alloc | if n > N and the heap buffer cannot be allocated. |
Definition at line 252 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::n_, Aleph::SmallVector< T, N >::ptr_, Aleph::SmallVector< T, N >::release(), and value.
|
inline |
Construct from an initializer list.
| l | Elements to copy, in order. |
| std::bad_alloc | if the heap buffer cannot be allocated. |
Definition at line 274 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::grow(), l, Aleph::SmallVector< T, N >::n_, Aleph::SmallVector< T, N >::ptr_, Aleph::SmallVector< T, N >::release(), and Aleph::DynList< T >::size().
|
inline |
Construct from an iterator range.
| It | Input iterator whose value type converts to T. |
| first | Beginning of the range. |
| last | End of the range. |
| std::bad_alloc | if the heap buffer cannot be allocated. |
Definition at line 302 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::append(), and Aleph::SmallVector< T, N >::release().
|
inline |
Copy constructor (requires copyable T).
Definition at line 317 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::n_, Aleph::SmallVector< T, N >::ptr_, and Aleph::SmallVector< T, N >::release().
|
inlinenoexcept |
Move constructor.
Heap-mode sources are stolen in O(1); inline-mode sources are moved element by element (O(n)). The source is left empty.
Definition at line 340 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::steal().
|
inline |
Definition at line 370 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::release().
|
inlinestaticprivate |
Definition at line 141 of file tpl_small_vector.H.
References m.
Referenced by Aleph::SmallVector< T, N >::relocate().
Append a copy of item.
| item | Element to copy. |
| std::bad_alloc | if a growing reallocation fails. |
Definition at line 556 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::emplace_back().
Referenced by Aleph::SmallVector< T, N >::SmallVector(), Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::SmallVector< T, N >::push_back(), Aleph::SmallVector< T, N >::push_back(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
Append item by moving.
| item | Element to move in. |
| std::bad_alloc | if a growing reallocation fails. |
Definition at line 568 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::emplace_back().
|
inline |
Append count copies from [first, first + count), in order.
| first | Pointer to the first source element. May be nullptr only when count == 0 (nothing is read from it then). |
| count | Number of elements to copy. |
[first, first + count) is a valid range of live T objects (readable, not past-the-end of their own storage). [first, first + count) does not overlap this vector's own element storage (i.e. first is not itself data() or a pointer derived from it), including across a reallocation this very call might trigger: if count grows the vector past capacity(), grow() relocates to a new buffer and frees the old one before any copying happens, so a first that pointed into the old buffer would already be dangling by the time it is read. Like std::memcpy, this does not support appending a vector's own elements to itself. | std::invalid_argument | if first == nullptr and count > 0. |
| std::bad_alloc | if a growing reallocation fails. |
| std::overflow_error | if count would overflow size_t when added to the current size(), or if growing the capacity to fit the result would overflow (see grow()'s own capacity-doubling guard). |
append(first[i]) for i in [0, count), in order, but faster: when T is trivially copyable, the whole range is copied with a single std::uninitialized_copy_n call instead of count individual placement-new calls (safe because a trivially copyable type's copy can never throw and has no observable side effects beyond the bytes themselves; standard library implementations lower this to a single memcpy for such types). For any other copy-constructible T, this still grows at most once for the whole range (rather than up to count times) before placement-constructing each element, with the same strong exception guarantee as append: if a mid-range copy throws, only the newly-appended elements are unwound and size() is left exactly as it was before the call. O(count), or O(size() + count) on the occasions this triggers a growing reallocation. @par Thread Safety), concurrent calls on the same instance require external synchronization. Definition at line 614 of file tpl_small_vector.H.
References ah_invalid_argument_if, ah_overflow_error_if, Aleph::SmallVector< T, N >::cap_, Aleph::count(), Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::Rope< Char, LeafSize >::build_from_view(), Aleph::Rope< Char, LeafSize >::slice(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Rope< Char, LeafSize >::try_absorb_left(), and Aleph::Rope< Char, LeafSize >::try_absorb_right().
|
inlinenoexcept |
Const iterator to the first element. O(1).
Definition at line 755 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
|
inlinenoexcept |
Iterator to the first element. O(1).
Definition at line 743 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
Referenced by TEST().
|
inlinenoexcept |
Return the current capacity (inline or heap). O(1).
Definition at line 405 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_.
|
inlinenoexcept |
Const iterator to the first element. O(1).
Definition at line 767 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
|
inlinenoexcept |
Const iterator past the last element. O(1).
Definition at line 773 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inlinenoexcept |
Destroy all elements. Alias of empty(). Capacity is kept.
Definition at line 443 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::empty().
Referenced by TEST().
|
inlinenoexcept |
See data().
Definition at line 521 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
|
inlinenoexcept |
Pointer to the contiguous element storage. O(1).
Definition at line 515 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
Referenced by TEST(), TEST(), TEST(), TEST(), Aleph::Rope< Char, LeafSize >::try_absorb_left(), and Aleph::Rope< Char, LeafSize >::try_absorb_right().
|
inlinestaticprivatenoexcept |
Definition at line 146 of file tpl_small_vector.H.
References m.
Referenced by Aleph::SmallVector< T, N >::release(), and Aleph::SmallVector< T, N >::relocate().
|
inline |
Construct an element in place at the end.
| Args | Argument types forwarded to T's constructor. |
| args | Arguments forwarded to T's constructor. |
| std::bad_alloc | if a growing reallocation fails. |
args reference elements of this vector (the element is built before any reallocation). Definition at line 537 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::SmallVector< T, N >::append(), Aleph::SmallVector< T, N >::append(), TEST(), and TEST().
|
inlinenoexcept |
Destroy all elements (Aleph convention).
Capacity is kept.
Array::empty()), this mutates the vector; use is_empty() to test emptiness. Definition at line 436 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::SmallVector< T, N >::clear(), Aleph::BinNodePrefixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and TEST().
|
inlinenoexcept |
Const iterator past the last element. O(1).
Definition at line 761 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inlinenoexcept |
Iterator past the last element. O(1).
Definition at line 749 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by TEST().
|
inline |
Remove the element at position pos, shifting the tail left.
| pos | Position of the element to remove, in [0, size()). |
| std::out_of_range | if pos >= size(). |
Definition at line 731 of file tpl_small_vector.H.
References ah_out_of_range_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by TEST().
|
inline |
First element (checked).
| std::underflow_error | if the vector is empty. |
Definition at line 484 of file tpl_small_vector.H.
References ah_underflow_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inline |
See get_first().
Definition at line 491 of file tpl_small_vector.H.
References ah_underflow_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inline |
Last element (checked).
| std::underflow_error | if the vector is empty. |
Definition at line 501 of file tpl_small_vector.H.
References ah_underflow_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inline |
See get_last().
Definition at line 508 of file tpl_small_vector.H.
References ah_underflow_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inlineprivate |
Definition at line 176 of file tpl_small_vector.H.
References ah_overflow_error_if, Aleph::SmallVector< T, N >::cap_, and Aleph::SmallVector< T, N >::relocate().
Referenced by Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::append_range(), Aleph::SmallVector< T, N >::emplace_back(), Aleph::SmallVector< T, N >::insert(), Aleph::SmallVector< T, N >::operator=(), and Aleph::SmallVector< T, N >::reserve().
|
inlineprivatenoexcept |
Definition at line 136 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::storage_.
|
inlineprivatenoexcept |
Definition at line 131 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::storage_.
Referenced by Aleph::SmallVector< T, N >::is_small(), and Aleph::SmallVector< T, N >::release().
|
inline |
Insert an element at position pos, shifting the tail right.
| pos | Insertion position in [0, size()]. |
| item | Element to insert (taken by value: pass rvalues to move). |
| std::out_of_range | if pos > size(). |
| std::bad_alloc | if a growing reallocation fails. |
Definition at line 707 of file tpl_small_vector.H.
References ah_out_of_range_error_if, Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by TEST().
|
inlinenoexcept |
Return true if no elements are stored. O(1).
Definition at line 411 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_.
Referenced by Aleph::compute_height_with_stack(), Aleph::copyRec(), Aleph::BinNodeInfixIterator< Node >::is_in_first(), Aleph::BinNodeInfixIterator< Node >::is_last(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::next_ne(), TEST(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Return true while the elements still live in the inline buffer. O(1).
Definition at line 417 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::inline_ptr(), and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::SmallVector< T, N >::release(), Aleph::SmallVector< T, N >::relocate(), Aleph::SmallVector< T, N >::swap(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Inequality: negation of operator==.
Definition at line 832 of file tpl_small_vector.H.
|
inlinenoexcept |
Unchecked const access to the i-th element (must be < size()).
Definition at line 475 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
|
inlinenoexcept |
Unchecked access to the i-th element (must be < size()).
Definition at line 469 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::ptr_.
|
inline |
Copy assignment (requires copyable T).
Definition at line 347 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::n_, Aleph::SmallVector< T, N >::ptr_, and Aleph::SmallVector< T, N >::release().
|
inlinenoexcept |
Move assignment. The source is left empty.
Definition at line 361 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::release(), and Aleph::SmallVector< T, N >::steal().
|
inline |
Equality: same size and pairwise equal elements.
| v | Vector to compare against (any inline capacity). |
true if both vectors hold equal elements in the same order. T equality comparable. Definition at line 820 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, Aleph::SmallVector< T, N >::ptr_, and Aleph::SmallVector< T, N >::size().
|
inline |
Checked access to the i-th element.
| i | Zero-based index. |
| std::out_of_range | if i >= size(). |
Definition at line 455 of file tpl_small_vector.H.
References ah_out_of_range_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inline |
Checked const access to the i-th element (throws std::out_of_range).
Definition at line 462 of file tpl_small_vector.H.
References ah_out_of_range_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inline |
Remove the last element (STL style).
| std::underflow_error | if the vector is empty. |
Definition at line 693 of file tpl_small_vector.H.
References ah_underflow_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
inline |
STL-style alias of append(const T &).
Definition at line 664 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::append().
Referenced by Aleph::compute_height_with_stack(), Aleph::copyRec(), and TEST().
STL-style alias of append(T &&).
Definition at line 671 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::append().
|
inlineprivatenoexcept |
Definition at line 226 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::deallocate(), Aleph::SmallVector< T, N >::inline_ptr(), Aleph::SmallVector< T, N >::is_small(), N, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::~SmallVector(), Aleph::SmallVector< T, N >::operator=(), Aleph::SmallVector< T, N >::operator=(), and Aleph::SmallVector< T, N >::steal().
|
inlineprivate |
Definition at line 153 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::allocate(), Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::deallocate(), Aleph::SmallVector< T, N >::is_small(), Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::SmallVector< T, N >::grow().
|
inline |
Remove and return the last element.
| std::underflow_error | if the vector is empty. |
Definition at line 681 of file tpl_small_vector.H.
References ah_underflow_error_if, Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::compute_height_with_stack(), Aleph::copyRec(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::next_ne(), TEST(), and TEST().
|
inline |
Reserve capacity for at least cap elements.
| cap | Desired capacity. Values <= capacity() are no-ops. |
| std::bad_alloc | if the heap buffer cannot be allocated. |
Definition at line 426 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, and Aleph::SmallVector< T, N >::grow().
|
inlinenoexcept |
Return the number of stored elements. O(1).
Definition at line 399 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_.
Referenced by Aleph::Rope< Char, LeafSize >::make_leaf(), Aleph::SmallVector< T, N >::operator==(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Rope< Char, LeafSize >::try_absorb_left(), and Aleph::Rope< Char, LeafSize >::try_absorb_right().
|
inlineprivatenoexcept |
Definition at line 189 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::cap_, N, Aleph::SmallVector< T, N >::n_, Aleph::SmallVector< T, N >::ptr_, and Aleph::SmallVector< T, N >::release().
Referenced by Aleph::SmallVector< T, N >::SmallVector(), and Aleph::SmallVector< T, N >::operator=().
|
inlinenoexcept |
Swap contents with v.
O(1) when both vectors are in heap mode; otherwise elements are moved individually (O(n + m)).
| v | Vector to swap with. |
Definition at line 382 of file tpl_small_vector.H.
References Aleph::and, Aleph::SmallVector< T, N >::cap_, Aleph::SmallVector< T, N >::is_small(), Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by Aleph::BinNodeInfixIterator< Node >::swap(), Aleph::BinNodePrefixIterator< Node >::swap(), and TEST().
|
inline |
Traverse elements in order while operation returns true.
Aleph-style bounded traversal: operation receives each element in index order; returning false stops the walk.
| Operation | Callable bool(T &). |
| operation | Operation to apply. |
true if all elements were visited, false if stopped early. Definition at line 789 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
Referenced by TEST().
|
inline |
Const traversal in order while operation returns true.
| Operation | Callable bool(const T &). |
| operation | Operation to apply. |
true if all elements were visited, false if stopped early. Definition at line 804 of file tpl_small_vector.H.
References Aleph::SmallVector< T, N >::n_, and Aleph::SmallVector< T, N >::ptr_.
|
private |
Definition at line 129 of file tpl_small_vector.H.
Referenced by Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::append_range(), Aleph::SmallVector< T, N >::capacity(), Aleph::SmallVector< T, N >::emplace_back(), Aleph::SmallVector< T, N >::grow(), Aleph::SmallVector< T, N >::insert(), Aleph::SmallVector< T, N >::operator=(), Aleph::SmallVector< T, N >::release(), Aleph::SmallVector< T, N >::relocate(), Aleph::SmallVector< T, N >::reserve(), Aleph::SmallVector< T, N >::steal(), and Aleph::SmallVector< T, N >::swap().
|
private |
Definition at line 128 of file tpl_small_vector.H.
Referenced by Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::append_range(), Aleph::SmallVector< T, N >::cend(), Aleph::SmallVector< T, N >::emplace_back(), Aleph::SmallVector< T, N >::empty(), Aleph::SmallVector< T, N >::end(), Aleph::SmallVector< T, N >::end(), Aleph::SmallVector< T, N >::erase(), Aleph::SmallVector< T, N >::get_first(), Aleph::SmallVector< T, N >::get_first(), Aleph::SmallVector< T, N >::get_last(), Aleph::SmallVector< T, N >::get_last(), Aleph::SmallVector< T, N >::insert(), Aleph::SmallVector< T, N >::is_empty(), Aleph::SmallVector< T, N >::operator=(), Aleph::SmallVector< T, N >::operator==(), Aleph::SmallVector< T, N >::operator[](), Aleph::SmallVector< T, N >::operator[](), Aleph::SmallVector< T, N >::pop_back(), Aleph::SmallVector< T, N >::release(), Aleph::SmallVector< T, N >::relocate(), Aleph::SmallVector< T, N >::remove_last(), Aleph::SmallVector< T, N >::size(), Aleph::SmallVector< T, N >::steal(), Aleph::SmallVector< T, N >::swap(), Aleph::SmallVector< T, N >::traverse(), and Aleph::SmallVector< T, N >::traverse().
|
private |
Definition at line 127 of file tpl_small_vector.H.
Referenced by Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::SmallVector(), Aleph::SmallVector< T, N >::append_range(), Aleph::SmallVector< T, N >::begin(), Aleph::SmallVector< T, N >::begin(), Aleph::SmallVector< T, N >::cbegin(), Aleph::SmallVector< T, N >::cend(), Aleph::SmallVector< T, N >::data(), Aleph::SmallVector< T, N >::data(), Aleph::SmallVector< T, N >::emplace_back(), Aleph::SmallVector< T, N >::empty(), Aleph::SmallVector< T, N >::end(), Aleph::SmallVector< T, N >::end(), Aleph::SmallVector< T, N >::erase(), Aleph::SmallVector< T, N >::get_first(), Aleph::SmallVector< T, N >::get_first(), Aleph::SmallVector< T, N >::get_last(), Aleph::SmallVector< T, N >::get_last(), Aleph::SmallVector< T, N >::insert(), Aleph::SmallVector< T, N >::is_small(), Aleph::SmallVector< T, N >::operator()(), Aleph::SmallVector< T, N >::operator()(), Aleph::SmallVector< T, N >::operator=(), Aleph::SmallVector< T, N >::operator==(), Aleph::SmallVector< T, N >::operator[](), Aleph::SmallVector< T, N >::operator[](), Aleph::SmallVector< T, N >::pop_back(), Aleph::SmallVector< T, N >::release(), Aleph::SmallVector< T, N >::relocate(), Aleph::SmallVector< T, N >::remove_last(), Aleph::SmallVector< T, N >::steal(), Aleph::SmallVector< T, N >::swap(), Aleph::SmallVector< T, N >::traverse(), and Aleph::SmallVector< T, N >::traverse().
|
private |
Definition at line 126 of file tpl_small_vector.H.
Referenced by Aleph::SmallVector< T, N >::inline_ptr(), and Aleph::SmallVector< T, N >::inline_ptr().