ipaddress 1.2.0
|
A fixed-size vector class template. More...
#include <fixed-vector.hpp>
Public Types | |
using | value_type = T |
type of the elements in the vector. | |
using | size_type = size_t |
type used for size representation. | |
using | difference_type = ptrdiff_t |
type used for representing differences between iterators. | |
using | pointer = value_type* |
type used for pointer to elements. | |
using | const_pointer = const value_type* |
type used for pointer to constant elements. | |
using | reference = value_type& |
type used for reference to elements. | |
using | const_reference = const value_type& |
type used for reference to constant elements. | |
using | iterator = fixed_vector_iterator<value_type> |
type used for iterator to elements. | |
using | const_iterator = fixed_vector_iterator<const value_type> |
type used for iterator to constant elements. | |
using | reverse_iterator = std::reverse_iterator<iterator> |
type used for reverse iterator. | |
using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
type used for reverse iterator to constant elements. | |
Public Member Functions | |
constexpr inline | fixed_vector () noexcept=default |
Default constructor. | |
constexpr inline | fixed_vector (size_type n) noexcept |
Constructs a fixed_vector with the specified number of default-initialized elements. | |
constexpr inline | fixed_vector (size_type n, const_reference value) noexcept |
Constructs a fixed_vector with the specified number of elements initialized to the given value. | |
template<class It > | |
constexpr inline | fixed_vector (It first, It last) noexcept |
Constructs a fixed_vector from a range of elements. | |
constexpr inline | fixed_vector (std::initializer_list< value_type > init_list) noexcept |
Constructs a fixed_vector from an initializer list. | |
constexpr inline void | assign (size_type n, const_reference value) noexcept |
Replaces the contents with the specified number of copies of the given value. | |
template<class It > | |
constexpr inline void | assign (It first, It last) noexcept |
Replaces the contents with the elements in the specified range. | |
constexpr inline void | assign (std::initializer_list< value_type > init_list) noexcept |
Replaces the contents with the elements in the specified initializer list. | |
constexpr inline reference | at (size_type n) noexcept |
Accesses an element by index. | |
constexpr inline const_reference | at (size_type n) const noexcept |
Accesses an element by index. | |
constexpr inline reference | operator[] (size_type n) noexcept |
Accesses an element by index. | |
constexpr inline const_reference | operator[] (size_type n) const noexcept |
Accesses an element by index. | |
constexpr inline reference | front () noexcept |
Accesses the first element in the vector. | |
constexpr inline const_reference | front () const noexcept |
Accesses the first element in the vector. | |
constexpr inline reference | back () noexcept |
Accesses the last element in the vector. | |
constexpr inline const_reference | back () const noexcept |
Accesses the last element in the vector. | |
constexpr inline pointer | data () noexcept |
Returns a pointer to the underlying array. | |
constexpr inline const_pointer | data () const noexcept |
Returns a const pointer to the underlying array (const version). | |
constexpr inline iterator | begin () noexcept |
Return iterator to the first element. | |
constexpr inline const_iterator | begin () const noexcept |
Return const iterator to the first element. | |
constexpr inline const_iterator | cbegin () const noexcept |
Return const iterator to the first element. | |
constexpr inline reverse_iterator | rbegin () noexcept |
Returns an reverse iterator to the first element. | |
constexpr inline const_reverse_iterator | rbegin () const noexcept |
Returns a const iterator to the first element. | |
constexpr inline const_reverse_iterator | crbegin () const noexcept |
Returns a const reverse iterator to the first element. | |
constexpr inline iterator | end () noexcept |
Returns an iterator to the element following the last element. | |
constexpr inline const_iterator | end () const noexcept |
Returns a const iterator to the element following the last element. | |
constexpr inline const_iterator | cend () const noexcept |
Returns a const iterator to the element following the last element. | |
constexpr inline reverse_iterator | rend () noexcept |
Returns a reverse iterator to the element following the last element. | |
constexpr inline const_reverse_iterator | rend () const noexcept |
Returns a const reverse iterator to the element following the last element. | |
constexpr inline const_reverse_iterator | crend () const noexcept |
Returns a const reverse iterator to the element following the last element. | |
constexpr inline bool | empty () const noexcept |
Determines whether the container is empty. | |
constexpr inline size_type | size () const noexcept |
Returns the number of elements in the container. | |
constexpr inline void | resize (size_type n) noexcept |
Resizes the container to the specified size. | |
constexpr inline void | resize (size_type n, const_reference value) noexcept |
Resizes the container to the specified size and initializes new elements with the given value. | |
constexpr inline iterator | insert (const_iterator pos, const_reference value) noexcept |
Inserts copies of the given value at the specified position. | |
constexpr inline iterator | insert (const_iterator pos, value_type &&value) noexcept |
Moves the given value at the specified position. | |
constexpr inline iterator | insert (const_iterator pos, size_type n, const_reference value) noexcept |
Inserts copies of the given value at the specified position. | |
template<typename It > | |
constexpr inline iterator | insert (const_iterator pos, It first, It last) noexcept |
Inserts range of elements at the specified position. | |
constexpr inline iterator | insert (const_iterator pos, std::initializer_list< value_type > init_list) noexcept |
Inserts initializer list of elements at the specified position. | |
template<typename... Args> | |
constexpr inline iterator | emplace (const_iterator pos, Args &&... args) noexcept |
Inserts a new element at the specified position, constructed in-place with the given arguments. | |
template<typename... Args> | |
constexpr inline reference | emplace_back (Args &&... args) noexcept |
Inserts a new element at the end of the vector, constructed in-place with the given arguments. | |
template<typename... Args> | |
constexpr inline pointer | try_emplace_back (Args &&... args) noexcept |
Inserts a new element at the end of the vector, constructed in-place with the given arguments. | |
template<typename... Args> | |
constexpr inline reference | unchecked_emplace_back (Args &&... args) noexcept |
Inserts a new element at the end of the vector, constructed in-place with the given arguments. | |
constexpr inline reference | push_back (const_reference value) noexcept |
Adds a new element at the end of the vector. | |
constexpr inline reference | push_back (value_type &&value) noexcept |
Adds a new element at the end of the vector. | |
constexpr inline pointer | try_push_back (const_reference value) noexcept |
Adds a new element at the end of the vector. | |
constexpr inline pointer | try_push_back (value_type &&value) noexcept |
Adds a new element at the end of the vector. | |
constexpr inline reference | unchecked_push_back (const_reference value) noexcept |
Adds a new element at the end of the vector without checking the size. | |
constexpr inline reference | unchecked_push_back (value_type &&value) noexcept |
Adds a new element at the end of the vector without checking the size. | |
constexpr inline void | pop_back () noexcept |
Removes the last element from the vector. | |
constexpr inline void | clear () noexcept |
Removes all elements from the vector. | |
constexpr inline iterator | erase (const_iterator pos) noexcept |
Removes the element at the specified position. | |
constexpr inline iterator | erase (const_iterator first, const_iterator last) noexcept |
Remove range of elements from the vector. | |
constexpr inline void | swap (fixed_vector &other) noexcept |
Swaps the contents of this vector with another vector. | |
Static Public Member Functions | |
static constexpr inline size_type | max_size () noexcept |
Returns the maximum number of elements that the container can hold. | |
static constexpr inline size_type | capacity () noexcept |
Returns the maximum number of elements that the container can hold. | |
static constexpr inline void | reserve (size_type n) noexcept |
Reserves space for the specified number of elements. | |
static constexpr inline void | shrink_to_fit () noexcept |
Shrinks the container to fit its current size. | |
A fixed-size vector class template.
The fixed_vector class template provides a simple fixed-size array wrapper that allows for compile-time operations.
T | type of the elements in the vector. |
N | capacity of the vector. |
using iterator = fixed_vector_iterator<value_type> |
type used for iterator to elements.
|
inlineexplicitnoexcept |
Constructs a fixed_vector with the specified number of default-initialized elements.
[in] | n | The number of elements to initialize. |
|
inlinenoexcept |
Constructs a fixed_vector with the specified number of elements initialized to the given value.
[in] | n | The number of elements to initialize. |
[in] | value | The value to initialize the elements with. |
|
inlinenoexcept |
Constructs a fixed_vector from a range of elements.
It | The iterator type. |
[in] | first | The beginning iterator of the range. |
[in] | last | The ending iterator of the range. |
|
inlinenoexcept |
Constructs a fixed_vector from an initializer list.
[in] | init_list | The initializer list of elements. |
|
inlinenoexcept |
Replaces the contents with the specified number of copies of the given value.
[in] | n | The number of elements to assign. |
[in] | value | The value to assign to the elements. |
|
inlinenoexcept |
Replaces the contents with the elements in the specified range.
It | The iterator type. |
[in] | first | The beginning iterator of the range. |
[in] | last | The ending iterator of the range. |
|
inlinenoexcept |
Replaces the contents with the elements in the specified initializer list.
[in] | init_list | The initializer list of elements. |
Accesses an element by index.
[in] | n | The index of the element. |
|
inlinenodiscardnoexcept |
Accesses an element by index.
[in] | n | The index of the element. |
Accesses an element by index.
[in] | n | The index of the element. |
|
inlinenodiscardnoexcept |
Accesses an element by index.
[in] | n | The index of the element. |
|
inlinenodiscardnoexcept |
Accesses the first element in the vector.
|
inlinenodiscardnoexcept |
Accesses the first element in the vector.
|
inlinenodiscardnoexcept |
Accesses the last element in the vector.
|
inlinenodiscardnoexcept |
Accesses the last element in the vector.
|
inlinenodiscardnoexcept |
Returns a pointer to the underlying array.
|
inlinenodiscardnoexcept |
Returns a const pointer to the underlying array (const version).
|
inlinenodiscardnoexcept |
Return iterator to the first element.
|
inlinenodiscardnoexcept |
Return const iterator to the first element.
|
inlinenodiscardnoexcept |
Return const iterator to the first element.
|
inlinenodiscardnoexcept |
Returns an reverse iterator to the first element.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first element.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the first element.
|
inlinenodiscardnoexcept |
Returns an iterator to the element following the last element.
|
inlinenodiscardnoexcept |
Returns a const iterator to the element following the last element.
|
inlinenodiscardnoexcept |
Returns a const iterator to the element following the last element.
|
inlinenodiscardnoexcept |
Returns a reverse iterator to the element following the last element.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the element following the last element.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the element following the last element.
|
inlinenodiscardnoexcept |
Determines whether the container is empty.
|
inlinenodiscardnoexcept |
Returns the number of elements in the container.
|
inlinestaticnodiscardnoexcept |
Returns the maximum number of elements that the container can hold.
|
inlinestaticnodiscardnoexcept |
Returns the maximum number of elements that the container can hold.
|
inlinenoexcept |
Resizes the container to the specified size.
If n is less than the current size, the container is truncated. If n is greater, default-inserted elements are added.
[in] | n | The new size of the container. |
|
inlinenoexcept |
Resizes the container to the specified size and initializes new elements with the given value.
If n is less than the current size, the container is truncated. If n is greater, copies of value are appended.
[in] | n | The new size of the container. |
[in] | value | The value to initialize new elements with. |
|
inlinestaticnoexcept |
Reserves space for the specified number of elements.
[in] | n | The number of elements to reserve space for. |
|
inlinestaticnoexcept |
Shrinks the container to fit its current size.
|
inlinenoexcept |
Inserts copies of the given value at the specified position.
[in] | pos | The position to insert the value at. |
[in] | value | The value to insert. |
|
inlinenoexcept |
Moves the given value at the specified position.
[in] | pos | The position to insert the value at. |
[in] | value | The value to insert. |
|
inlinenoexcept |
Inserts copies of the given value at the specified position.
[in] | pos | The position to insert the value at. |
[in] | n | The number of copies to insert. |
[in] | value | The value to insert. |
|
inlinenoexcept |
Inserts range of elements at the specified position.
It | The iterator type. |
[in] | pos | The position to insert the elements at. |
[in] | first | The beginning iterator of the range. |
[in] | last | The ending iterator of the range. |
|
inlinenoexcept |
Inserts initializer list of elements at the specified position.
[in] | pos | The position to insert the elements at. |
[in] | init_list | The initializer list of elements. |
|
inlinenoexcept |
Inserts a new element at the specified position, constructed in-place with the given arguments.
Args | The argument types for constructing the element. |
[in] | pos | The position to insert the element at. |
[in] | args | The arguments for constructing the element. |
|
inlinenoexcept |
Inserts a new element at the end of the vector, constructed in-place with the given arguments.
Args | The argument types for constructing the element. |
[in] | args | The arguments for constructing the element. |
|
inlinenoexcept |
Inserts a new element at the end of the vector, constructed in-place with the given arguments.
Args | The argument types for constructing the element. |
[in] | args | The arguments for constructing the element. |
|
inlinenoexcept |
Inserts a new element at the end of the vector, constructed in-place with the given arguments.
Args | The argument types for constructing the element. |
[in] | args | The arguments for constructing the element. |
|
inlinenoexcept |
Adds a new element at the end of the vector.
[in] | value | The value to add. |
|
inlinenoexcept |
Adds a new element at the end of the vector.
[in] | value | The value to add. |
|
inlinenoexcept |
Adds a new element at the end of the vector.
[in] | value | The value to add. |
|
inlinenoexcept |
Adds a new element at the end of the vector.
[in] | value | The value to add. |
|
inlinenoexcept |
Adds a new element at the end of the vector without checking the size.
[in] | value | The value to add. |
|
inlinenoexcept |
Adds a new element at the end of the vector without checking the size.
[in] | value | The value to add. |
|
inlinenoexcept |
Removes the last element from the vector.
|
inlinenoexcept |
Removes all elements from the vector.
|
inlinenoexcept |
Removes the element at the specified position.
[in] | pos | The position of the element to remove. |
|
inlinenoexcept |
Remove range of elements from the vector.
[in] | first | The position of the first element to remove. |
[in] | last | The position of the last element to remove. |
|
inlinenoexcept |
Swaps the contents of this vector with another vector.
[in] | other | The other vector to swap with. |