|
|
| segmented_dynar ()=default |
| | Constructs an empty container with a default-constructed allocator.
|
| |
| | segmented_dynar (const Alloc &a) noexcept |
| | Constructs an empty container with an allocator.
|
| |
| Alloc | get_allocator () const noexcept |
| | Returns the allocator associated with the container.
|
| |
| std::size_t | capacity () const |
| | Returns the number of elements that fit in allocated segments.
|
| |
| std::size_t | size () const |
| | Returns the number of constructed elements.
|
| |
| void | reserve (std::size_t new_capacity) |
| | Ensures capacity for at least a requested number of elements.
|
| |
| void | push_back (T value) |
| | Appends an element by value.
|
| |
| T & | operator[] (std::size_t index) |
| | Accesses an element without bounds checking.
|
| |
| T const & | operator[] (std::size_t index) const |
| | Accesses an element without bounds checking.
|
| |
| T & | at (std::size_t index) |
| | Accesses an element with bounds checking.
|
| |
| T const & | at (std::size_t index) const |
| | Accesses an element with bounds checking.
|
| |
| T & | front () |
| | Returns the first element.
|
| |
| T const & | front () const |
| | Returns the first element.
|
| |
| T & | back () |
| | Returns the final element.
|
| |
| T const & | back () const |
| | Returns the final element.
|
| |
| void | assign (std::size_t count, const T &value) |
| | Replaces the contents with repeated copies.
|
| |
| template<typename InputIt, typename = std::enable_if_t< !std::is_integral_v< InputIt > >> |
| void | assign (InputIt first, InputIt last) |
| | Replaces the contents with an iterator range.
|
| |
| void | assign (std::initializer_list< T > ilist) |
| | Replaces the contents from an initializer list.
|
| |
| void | pop_back () |
| | Destroys the final element.
|
| |
| void | shrink_to_fit () |
| | Releases segments that are not needed for the current size.
|
| |
|
void | clear () |
| | Destroys all elements while retaining allocated segments.
|
| |
|
void | reset () |
| | Destroys all elements and releases all allocated storage.
|
| |
|
| ~segmented_dynar () |
| | Destroys all elements and releases all segments.
|
| |
| template<typename... Args> |
| T & | emplace_back (Args &&... args) |
| | Constructs an element at the end of the container.
|
| |
| | segmented_dynar (segmented_dynar &&other) noexcept |
| | Move-constructs by taking ownership of all segments.
|
| |
| segmented_dynar & | operator= (segmented_dynar &&other) noexcept |
| | Move-assigns by taking ownership of all segments.
|
| |
| | segmented_dynar (const segmented_dynar &other) |
| | Copy-constructs every element.
|
| |
| segmented_dynar & | operator= (const segmented_dynar &other) |
| | Copy-assigns every element subject to allocator propagation rules.
|
| |
| iterator | begin () |
| | Returns an iterator to the first element.
|
| |
| iterator | end () |
| | Returns an iterator one past the final element.
|
| |
| const_iterator | begin () const |
| | Returns an immutable iterator to the first element.
|
| |
| const_iterator | end () const |
| | Returns an immutable iterator one past the final element.
|
| |
| const_iterator | cbegin () const |
| | Returns an immutable iterator to the first element.
|
| |
| const_iterator | cend () const |
| | Returns an immutable iterator one past the final element.
|
| |
template<typename T, typename Alloc = std::allocator< T >>
class rpnx::segmented_dynar< T, Alloc >
Dynamic array backed by exponentially sized stable segments.
Elements are stored in separately allocated segments. Growing the container adds segments without relocating existing elements, so element references and pointers remain valid across reserve() and append operations. Random access is constant time. Appending is amortized O(1) and O(log n) in the worst case because growth may allocate multiple segments and a replacement segment-pointer table.
Iterators are invalidated by operations that change the logical element sequence. shrink_to_fit() may release unused segments but does not move retained elements. Unless stated otherwise, operations provide the basic exception guarantee.
- Template Parameters
-
| T | Stored element type. |
| Alloc | Allocator used for elements and rebound for segment metadata. |