ipaddress 1.1.0
|
A template class for creating and managing a fixed-size array of bytes. More...
#include <byte-array.hpp>
Public Types | |
using | value_type = uint8_t |
The type of elements contained in the byte_array. | |
using | size_type = size_t |
The type representing sizes and counts. | |
using | difference_type = ptrdiff_t |
The type representing the difference between two pointers. | |
using | pointer = value_type* |
A pointer to an element in the byte_array. | |
using | const_pointer = const value_type* |
A pointer to a constant element in the byte_array. | |
using | reference = value_type& |
A reference to an element in the byte_array. | |
using | const_reference = const value_type& |
A reference to a constant element in the byte_array. | |
using | iterator = pointer |
A random access iterator to byte_array that allows modification of its elements. | |
using | const_iterator = const_pointer |
A random access iterator to constant byte_array that does not allow modification of its elements. | |
using | reverse_iterator = std::reverse_iterator<iterator> |
A reverse random access iterator to byte_array that allows modification of its elements. | |
using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
A reverse random access iterator to constant byte_array that does not allow modification of its elements. | |
Public Member Functions | |
constexpr inline const_iterator | begin () const noexcept |
Returns a const_iterator to the beginning of the byte_array. | |
constexpr inline const_iterator | end () const noexcept |
Returns a const_iterator to the end of the byte_array. | |
constexpr inline const_reverse_iterator | rbegin () const noexcept |
Returns a const_reverse_iterator to the beginning of the reversed byte_array. | |
constexpr inline const_reverse_iterator | rend () const noexcept |
Returns a const_reverse_iterator to the end of the reversed byte_array. | |
constexpr inline const_iterator | cbegin () const noexcept |
Returns a const_iterator to the beginning of the byte_array (const version). | |
constexpr inline const_iterator | cend () const noexcept |
Returns a const_iterator to the end of the byte_array (const version). | |
constexpr inline const_reverse_iterator | crbegin () const noexcept |
Returns a const_reverse_iterator to the beginning of the reversed byte_array (const version). | |
constexpr inline const_reverse_iterator | crend () const noexcept |
Returns a const_reverse_iterator to the end of the reversed byte_array (const version). | |
constexpr inline bool | empty () const noexcept |
Checks if the byte_array is empty. | |
constexpr inline size_t | size () const noexcept |
Returns the size of the byte_array. | |
constexpr inline size_t | max_size () const noexcept |
Returns the maximum size of the byte_array. | |
constexpr inline reference | operator[] (size_t n) noexcept |
Accesses the element at the specified index with bounds checking. | |
constexpr inline const_reference | operator[] (size_t n) const noexcept |
Accesses the element at the specified index with bounds checking (const version). | |
constexpr inline reference | at (size_t n) noexcept |
Accesses the element at the specified index with bounds checking. | |
constexpr inline const_reference | at (size_t n) const noexcept |
Accesses the element at the specified index with bounds checking (const version). | |
constexpr inline reference | front () noexcept |
Accesses the first element in the byte_array. | |
constexpr inline const_reference | front () const noexcept |
Accesses the first element in the byte_array (const version). | |
constexpr inline reference | back () noexcept |
Accesses the last element in the byte_array. | |
constexpr inline const_reference | back () const noexcept |
Accesses the last element in the byte_array (const version). | |
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 void | swap (byte_array &other) noexcept |
Swaps the contents of this byte_array with another byte_array. | |
A template class for creating and managing a fixed-size array of bytes.
The byte_array class encapsulates a static-size array of bytes, providing type definitions for element access and iteration in both normal and reverse order. It is designed to be used where a constant size byte buffer is needed, such as in handling network addresses like IP addresses.
N | The number of bytes in the array. |
|
inlinenoexcept |
Returns a const_iterator to the beginning of the byte_array.
|
inlinenoexcept |
Returns a const_iterator to the end of the byte_array.
|
inlinenoexcept |
Returns a const_reverse_iterator to the beginning of the reversed byte_array.
|
inlinenoexcept |
Returns a const_reverse_iterator to the end of the reversed byte_array.
|
inlinenoexcept |
Returns a const_iterator to the beginning of the byte_array (const version).
|
inlinenoexcept |
Returns a const_iterator to the end of the byte_array (const version).
|
inlinenoexcept |
Returns a const_reverse_iterator to the beginning of the reversed byte_array (const version).
|
inlinenoexcept |
Returns a const_reverse_iterator to the end of the reversed byte_array (const version).
|
inlinenoexcept |
Checks if the byte_array is empty.
true
if the byte_array is empty, false
otherwise.
|
inlinenoexcept |
Returns the size of the byte_array.
|
inlinenoexcept |
Returns the maximum size of the byte_array.
|
inlinenoexcept |
Accesses the element at the specified index with bounds checking.
[in] | n | The index of the element to access. |
std::out_of_range | When going beyond the bounds of the array. |
|
inlinenoexcept |
Accesses the element at the specified index with bounds checking (const version).
[in] | n | The index of the element to access. |
std::out_of_range | When going beyond the bounds of the array. |
|
inlinenoexcept |
Accesses the element at the specified index with bounds checking.
[in] | n | The index of the element to access. |
std::out_of_range | When going beyond the bounds of the array. |
|
inlinenoexcept |
Accesses the element at the specified index with bounds checking (const version).
[in] | n | The index of the element to access. |
std::out_of_range | When going beyond the bounds of the array. |
|
inlinenoexcept |
Accesses the first element in the byte_array.
|
inlinenoexcept |
Accesses the first element in the byte_array (const version).
|
inlinenoexcept |
Accesses the last element in the byte_array.
|
inlinenoexcept |
Accesses the last element in the byte_array (const version).
|
inlinenoexcept |
Returns a pointer to the underlying array.
|
inlinenoexcept |
Returns a const pointer to the underlying array (const version).
|
inlinenoexcept |
Swaps the contents of this byte_array with another byte_array.
[in,out] | other | The other byte_array to swap contents with. |