|
libcaramel
|
A resizable array. More...
#include <dynamic_array.hpp>
Public Types | |
| using | value_type = Any |
| using | size_type = typename underlying_type::size_type |
| using | difference_type = std::ptrdiff_t |
| using | allocator_type = typename underlying_type::allocator_type |
| using | reference = value_type & |
| using | const_reference = const value_type & |
| using | pointer = typename allocator_type::pointer |
| using | const_pointer = typename allocator_type::const_pointer |
| using | iterator = typename underlying_type::iterator |
| using | const_iterator = typename underlying_type::const_iterator |
| using | reverse_iterator = std::reverse_iterator< iterator > |
| using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Public Member Functions | |
| constexpr | dynamic_array () noexcept(noexcept(underlying_type{}))=default |
| Default constructor. | |
| constexpr | dynamic_array (size_type count, const_reference value) |
| Construct the container with count copies of elements with value value. More... | |
| constexpr | dynamic_array (std::initializer_list< Any > init) |
| Construct the container with the contents of the initializer list init. More... | |
| template<std::input_iterator InputIt> | |
| constexpr | dynamic_array (InputIt first, InputIt last) |
| Construct the container with the contents of the range [first, last) More... | |
| constexpr auto | operator= (std::initializer_list< Any > init_list) -> dynamic_array & |
| Replaces the contents with those identified by initializer list init_list. More... | |
| constexpr auto | allocator () const noexcept -> allocator_type |
| Returns the allocator associated with the container. More... | |
| constexpr auto | lookup (size_type index) -> reference |
| Access the object stored at a specific index. More... | |
| constexpr auto | lookup (size_type index) const -> const_reference |
| Access the object stored at a specific index. More... | |
| constexpr auto | data () noexcept -> pointer |
| Access the data stored by the container. More... | |
| constexpr auto | data () const noexcept -> const_pointer |
| Access the data stored by the container. More... | |
| constexpr auto | begin () noexcept -> iterator |
| Returns an iterator to the first element of the basic_dynamic_array. More... | |
| constexpr auto | begin () const noexcept -> const_iterator |
| Returns an iterator to the first element of the basic_dynamic_array. More... | |
| constexpr auto | cbegin () const noexcept -> const_iterator |
| Returns an iterator to the first element of the basic_dynamic_array. More... | |
| constexpr auto | end () noexcept -> iterator |
| Get an iterator to the element following the last element of the basic_dynamic_array. More... | |
| constexpr auto | end () const noexcept -> const_iterator |
| Return an iterator to the element following the last element of the basic_dynamic_array. More... | |
| constexpr auto | cend () const noexcept -> const_iterator |
| Returns an it iterator to the element following the last element of the basic_dynamic_array. More... | |
| constexpr auto | rbegin () noexcept -> reverse_iterator |
| Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend(). More... | |
| constexpr auto | rbegin () const noexcept -> const_reverse_iterator |
| Returns a reverse_iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend(). More... | |
| constexpr auto | rcbegin () const noexcept -> const_reverse_iterator |
| Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend(). More... | |
| constexpr auto | rend () noexcept -> reverse_iterator |
| Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB. More... | |
| constexpr auto | rend () const noexcept -> const_reverse_iterator |
| Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB. More... | |
| constexpr auto | rcend () const noexcept -> const_reverse_iterator |
| Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB. More... | |
| constexpr auto | empty () const noexcept -> bool |
| Check if the basic_dynamic_array is empty. More... | |
| constexpr auto | size () const noexcept -> size_type |
| Check the number of elements stored in the basic_dynamic_array. More... | |
| constexpr auto | capacity () const noexcept -> size_type |
| Check the number of elements that the basic_dynamic_array has currently allocated space for. More... | |
| constexpr void | reserve (size_type new_cap) |
| Increase the capacity of the vector to a value that's greater or equal to new_cap. If new_ap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. If reallocated occurs, all current iterators are invalidated. More... | |
| constexpr void | clear () noexcept |
| Erases all elements from the container, After this call, size() returs zero. | |
| constexpr auto | insert (const_iterator pos, const_reference value) -> iterator |
| Inserts an element value at the position before pos in the container. More... | |
| constexpr auto | insert (const_iterator pos, value_type &&value) -> iterator |
| Inserts an element value at the position before pos in the container. More... | |
| template<typename... Args> | |
| constexpr auto | insert (const_iterator pos, Args... args) -> iterator |
| Insert a new element into the container directly before pos. The element is constructed in-place using the arguments Args... that are forwarded to the constructor. More... | |
| constexpr auto | insert (const_iterator pos, size_type count, const_reference value) -> iterator |
| Inserts count elements from a specified value. More... | |
| template<std::input_iterator InputIt> | |
| constexpr auto | insert (const_iterator pos, InputIt first, InputIt last) -> iterator |
| Inserts elements from a range [first, last) before pos. More... | |
| constexpr auto | insert (const_iterator pos, std::initializer_list< value_type > init_list) -> iterator |
| Insert elements from an initializer_list before the position pos. More... | |
| constexpr auto | erase (const_iterator pos) -> iterator |
| Erases the specified element from the container. More... | |
| constexpr auto | erase (const_iterator first, const_iterator last) -> iterator |
| Erases the specified elements from the container. More... | |
| constexpr void | append (const value_type &value) |
| Appends the given element value to the end of the container. The new element is initialized as a copy of value. More... | |
| constexpr void | append (value_type &&value) |
| Appends the given element value to the end of the container. Value is moved into the new element. More... | |
| template<typename... Args> | |
| requires constexpr std::constructible_from< value_type, Args... > auto | append (in_place_t, Args &&... args) -> reference |
| Appends the given element value to the end of the container. The element is constructed in-place using the arguments Args... that are forwarded to the constructor. More... | |
| constexpr void | pop_back () |
| Removes the last element in the container. More... | |
| constexpr void | resize (size_type count) |
| Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, default constructed elements are appended. More... | |
| constexpr void | resize (size_type count, const_reference value) |
| Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional copies of value are appended. More... | |
A resizable array.
| Any | The type of the elements |
|
inlineconstexpr |
Construct the container with count copies of elements with value value.
| [in] | count | The size of the container. |
| [in] | The | value to initialize elements from. |
|
inlineconstexpr |
Construct the container with the contents of the initializer list init.
| [in] | init | Initializer list to initialize the elements of the container with. |
|
inlineconstexpr |
Construct the container with the contents of the range [first, last)
| [in] | first | The first element of the range to copy from. |
| [in] | last | One past the last element of the range to copy from. |
|
inlineconstexprnoexcept |
Returns the allocator associated with the container.
|
inlineconstexpr |
Appends the given element value to the end of the container. The new element is initialized as a copy of value.
| [in] | value | The value of the element to append. |
|
inlineconstexpr |
Appends the given element value to the end of the container. The element is constructed in-place using the arguments Args... that are forwarded to the constructor.
| [in] | args | Arguments to forward to the constructor of the element. |
|
inlineconstexpr |
Appends the given element value to the end of the container. Value is moved into the new element.
| [in] | value | The value of the element to append. |
|
inlineconstexprnoexcept |
Returns an iterator to the first element of the basic_dynamic_array.
|
inlineconstexprnoexcept |
Returns an iterator to the first element of the basic_dynamic_array.
|
inlineconstexprnoexcept |
Check the number of elements that the basic_dynamic_array has currently allocated space for.
|
inlineconstexprnoexcept |
Returns an iterator to the first element of the basic_dynamic_array.
|
inlineconstexprnoexcept |
Returns an it iterator to the element following the last element of the basic_dynamic_array.
|
inlineconstexprnoexcept |
Access the data stored by the container.
|
inlineconstexprnoexcept |
Access the data stored by the container.
|
inlineconstexprnoexcept |
Check if the basic_dynamic_array is empty.
|
inlineconstexprnoexcept |
Return an iterator to the element following the last element of the basic_dynamic_array.
|
inlineconstexprnoexcept |
Get an iterator to the element following the last element of the basic_dynamic_array.
|
inlineconstexpr |
Erases the specified elements from the container.
| [in] | first | The first element of the range to copy from. |
| [in] | last | One past the last element of the range to copy from. |
|
inlineconstexpr |
|
inlineconstexpr |
Insert a new element into the container directly before pos. The element is constructed in-place using the arguments Args... that are forwarded to the constructor.
| [in] | pos | Iterator before which the content will be inserted. pos may be the end() |
| [in] | args | Arguments to forward to the constructor of the element. |
|
inlineconstexpr |
|
inlineconstexpr |
Inserts elements from a range [first, last) before pos.
| [in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
| [in] | first | The first value to insert |
| [in] | last | One past the last value to insert. |
|
inlineconstexpr |
Inserts count elements from a specified value.
| [in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
| [in] | count | The number of elements to insert. |
| [in] | value | Element value to insert. |
|
inlineconstexpr |
Insert elements from an initializer_list before the position pos.
| [in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
| [in] | init_list | Initializer list to insert the values from. |
|
inlineconstexpr |
|
inlineconstexpr |
Access the object stored at a specific index.
| [in] | index | The position to lookup the object in the array |
|
inlineconstexpr |
Access the object stored at a specific index.
| [in] | index | The position to lookup the object in the array |
|
inlineconstexpr |
Replaces the contents with those identified by initializer list init_list.
| init_list | Initializer list to use as data source. |
|
inlineconstexpr |
Removes the last element in the container.
|
inlineconstexprnoexcept |
Returns a reverse_iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend().
|
inlineconstexprnoexcept |
Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend().
|
inlineconstexprnoexcept |
Returns a reverse iterator to the first element of the reversed basic_dynamic_array. It corresponds to the last element of the non-reversed basic_dynamic_array. If the basic_dynamic_array is empty, the returned iterator is equal to rend().
|
inlineconstexprnoexcept |
Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB.
|
inlineconstexprnoexcept |
Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB.
|
inlineconstexprnoexcept |
Returns a reverse iterator to the element following the last element of the reversed basic_dynamic_array. It corresponds to the element preceding the first element of the non-reversed basic_dynamic_array. This element acts as a placeholder, attempting to access it results in UB.
|
inlineconstexpr |
Increase the capacity of the vector to a value that's greater or equal to new_cap. If new_ap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. If reallocated occurs, all current iterators are invalidated.
| new_cap | New capacity of the vector. |
| If | the undelying allocator failed to allocate memory. |
|
inlineconstexpr |
Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, default constructed elements are appended.
| [in] | count | New size of the container. |
|
inlineconstexpr |
Resizes the container to contain count elements. If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional copies of value are appended.
| [in] | count | New size of the container. |
| [in] | value | The value to initialize new elements with. |
|
inlineconstexprnoexcept |
Check the number of elements stored in the basic_dynamic_array.