ipaddress 1.1.0
Loading...
Searching...
No Matches
hosts_any_sequence Class Reference

A sequence of host IP addresses. More...

#include <ip-any-iterator.hpp>

Public Types

using value_type = ip_address
 The type of the IP addresses in the sequence.
 
using size_type = size_t
 The type used for representing the size of the sequence.
 
using difference_type = uint128_t
 The type used for representing differences between iterators.
 
using pointer = value_type*
 The pointer type for the value_type.
 
using const_pointer = const value_type*
 The const pointer type for the value_type.
 
using reference = value_type&
 The reference type for the value_type.
 
using const_reference = const value_type&
 The const reference type for the value_type.
 
using iterator = ip_any_iterator<value_type, ip_address_iterator<ipv4_address>, ip_address_iterator<ipv6_address>>
 The iterator type for iterating over the sequence.
 
using const_iterator = iterator
 The const iterator type for iterating over the sequence.
 
using reverse_iterator = ip_reverse_iterator<iterator>
 The reverse iterator type for iterating over the sequence in reverse.
 
using const_reverse_iterator = ip_reverse_iterator<const_iterator>
 The const reverse iterator type for iterating over the sequence in reverse.
 

Public Member Functions

constexpr inline hosts_any_sequence (ip_address_iterator< ipv4_address > begin, ip_address_iterator< ipv4_address > end) noexcept
 Constructs a hosts_any_sequence with specified network parameters.
 
constexpr inline hosts_any_sequence (ip_address_iterator< ipv6_address > begin, ip_address_iterator< ipv6_address > end) noexcept
 Constructs a hosts_any_sequence with specified network parameters.
 
constexpr inline const_iterator begin () const noexcept
 Gets the beginning iterator of the sequence.
 
constexpr inline const_iterator end () const noexcept
 Gets the end iterator of the sequence.
 
constexpr inline const_reverse_iterator rbegin () const noexcept
 Gets the beginning reverse iterator of the sequence.
 
constexpr inline const_reverse_iterator rend () const noexcept
 Gets the end reverse iterator of the sequence.
 
constexpr inline const_iterator cbegin () const noexcept
 Gets the beginning const iterator of the sequence.
 
constexpr inline const_iterator cend () const noexcept
 Gets the end const iterator of the sequence.
 
constexpr inline const_reverse_iterator crbegin () const noexcept
 Gets the beginning const reverse iterator of the sequence.
 
constexpr inline const_reverse_iterator crend () const noexcept
 Gets the end const reverse iterator of the sequence.
 
constexpr inline bool empty () const noexcept
 Checks if the sequence is empty.
 
constexpr inline difference_type size () const noexcept
 Gets the size of the sequence.
 
constexpr inline value_type operator[] (difference_type n) const noexcept
 Accesses an element by index.
 
constexpr inline value_type at (difference_type n) const noexcept
 Accesses an element by index with bounds checking.
 
constexpr inline value_type front () const noexcept
 Accesses the first element in the sequence.
 
constexpr inline value_type back () const noexcept
 Accesses the last element in the sequence.
 

Detailed Description

A sequence of host IP addresses.

The subnets_any_sequence class template to provide a container-like interface for IP address sequences. It allows for iteration over the host addresses in a network or subnet, excluding the network and broadcast addresses when appropriate. This specialization is essential for network-related operations that require processing of individual host addresses within a given range.

Template Parameters
BaseThe base type from which the ip_address_base is derived, representing the underlying IP address type.
Remarks
When iterating, obtaining addresses occurs through lazy calculations.

Member Typedef Documentation

◆ iterator

using iterator = ip_any_iterator<value_type, ip_address_iterator<ipv4_address>, ip_address_iterator<ipv6_address>>

The iterator type for iterating over the sequence.


◆ const_iterator

The const iterator type for iterating over the sequence.


Constructor & Destructor Documentation

◆ hosts_any_sequence() [1/2]

constexpr inline hosts_any_sequence ( ip_address_iterator< ipv4_address > begin,
ip_address_iterator< ipv4_address > end )
inlinenoexcept

Constructs a hosts_any_sequence with specified network parameters.

Parameters
[in]beginThe begin ipv4 address iterator.
[in]endThe end ipv4 address iterator.

◆ hosts_any_sequence() [2/2]

constexpr inline hosts_any_sequence ( ip_address_iterator< ipv6_address > begin,
ip_address_iterator< ipv6_address > end )
inlinenoexcept

Constructs a hosts_any_sequence with specified network parameters.

Parameters
[in]beginThe begin ipv6 address iterator.
[in]endThe end ipv6 address iterator.

Member Function Documentation

◆ begin()

constexpr inline const_iterator begin ( ) const
inlinenoexcept

Gets the beginning iterator of the sequence.

Returns
A const_iterator to the first element in the sequence.

◆ end()

constexpr inline const_iterator end ( ) const
inlinenoexcept

Gets the end iterator of the sequence.

Returns
A const_iterator to the element following the last element in the sequence.

◆ rbegin()

constexpr inline const_reverse_iterator rbegin ( ) const
inlinenoexcept

Gets the beginning reverse iterator of the sequence.

Returns
A const_reverse_iterator to the first element of the reversed sequence.

◆ rend()

constexpr inline const_reverse_iterator rend ( ) const
inlinenoexcept

Gets the end reverse iterator of the sequence.

Returns
A const_reverse_iterator to the element following the last element of the reversed sequence.

◆ cbegin()

constexpr inline const_iterator cbegin ( ) const
inlinenoexcept

Gets the beginning const iterator of the sequence.

Returns
A const_iterator to the first element in the sequence.

◆ cend()

constexpr inline const_iterator cend ( ) const
inlinenoexcept

Gets the end const iterator of the sequence.

Returns
A const_iterator to the element following the last element in the sequence.

◆ crbegin()

constexpr inline const_reverse_iterator crbegin ( ) const
inlinenoexcept

Gets the beginning const reverse iterator of the sequence.

Returns
A const_reverse_iterator to the first element of the reversed sequence.

◆ crend()

constexpr inline const_reverse_iterator crend ( ) const
inlinenoexcept

Gets the end const reverse iterator of the sequence.

Returns
A const_reverse_iterator to the element following the last element of the reversed sequence.

◆ empty()

constexpr inline bool empty ( ) const
inlinenoexcept

Checks if the sequence is empty.

Returns
true if the sequence is empty, false otherwise.

◆ size()

constexpr inline difference_type size ( ) const
inlinenoexcept

Gets the size of the sequence.

Returns
The number of elements in the sequence.

◆ operator[]()

constexpr inline value_type operator[] ( difference_type n) const
inlinenoexcept

Accesses an element by index.

Parameters
[in]nThe index of the element.
Returns
The element at the specified index.

◆ at()

constexpr inline value_type at ( difference_type n) const
inlinenoexcept

Accesses an element by index with bounds checking.

Parameters
[in]nThe index of the element.
Returns
The element at the specified index.

◆ front()

constexpr inline value_type front ( ) const
inlinenoexcept

Accesses the first element in the sequence.

Returns
A reference to the first element in the sequence.

◆ back()

constexpr inline value_type back ( ) const
inlinenoexcept

Accesses the last element in the sequence.

Returns
A reference to the last element in the sequence.

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