ipaddress 1.2.0
Loading...
Searching...
No Matches
ip_summarize_iterator< T > Class Template Reference

Forward iterator for summarizing an IP address range. More...

#include <ip-network-iterator.hpp>

Inheritance diagram for ip_summarize_iterator< T >:

Public Types

using iterator_category = std::forward_iterator_tag
 The category of the iterator.
 
using value_type = T
 The type of value iterated over.
 
using difference_type = typename value_type::uint_type
 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_summarize_iterator () noexcept
 Default constructor.
 
constexpr inline ip_summarize_iterator (const ip_address_type &current, const ip_address_type &last) noexcept
 Constructs a ip_summarize_iterator for an address range.
 
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 ip_summarize_iteratoroperator++ () noexcept
 Pre-increment operator.
 
constexpr inline ip_summarize_iterator operator++ (int) noexcept
 Post-increment operator.
 
constexpr inline bool operator== (const ip_summarize_iterator &other) const noexcept
 Equality operator.
 
constexpr inline bool operator!= (const ip_summarize_iterator &other) const noexcept
 Inequality operator.
 

Detailed Description

template<typename T>
class ipaddress::ip_summarize_iterator< T >

Forward iterator for summarizing an IP address range.

This iterator traverses a contiguous range of IP addresses by computing and yielding the largest possible network (IP subnet) that begins at the current IP and does not extend beyond the specified upper bound. On each iteration emits an ip network object representing the summarized subnet.

Template Parameters
TThe type of IPv4 or IPv6 network to iterate over.

Constructor & Destructor Documentation

◆ ip_summarize_iterator()

template<typename T >
inline ip_summarize_iterator ( const ip_address_type & current,
const ip_address_type & last )
inlinenoexcept

Constructs a ip_summarize_iterator for an address range.

Parameters
[in]currentThe starting IP address of the range.
[in]lastThe ending IP address of the range.

Member Function Documentation

◆ operator*()

template<typename T >
inline reference operator* ( ) const
inlinenodiscardnoexcept

Returns a reference to the current element.

Returns
A reference to the element pointed to by the iterator.

◆ operator->()

template<typename T >
inline pointer operator-> ( ) const
inlinenodiscardnoexcept

Returns a pointer to the current element.

Returns
A pointer to the element pointed to by the iterator.

◆ operator++() [1/2]

template<typename T >
inline ip_summarize_iterator & operator++ ( )
inlinenoexcept

Pre-increment operator.

Increments the iterator to the next element.

Returns
A reference to the incremented iterator.

◆ operator++() [2/2]

template<typename T >
inline ip_summarize_iterator operator++ ( int )
inlinenoexcept

Post-increment operator.

Increments the iterator to the next element and returns the iterator before the increment.

Returns
The iterator before the increment.

◆ operator==()

template<typename T >
inline bool operator== ( const ip_summarize_iterator< T > & other) const
inlinenodiscardnoexcept

Equality operator.

Compares two ip_summarize_iterator for equality.

Parameters
[in]otherThe ip_summarize_iterator to compare with.
Returns
true if the iterators are equal, false otherwise.

◆ operator!=()

template<typename T >
inline bool operator!= ( const ip_summarize_iterator< T > & other) const
inlinenodiscardnoexcept

Inequality operator.

Compares two ip_summarize_iterator for inequality.

Parameters
[in]otherThe ip_summarize_iterator to compare with.
Returns
true if the iterators are not equal, false otherwise.

The documentation for this class was generated from the following file: