|
ipaddress 1.2.0
|
An iterator for traversing IP addresses within a network range. More...
#include <ip-network-iterator.hpp>
Public Types | |
| using | iterator_category = std::random_access_iterator_tag |
| The category of the iterator. | |
| using | value_type = T |
| The type of value iterated over. | |
| using | difference_type = int64_t |
| Type to represent the difference between two iterators. | |
| using | pointer = const value_type* |
| Pointer to the value type. | |
| using | reference = const value_type& |
| Reference to the value type. | |
| using | ip_address_type = typename value_type::ip_address_type |
| The underlying IP address type. | |
| using | uint_type = typename value_type::uint_type |
| Unsigned integer type used for addressing. | |
Public Member Functions | |
| constexpr inline | ip_network_iterator () noexcept=default |
| Default constructor. | |
| constexpr inline | ip_network_iterator (const ip_address_type &ref, const uint_type &step, size_t prefixlen, int carry=0) noexcept |
| Constructs an iterator with a reference IP address, step size, prefix length, and carry. | |
| constexpr inline uint_type | uint_diff (const ip_network_iterator &other) const noexcept |
| Calculates the difference in the number of elements between this and another ip_network_iterator. | |
| constexpr inline reference | operator* () const noexcept |
| Returns a reference to the current element. | |
| constexpr inline pointer | operator-> () const noexcept |
| Returns a pointer to the current element. | |
| constexpr inline value_type | operator[] (difference_type n) const noexcept |
| Accesses an element by index. | |
| constexpr inline value_type | operator[] (const uint_type &n) const noexcept |
| Accesses an element by index. | |
| constexpr inline ip_network_iterator & | operator++ () noexcept |
| Pre-increment operator. | |
| constexpr inline ip_network_iterator | operator++ (int) noexcept |
| Post-increment operator. | |
| constexpr inline ip_network_iterator & | operator-- () noexcept |
| Pre-decrement operator. | |
| constexpr inline ip_network_iterator | operator-- (int) noexcept |
| Post-decrement operator. | |
| constexpr inline ip_network_iterator & | operator+= (difference_type n) noexcept |
| Addition assignment operator. | |
| constexpr inline ip_network_iterator & | operator+= (const uint_type &n) noexcept |
| Addition assignment operator. | |
| constexpr inline ip_network_iterator & | operator-= (difference_type n) noexcept |
| Subtraction assignment operator. | |
| constexpr inline ip_network_iterator & | operator-= (const uint_type &n) noexcept |
| Subtraction assignment operator. | |
| constexpr inline ip_network_iterator | operator+ (difference_type n) const noexcept |
| Addition operator. | |
| constexpr inline ip_network_iterator | operator+ (const uint_type &n) const noexcept |
| Addition operator. | |
| constexpr inline ip_network_iterator | operator- (difference_type n) const noexcept |
| Subtraction operator. | |
| constexpr inline ip_network_iterator | operator- (const uint_type &n) const noexcept |
| Subtraction operator. | |
| constexpr inline difference_type | operator- (const ip_network_iterator &other) const noexcept |
| Subtraction operator. | |
| constexpr inline bool | operator== (const ip_network_iterator &other) const noexcept |
| Equality operator. | |
| constexpr inline bool | operator!= (const ip_network_iterator &other) const noexcept |
| Inequality operator. | |
| constexpr inline bool | operator< (const ip_network_iterator &other) const noexcept |
| Less-than operator. | |
| constexpr inline bool | operator<= (const ip_network_iterator &other) const noexcept |
| Less-than-or-equal-to operator. | |
| constexpr inline bool | operator> (const ip_network_iterator &other) const noexcept |
| Greater-than operator. | |
| constexpr inline bool | operator>= (const ip_network_iterator &other) const noexcept |
| Greater-than-or-equal-to operator. | |
An iterator for traversing IP addresses within a network range.
This class template provides a random-access iterator that allows traversal over a range of IP addresses within a network. It supports operations typical of random-access iterators, such as increment, decrement, and direct access to elements at a specific offset.
| T | The type of IPv4 or IPv6 network to iterate over. |
|
inlinenoexcept |
Constructs an iterator with a reference IP address, step size, prefix length, and carry.
| [in] | ref | The reference IP address for the iterator. |
| [in] | step | The step size for each iteration. |
| [in] | prefixlen | The prefix length defining the network. |
| [in] | carry | An optional carry value for overflow handling. |
|
inlinenodiscardnoexcept |
Calculates the difference in the number of elements between this and another ip_network_iterator.
| [in] | other | The ip_network_iterator to compare with. |
|
inlinenodiscardnoexcept |
Returns a reference to the current element.
|
inlinenodiscardnoexcept |
Returns a pointer to the current element.
|
inlinenodiscardnoexcept |
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. |
|
inlinenoexcept |
Pre-increment operator.
Increments the iterator to the next element.
|
inlinenoexcept |
Post-increment operator.
Increments the iterator to the next element and returns the iterator before the increment.
|
inlinenoexcept |
Pre-decrement operator.
Decrements the iterator to the previous element.
|
inlinenoexcept |
Post-decrement operator.
Decrements the iterator to the previous element and returns the iterator before the decrement.
|
inlinenoexcept |
Addition assignment operator.
Adds a difference_type value to the iterator.
| [in] | n | The number to add. |
|
inlinenoexcept |
Addition assignment operator.
Adds a uint_type value to the iterator.
| [in] | n | The number to add. |
|
inlinenoexcept |
Subtraction assignment operator.
Subtracts a difference_type value from the iterator.
| [in] | n | The number to subtract. |
|
inlinenoexcept |
Subtraction assignment operator.
Subtracts a uint_type value from the iterator.
| [in] | n | The number to subtract. |
|
inlinenodiscardnoexcept |
Addition operator.
Creates a new iterator that is the sum of the iterator and a difference_type value.
| [in] | n | The number to add. |
|
inlinenodiscardnoexcept |
Addition operator.
Creates a new iterator that is the sum of the iterator and a uint_type value.
| [in] | n | The number to add. |
|
inlinenodiscardnoexcept |
Subtraction operator.
Creates a new iterator that is the difference of the iterator and a difference_type value.
| [in] | n | The number to subtract. |
|
inlinenodiscardnoexcept |
Subtraction operator.
Creates a new iterator that is the difference of the iterator and a uint_type value.
| [in] | n | The number to subtract. |
|
inlinenodiscardnoexcept |
Subtraction operator.
Calculates the difference in the number of elements between this and another ip_network_iterator.
| [in] | other | The ip_network_iterator to compare with. |
|
inlinenodiscardnoexcept |
Equality operator.
Compares two ip_network_iterators for equality.
| [in] | other | The ip_network_iterator to compare with. |
true if the iterators are equal, false otherwise.
|
inlinenodiscardnoexcept |
Inequality operator.
Compares two ip_network_iterators for inequality.
| [in] | other | The ip_network_iterator to compare with. |
true if the iterators are not equal, false otherwise.
|
inlinenodiscardnoexcept |
Less-than operator.
Compares two ip_network_iterators to determine if the left one is less than the right one.
| [in] | other | The ip_network_iterator to compare with. |
true if the left iterator is less than the right iterator, false otherwise.
|
inlinenodiscardnoexcept |
Less-than-or-equal-to operator.
Compares two ip_network_iterators to determine if the left one is less than or equal to the right one.
| [in] | other | The ip_network_iterator to compare with. |
true if the left iterator is less than or equal to the right iterator, false otherwise.
|
inlinenodiscardnoexcept |
Greater-than operator.
Compares two ip_network_iterators to determine if the left one is greater than the right one.
| [in] | other | The ip_network_iterator to compare with. |
true if the left iterator is greater than the right iterator, false otherwise.
|
inlinenodiscardnoexcept |
Greater-than-or-equal-to operator.
Compares two ip_network_iterators to determine if the left one is greater than or equal to the right one.
| [in] | other | The ip_network_iterator to compare with. |
true if the left iterator is greater than or equal to the right iterator, false otherwise.