ipaddress 1.2.0
Loading...
Searching...
No Matches
ipaddress Namespace Reference

Namespace dedicated to IP addresses and networks operations. More...

Classes

class  base_v4
 A template class providing the base functionality for IPv4 addresses. More...
 
class  base_v6
 A template class providing the base functionality for IPv6 addresses. More...
 
struct  byte_array
 A template class for creating and managing a fixed-size array of bytes. More...
 
class  error
 The primary exception class used by the IP address library. More...
 
class  exclude_network_sequence
 A sequence container for networks excluding specified subnets. More...
 
struct  fixed_string
 Fixed size string class. More...
 
class  fixed_vector
 A fixed-size vector class template. More...
 
class  fixed_vector_iterator
 A fixed-size vector iterator class template. More...
 
class  hosts_any_sequence
 A sequence of host IP addresses. More...
 
class  hosts_sequence< ip_address_base< Base > >
 A sequence of host IP addresses. More...
 
class  ip_address
 A class that represents an IP address, supporting both IPv4 and IPv6 formats. More...
 
class  ip_address_base
 A template base class for IP address representations. More...
 
class  ip_address_iterator< ip_address_base< Base > >
 An iterator for traversing IP addresses. More...
 
class  ip_any_iterator
 An iterator for unified traversal over IPv4 and IPv6 address spaces. More...
 
class  ip_any_summarize_iterator
 Forward iterator for summarizing an IP address range. More...
 
class  ip_exclude_network_iterator
 An iterator to traverse IP addresses within a network, excluding specified subnets. More...
 
class  ip_network
 A class that encapsulates both IPv4 and IPv6 network functionalities. More...
 
class  ip_network_base
 Template base class for representing a network of IP addresses. More...
 
class  ip_network_iterator
 An iterator for traversing IP addresses within a network range. More...
 
class  ip_reverse_iterator
 A reverse iterator template class for IP addresses. More...
 
class  ip_summarize_iterator
 Forward iterator for summarizing an IP address range. More...
 
class  ipv4_address_base
 Represents the base class for IPv4 address manipulation. More...
 
class  ipv4_network_base
 Base class for IPv4 network address manipulation. More...
 
class  ipv6_address_base
 Represents the base class for IPv6 address manipulation. More...
 
class  ipv6_network_base
 Base class for IPv6 network address manipulation. More...
 
class  logic_error
 Exception for logical errors in IP address operations. More...
 
class  optional
 A template class to manage an optional contained value. More...
 
class  parse_error
 Exception for errors encountered during IP address parsing. More...
 
class  scope
 Represents the scope identifier for an IPv6 address. More...
 
class  subnets_any_sequence
 A sequence container for subnet ranges within a network. More...
 
class  subnets_sequence
 A sequence container for subnet ranges within a network. More...
 
class  summarize_sequence
 A container class for iterating over a summarized range of networks. More...
 
class  uint128_t
 Class for representing a 128-bit unsigned integer. More...
 

Typedefs

using ipv6_address = ip_address_base<ipv6_address_base>
 Alias for the base class specialized for IPv6 address manipulation.
 
using ipv4_address = ip_address_base<ipv4_address_base>
 Alias for the base class specialized for IPv4 address manipulation.
 
using ipv4_network = ip_network_base<ipv4_network_base>
 Alias for the specialized ip_network_base class for IPv4.
 
using ipv6_network = ip_network_base<ipv6_network_base>
 Alias for the specialized ip_network_base class for IPv6.
 

Enumerations

enum class  error_code {
  no_error = 0 ,
  empty_address ,
  empty_netmask ,
  invalid_netmask ,
  netmask_pattern_mixes_zeroes_and_ones ,
  has_host_bits_set ,
  only_one_slash_permitted ,
  string_is_too_long ,
  unexpected_symbol ,
  wrong_encoding_sequence ,
  empty_octet ,
  expected_4_octets ,
  leading_0_are_not_permitted ,
  octet_more_3_characters ,
  octet_has_invalid_symbol ,
  octet_exceeded_255 ,
  least_3_parts ,
  most_8_colons_permitted ,
  part_is_more_4_chars ,
  part_has_invalid_symbol ,
  most_one_double_colon_permitted ,
  leading_colon_only_permitted_as_part_of_double_colon ,
  trailing_colon_only_permitted_as_part_of_double_colon ,
  expected_at_most_7_other_parts_with_double_colon ,
  exactly_8_parts_expected_without_double_colon ,
  scope_id_is_too_long ,
  invalid_scope_id ,
  invalid_version ,
  invalid_prefixlen_diff ,
  new_prefix_must_be_shorter ,
  new_prefix_must_be_longer ,
  cannot_set_prefixlen_diff_and_new_prefix ,
  not_contained_network ,
  last_address_must_be_greater_than_first
}
 Enumeration of error codes for IP address parsing and validation. More...
 
enum class  ip_version {
  V4 = 4 ,
  V6 = 6
}
 Enumerates the IP address versions. More...
 
enum class  format {
  full = 0 ,
  compact ,
  compressed
}
 Enumerates the formatting options for IP address strings. More...
 

Functions

template<size_t N>
constexpr inline bool operator== (const byte_array< N > &lhs, const byte_array< N > &rhs) noexcept
 Checks if two byte_array objects are equal.
 
template<size_t N>
constexpr inline bool operator!= (const byte_array< N > &lhs, const byte_array< N > &rhs) noexcept
 Checks if two byte_array objects are not equal.
 
template<size_t N>
constexpr inline bool operator< (const byte_array< N > &lhs, const byte_array< N > &rhs) noexcept
 Determines if one byte_array is less than another.
 
template<size_t N>
constexpr inline bool operator> (const byte_array< N > &lhs, const byte_array< N > &rhs) noexcept
 Determines if one byte_array is greater than another.
 
template<size_t N>
constexpr inline bool operator<= (const byte_array< N > &lhs, const byte_array< N > &rhs) noexcept
 Determines if one byte_array is less than or equal to another.
 
template<size_t N>
constexpr inline bool operator>= (const byte_array< N > &lhs, const byte_array< N > &rhs) noexcept
 Determines if one byte_array is greater than or equal to another.
 
constexpr inline bool is_little_endian () noexcept
 Checks if the system is little-endian.
 
constexpr inline uint32_t swap_bytes (uint32_t value) noexcept
 Swaps the bytes of a 32-bit unsigned integer.
 
template<typename T >
constexpr inline void raise_error (error_code code, uint32_t value, const T *address, size_t length)
 Raises an error with a specific error code and additional context.
 
template<size_t N1, size_t N2>
constexpr inline bool operator== (const fixed_string< N1 > &lhs, const fixed_string< N2 > &rhs) noexcept
 Compares the contents of two fixed strings for equality.
 
template<size_t N1, size_t N2>
constexpr inline bool operator!= (const fixed_string< N1 > &lhs, const fixed_string< N2 > &rhs) noexcept
 Compares the contents of two fixed strings for inequality.
 
template<size_t N1, size_t N2>
constexpr inline bool operator< (const fixed_string< N1 > &lhs, const fixed_string< N2 > &rhs) noexcept
 Compares the contents of two fixed strings lexicographically.
 
template<size_t N1, size_t N2>
constexpr inline bool operator> (const fixed_string< N1 > &lhs, const fixed_string< N2 > &rhs) noexcept
 Compares the contents of two fixed strings for greater than relation.
 
template<size_t N1, size_t N2>
constexpr inline bool operator<= (const fixed_string< N1 > &lhs, const fixed_string< N2 > &rhs) noexcept
 Compares the contents of two fixed strings for less than or equal relation.
 
template<size_t N1, size_t N2>
constexpr inline bool operator>= (const fixed_string< N1 > &lhs, const fixed_string< N2 > &rhs) noexcept
 Compares the contents of two fixed strings for greater than or equal relation.
 
template<typename T , size_t N>
constexpr inline fixed_string< N - 1 > make_fixed_string (const T(&data)[N]) noexcept(noexcept(fixed_string< N - 1 >(data)))
 Creates a fixed-length string from a character array.
 
template<typename T , size_t N>
constexpr inline fixed_string< N - 1 > make_fixed_string (const T(&data)[N], error_code &code) noexcept
 Creates a fixed-length string from a character array.
 
template<typename T , size_t N1, size_t N2>
constexpr inline bool operator== (const fixed_vector< T, N1 > &lhs, const fixed_vector< T, N2 > &rhs) noexcept
 Compares two fixed_vector objects for equality.
 
template<typename T , size_t N1, size_t N2>
constexpr inline bool operator!= (const fixed_vector< T, N1 > &lhs, const fixed_vector< T, N2 > &rhs) noexcept
 Compares two fixed_vector objects for inequality.
 
template<typename T , size_t N1, size_t N2>
constexpr inline bool operator< (const fixed_vector< T, N1 > &lhs, const fixed_vector< T, N2 > &rhs) noexcept
 Compares the contents of two fixed vector lexicographically.
 
template<typename T , size_t N1, size_t N2>
constexpr inline bool operator> (const fixed_vector< T, N1 > &lhs, const fixed_vector< T, N2 > &rhs) noexcept
 Compares the contents of two fixed vector lexicographically.
 
template<typename T , size_t N1, size_t N2>
constexpr inline bool operator<= (const fixed_vector< T, N1 > &lhs, const fixed_vector< T, N2 > &rhs) noexcept
 Compares the contents of two fixed vector lexicographically.
 
template<typename T , size_t N1, size_t N2>
constexpr inline bool operator>= (const fixed_vector< T, N1 > &lhs, const fixed_vector< T, N2 > &rhs) noexcept
 Compares the contents of two fixed vector lexicographically.
 
template<fixed_string FixedString>
consteval inline ip_address operator""_ip () noexcept
 User-defined literal for creating an ip_address from a fixed string at compile time.
 
template<fixed_string FixedString>
consteval inline ip_network operator""_net () noexcept
 User-defined literal operator for creating an ip_network object from a string literal.
 
template<typename FirstIp , typename LastIp >
constexpr inline auto summarize_address_range (const FirstIp &first, const LastIp &last, error_code &code) noexcept -> decltype(internal::summarize_address_range(typename internal::ip_address_type< FirstIp, LastIp >::type{first}, typename internal::ip_address_type< FirstIp, LastIp >::type{last}, code))
 Summarizes an IP address range into the smallest set of contiguous network blocks.
 
template<typename FirstIp , typename LastIp >
constexpr inline auto summarize_address_range (const FirstIp &first, const LastIp &last) -> decltype(summarize_address_range(first, last, *std::declval< error_code * >()))
 Summarizes an IP address range into the smallest set of contiguous network blocks.
 
template<typename Net , size_t N>
constexpr inline fixed_vector< Net, N > collapse_addresses (const std::array< Net, N > &nets, error_code &code) noexcept
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename Net , size_t N>
constexpr inline fixed_vector< Net, N > collapse_addresses (const Net(&nets)[N], error_code &code) noexcept
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename... Nets, typename std::enable_if< internal::is_ip_network_types< Nets... >::value, bool >::type = true>
constexpr inline auto collapse_addresses (error_code &code, const Nets &... nets) noexcept -> fixed_vector< typename internal::ip_network_type_extract< Nets... >::type, sizeof...(Nets)>
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename It >
constexpr inline auto collapse_addresses (It first, It last, error_code &code) noexcept -> std::vector< typename std::iterator_traits< It >::value_type >
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename Net , size_t N>
constexpr inline fixed_vector< Net, N > collapse_addresses (const std::array< Net, N > &nets)
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename Net , size_t N>
constexpr inline fixed_vector< Net, N > collapse_addresses (const Net(&nets)[N])
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename... Nets, typename std::enable_if< internal::is_ip_network_types< Nets... >::value, bool >::type = true>
constexpr inline auto collapse_addresses (const Nets &... nets) -> fixed_vector< typename internal::ip_network_type_extract< Nets... >::type, sizeof...(Nets)>
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<typename It >
constexpr inline auto collapse_addresses (It first, It last) -> std::vector< typename std::iterator_traits< It >::value_type >
 Collapses a collection of IP networks into the smallest set of contiguous networks.
 
template<fixed_string FixedString>
consteval inline ipv4_address operator""_ipv4 () noexcept
 User-defined literal for creating an ipv4_address from a fixed string at compile time.
 
consteval inline ipv4_address operator""_ipv4 (unsigned long long value) noexcept
 User-defined literal for creating an ipv4_address from an unsigned long long integer at compile time.
 
template<fixed_string FixedString>
consteval inline ipv4_network operator""_ipv4_net () noexcept
 User-defined literal operator for creating an ipv4_network object from a string literal.
 
template<fixed_string FixedString>
consteval inline ipv6_address operator""_ipv6 () noexcept
 User-defined literal for creating an ipv6_address from a fixed string at compile time.
 
template<fixed_string FixedString>
consteval inline ipv6_network operator""_ipv6_net () noexcept
 User-defined literal operator for creating an ipv6_network object from a string literal.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator+ (T lower, const uint128_t &value) noexcept
 Performs addition between an integer and a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator- (T lower, const uint128_t &value) noexcept
 Performs subtraction of a uint128_t value from an integer.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator* (T lower, const uint128_t &value) noexcept
 Performs multiplication between an integer and a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator/ (T lower, const uint128_t &value) noexcept
 Performs division of an integer by a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator% (T lower, const uint128_t &value) noexcept
 Calculates the remainder of division of an integer by a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator& (T lower, const uint128_t &value) noexcept
 Performs bitwise AND operation between an integer and a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator| (T lower, const uint128_t &value) noexcept
 Performs bitwise OR operation between an integer and a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
constexpr inline uint128_t operator^ (T lower, const uint128_t &value) noexcept
 Performs bitwise XOR operation between an integer and a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator== (T lower, const uint128_t &other) noexcept
 Checks if an integer value is equal to a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator!= (T lower, const uint128_t &other) noexcept
 Checks if an integer value is not equal to a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator< (T lower, const uint128_t &other) noexcept
 Compares if an integer value is less than a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator> (T lower, const uint128_t &other) noexcept
 Compares if an integer value is greater than a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator<= (T lower, const uint128_t &other) noexcept
 Compares if an integer value is less than or equal to a uint128_t value.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator>= (T lower, const uint128_t &other) noexcept
 Compares if an integer value is greater than or equal to a uint128_t value.
 

Detailed Description

Namespace dedicated to IP addresses and networks operations.

This namespace contains all the classes, functions, and utilities necessary for handling both IPv4 and IPv6 addresses and networks. It provides a comprehensive suite of tools for various operations such as parsing, constructing, and manipulating IP addresses and networks.

Typedef Documentation

◆ ipv6_address

Alias for the base class specialized for IPv6 address manipulation.

This alias provides a convenient shorthand for the specialized ip_address_base class tailored for IPv6 address handling. It inherits all functionalities from the ipv6_address_base class, allowing for operations such as conversion, comparison, and property querying specific to IPv6 addresses.

◆ ipv4_address

Alias for the base class specialized for IPv4 address manipulation.

This alias provides a convenient shorthand for the specialized ip_address_base class tailored for IPv4 address handling. It inherits all functionalities from the ipv4_address_base class, allowing for operations such as conversion, comparison, and property querying specific to IPv4 addresses.

◆ ipv4_network

Alias for the specialized ip_network_base class for IPv4.

The ipv4_network is a convenient alias for the ip_network_base class specialized with ipv4_network_base. It allows users to work with IPv4 network addresses using a type that is specifically designed for IPv4, simplifying the interface and usage in code that deals with IPv4 networks.

◆ ipv6_network

Alias for the specialized ip_network_base class for IPv6.

The ipv6_network is a convenient alias for the ip_network_base class specialized with ipv6_network_base. It allows users to work with IPv6 network addresses using a type that is specifically designed for IPv6, simplifying the interface and usage in code that deals with IPv6 networks.

Enumeration Type Documentation

◆ error_code

enum class error_code
strong

Enumeration of error codes for IP address parsing and validation.

This enumeration defines a set of error codes used to represent various error conditions that can occur during the parsing and validation of IP addresses. These error codes are used to provide detailed feedback about the nature of the error encountered, allowing for more precise error handling and troubleshooting.

The error codes are divided into several categories:

  • General errors related to the overall format and structure of the IP address.
  • IPv4-specific errors that address the unique syntactical requirements of IPv4 addresses.
  • IPv6-specific errors that address the unique syntactical requirements of IPv6 addresses.
  • Logical errors that represent inconsistencies or invalid operations in network calculations.

Each error code is accompanied by a brief comment explaining the specific error condition it represents.

Enumerator
no_error 

Indicates the absence of any errors.

empty_address 

The IP address string is empty when it should contain a valid address.

empty_netmask 

The netmask portion of the address is empty when it should specify a valid netmask.

invalid_netmask 

The provided netmask is not valid according to standard netmask formatting rules.

netmask_pattern_mixes_zeroes_and_ones 

The netmask contains an invalid pattern of zeroes and ones.

has_host_bits_set 

The address has host bits set when they are expected to be clear.

only_one_slash_permitted 

Only one slash character is permitted, used to separate the address from the netmask.

string_is_too_long 

Input string is too long.

unexpected_symbol 

The input string contains an unexpected character.

wrong_encoding_sequence 

Incorrect byte sequence in Unicode encoding.

empty_octet 

An octet in the IPv4 address is empty when it should contain a numeric value.

expected_4_octets 

The IPv4 address does not contain the expected four octets.

leading_0_are_not_permitted 

Leading zeroes are not permitted in any octet of the IPv4 address.

octet_more_3_characters 

An octet contains more than three characters, exceeding the maximum allowed.

octet_has_invalid_symbol 

An octet contains characters other than digits, which are invalid.

octet_exceeded_255 

An octet's value exceeds the maximum allowed value of 255.

least_3_parts 

The IPv6 address contains fewer than the minimum required parts.

most_8_colons_permitted 

The IPv6 address contains more than the maximum allowed number of colons.

part_is_more_4_chars 

A part of the IPv6 address contains more than four characters.

part_has_invalid_symbol 

A part of the IPv6 address contains invalid characters.

most_one_double_colon_permitted 

More than one double colon is present in the IPv6 address.

leading_colon_only_permitted_as_part_of_double_colon 

A leading colon is only permitted as part of a double colon.

trailing_colon_only_permitted_as_part_of_double_colon 

A trailing colon is only permitted as part of a double colon.

expected_at_most_7_other_parts_with_double_colon 

With a double colon present, at most seven other parts are expected.

exactly_8_parts_expected_without_double_colon 

Without a double colon, exactly eight parts are expected.

scope_id_is_too_long 

The scope ID in the IPv6 address exceeds the maximum length.

invalid_scope_id 

The scope ID in the IPv6 address is invalid.

If for some reason you need to add whitespace support to the scope id, add the following definition IPADDRESS_SCOPE_ID_SUPPORT_SPACES

invalid_version 

The IP address version does not match the expected version.

invalid_prefixlen_diff 

The difference in prefix length is invalid for the operation being performed.

new_prefix_must_be_shorter 

The new prefix length must be shorter for the operation being performed.

new_prefix_must_be_longer 

The new prefix length must be longer for the operation being performed.

cannot_set_prefixlen_diff_and_new_prefix 

Both prefix length difference and new prefix cannot be set simultaneously.

not_contained_network 

The network is not a subnet of the other network as expected.

last_address_must_be_greater_than_first 

The last IP address in the range must be greater than the first IP address.

◆ ip_version

enum class ip_version
strong

Enumerates the IP address versions.

Defines constants representing the two versions of Internet Protocol: IPv4 and IPv6.

Enumerator
V4 

IPv4 version identifier.

V6 

IPv6 version identifier.

◆ format

enum class format
strong

Enumerates the formatting options for IP address strings.

Defines the formatting styles that can be applied when converting IP addresses to strings, such as full, compact, or compressed representations.

Enumerator
full 

Full format with no compression or omission.

compact 

Compact format with possible omission of leading zeros.

compressed 

Compressed format with maximal omission of segments or octets.

Function Documentation

◆ operator==() [1/4]

template<size_t N>
inline bool operator== ( const byte_array< N > & lhs,
const byte_array< N > & rhs )
nodiscardnoexcept

Checks if two byte_array objects are equal.

Compares two byte_array objects of the same size element-wise to determine if they are equal.

Template Parameters
NThe size of the byte array.
Parameters
[in]lhsA reference to the left-hand side byte_array object.
[in]rhsA reference to the right-hand side byte_array object.
Returns
A boolean value indicating whether the two byte_array objects are equal.
Return values
truethe two byte_array objects are equal
falsethe two byte_array objects are not equal

◆ operator!=() [1/4]

template<size_t N>
inline bool operator!= ( const byte_array< N > & lhs,
const byte_array< N > & rhs )
nodiscardnoexcept

Checks if two byte_array objects are not equal.

Compares two byte_array objects of the same size element-wise to determine if they are not equal.

Template Parameters
NThe size of the byte array.
Parameters
[in]lhsA reference to the left-hand side byte_array object.
[in]rhsA reference to the right-hand side byte_array object.
Returns
A boolean value indicating whether the two byte_array objects are not equal.
Return values
truethe two byte_array objects are not equal
falsethe two byte_array objects are equal

◆ operator<() [1/4]

template<size_t N>
inline bool operator< ( const byte_array< N > & lhs,
const byte_array< N > & rhs )
nodiscardnoexcept

Determines if one byte_array is less than another.

Performs a lexicographical comparison of two byte_array objects. The comparison is done element-wise and stops at the first unequal pair where the left-hand side is less than the right-hand side.

Template Parameters
NThe size of the byte arrays.
Parameters
[in]lhsA reference to the left-hand side byte_array object.
[in]rhsA reference to the right-hand side byte_array object.
Returns
true if lhs is lexicographically less than rhs, false otherwise.

◆ operator>() [1/4]

template<size_t N>
inline bool operator> ( const byte_array< N > & lhs,
const byte_array< N > & rhs )
nodiscardnoexcept

Determines if one byte_array is greater than another.

Template Parameters
NThe size of the byte arrays.
Parameters
[in]lhsA reference to the left-hand side byte_array object.
[in]rhsA reference to the right-hand side byte_array object.
Returns
true if lhs is lexicographically greater than rhs, false otherwise.

◆ operator<=() [1/4]

template<size_t N>
inline bool operator<= ( const byte_array< N > & lhs,
const byte_array< N > & rhs )
nodiscardnoexcept

Determines if one byte_array is less than or equal to another.

Template Parameters
NThe size of the byte arrays.
Parameters
[in]lhsA reference to the left-hand side byte_array object.
[in]rhsA reference to the right-hand side byte_array object.
Returns
true if lhs is lexicographically less than or equal to rhs, false otherwise.

◆ operator>=() [1/4]

template<size_t N>
inline bool operator>= ( const byte_array< N > & lhs,
const byte_array< N > & rhs )
nodiscardnoexcept

Determines if one byte_array is greater than or equal to another.

Template Parameters
NThe size of the byte arrays.
Parameters
[in]lhsA reference to the left-hand side byte_array object.
[in]rhsA reference to the right-hand side byte_array object.
Returns
true if lhs is lexicographically greater than or equal to rhs, false otherwise.

◆ is_little_endian()

inline bool is_little_endian ( )
nodiscardnoexcept

Checks if the system is little-endian.

Returns
true if the system is little-endian, false otherwise.

◆ swap_bytes()

inline uint32_t swap_bytes ( uint32_t value)
nodiscardnoexcept

Swaps the bytes of a 32-bit unsigned integer.

Parameters
[in]valueThe integer value to swap bytes of.
Returns
The value with its bytes swapped.

◆ raise_error()

template<typename T >
inline void raise_error ( error_code code,
uint32_t value,
const T * address,
size_t length )

Raises an error with a specific error code and additional context.

This function constructs an error message based on the provided error code, value, and address, then throws a parse_error or a logic_error exception with the constructed message.

Template Parameters
TThe character type of the address string.
Parameters
[in]codeThe error code indicating the type of error encountered.
[in]valueThe value at which the error occurred, if applicable.
[in]addressA pointer to the beginning of the address string.
[in]lengthThe length of the address string.
Exceptions
parse_errorThrown with a message corresponding to the error code.
logic_errorThrown with a message corresponding to the error code.
Note
This function is marked [[noreturn]] as it always throws an exception.

◆ operator==() [2/4]

template<size_t N1, size_t N2>
inline bool operator== ( const fixed_string< N1 > & lhs,
const fixed_string< N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed strings for equality.

Checks if the contents of lhs and rhs are equal, meaning they have the same number of elements and each element in lhs compares equal with the element in rhs at the same position.

Template Parameters
N1The maximum number of characters of lhs.
N2The maximum number of characters of rhs.
Parameters
[in]lhsThe fixed string whose contents to compare.
[in]rhsThe fixed string whose contents to compare.
Returns
true if the contents of the strings are equal, false otherwise.

◆ operator!=() [2/4]

template<size_t N1, size_t N2>
inline bool operator!= ( const fixed_string< N1 > & lhs,
const fixed_string< N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed strings for inequality.

Checks if the contents of lhs and rhs are not equal, meaning they do not have the same number of elements or there is at least one position at which the elements in lhs and rhs differ.

Template Parameters
N1The maximum number of characters of lhs.
N2The maximum number of characters of rhs.
Parameters
[in]lhsThe fixed string whose contents to compare.
[in]rhsThe fixed string whose contents to compare.
Returns
true if the contents of the strings are not equal, false otherwise.

◆ operator<() [2/4]

template<size_t N1, size_t N2>
inline bool operator< ( const fixed_string< N1 > & lhs,
const fixed_string< N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed strings lexicographically.

Checks if the contents of lhs are lexicographically less than the contents of rhs.

Template Parameters
N1The maximum number of characters of lhs.
N2The maximum number of characters of rhs.
Parameters
[in]lhsThe fixed string whose contents to compare.
[in]rhsThe fixed string whose contents to compare.
Returns
true if the contents of lhs are lexicographically less than the contents of rhs, false otherwise.

◆ operator>() [2/4]

template<size_t N1, size_t N2>
inline bool operator> ( const fixed_string< N1 > & lhs,
const fixed_string< N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed strings for greater than relation.

Determines if the contents of lhs are lexicographically greater than the contents of rhs.

Template Parameters
N1The maximum number of characters of lhs.
N2The maximum number of characters of rhs.
Parameters
[in]lhsThe fixed string whose contents to compare.
[in]rhsThe fixed string whose contents to compare.
Returns
true if lhs is lexicographically greater than rhs, false otherwise.

◆ operator<=() [2/4]

template<size_t N1, size_t N2>
inline bool operator<= ( const fixed_string< N1 > & lhs,
const fixed_string< N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed strings for less than or equal relation.

Determines if the contents of lhs are lexicographically less than or equal to the contents of rhs.

Template Parameters
N1The maximum number of characters of lhs.
N2The maximum number of characters of rhs.
Parameters
[in]lhsThe fixed string whose contents to compare.
[in]rhsThe fixed string whose contents to compare.
Returns
true if lhs is lexicographically less than or equal to rhs, false otherwise.

◆ operator>=() [2/4]

template<size_t N1, size_t N2>
inline bool operator>= ( const fixed_string< N1 > & lhs,
const fixed_string< N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed strings for greater than or equal relation.

Determines if the contents of lhs are lexicographically greater than or equal to the contents of rhs.

Template Parameters
N1The maximum number of characters of lhs.
N2The maximum number of characters of rhs.
Parameters
[in]lhsThe fixed string whose contents to compare.
[in]rhsThe fixed string whose contents to compare.
Returns
true if lhs is lexicographically greater than or equal to rhs, false otherwise.

◆ make_fixed_string() [1/2]

template<typename T , size_t N>
inline fixed_string< N - 1 > make_fixed_string ( const T(&) data[N])
nodiscardnoexcept

Creates a fixed-length string from a character array.

Constructs a fixed_string object from a character array, deducing the size automatically.

Template Parameters
TThe character type of the input array.
NThe size of the character array plus one for the null terminator.
Parameters
[in]dataThe character array to initialize the fixed_string with.
Returns
A fixed_string object of size N-1.

◆ make_fixed_string() [2/2]

template<typename T , size_t N>
inline fixed_string< N - 1 > make_fixed_string ( const T(&) data[N],
error_code & code )
nodiscardnoexcept

Creates a fixed-length string from a character array.

Constructs a fixed_string object from a character array, deducing the size automatically.

Template Parameters
TThe character type of the input array.
NThe size of the character array plus one for the null terminator.
Parameters
[in]dataThe character array to initialize the fixed_string with.
[out]codeA reference to an error_code object that will be set if an error occurs during parsing.
Returns
A fixed_string object of size N-1.

◆ operator==() [3/4]

template<typename T , size_t N1, size_t N2>
inline bool operator== ( const fixed_vector< T, N1 > & lhs,
const fixed_vector< T, N2 > & rhs )
nodiscardnoexcept

Compares two fixed_vector objects for equality.

Checks if the contents of lhs and rhs are equal, meaning they have the same number of elements and each element in lhs compares equal with the element in rhs at the same position.

Template Parameters
TThe type of the elements in the vector.
N1The size of the first vector.
N2The size of the second vector.
Parameters
[in]lhsThe first vector to compare.
[in]rhsThe second vector to compare.
Returns
true if the vectors are equal; otherwise, false.

◆ operator!=() [3/4]

template<typename T , size_t N1, size_t N2>
inline bool operator!= ( const fixed_vector< T, N1 > & lhs,
const fixed_vector< T, N2 > & rhs )
nodiscardnoexcept

Compares two fixed_vector objects for inequality.

Checks if the contents of lhs and rhs are not equal, meaning they do not have the same number of elements or there is at least one position at which the elements in lhs and rhs differ.

Template Parameters
TThe type of the elements in the vector.
N1The size of the first vector.
N2The size of the second vector.
Parameters
[in]lhsThe first vector to compare.
[in]rhsThe second vector to compare.
Returns
true if the vectors are not equal; otherwise, false.

◆ operator<() [3/4]

template<typename T , size_t N1, size_t N2>
inline bool operator< ( const fixed_vector< T, N1 > & lhs,
const fixed_vector< T, N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed vector lexicographically.

Checks if the contents of lhs are lexicographically less than the contents of rhs.

Template Parameters
TThe type of the elements in the vector.
N1The size of the first vector.
N2The size of the second vector.
Parameters
[in]lhsThe first vector to compare.
[in]rhsThe second vector to compare.
Returns
true if lhs is lexicographically less than rhs; otherwise, false.

◆ operator>() [3/4]

template<typename T , size_t N1, size_t N2>
inline bool operator> ( const fixed_vector< T, N1 > & lhs,
const fixed_vector< T, N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed vector lexicographically.

Checks if the contents of lhs are lexicographically greater than the contents of rhs.

Template Parameters
TThe type of the elements in the vector.
N1The size of the first vector.
N2The size of the second vector.
Parameters
[in]lhsThe first vector to compare.
[in]rhsThe second vector to compare.
Returns
true if lhs is lexicographically greater than rhs; otherwise, false.

◆ operator<=() [3/4]

template<typename T , size_t N1, size_t N2>
inline bool operator<= ( const fixed_vector< T, N1 > & lhs,
const fixed_vector< T, N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed vector lexicographically.

Checks if the contents of lhs are lexicographically less than or equal to the contents of rhs.

Template Parameters
TThe type of the elements in the vector.
N1The size of the first vector.
N2The size of the second vector.
Parameters
[in]lhsThe first vector to compare.
[in]rhsThe second vector to compare.
Returns
true if lhs is lexicographically less than or equal to rhs; otherwise, false.

◆ operator>=() [3/4]

template<typename T , size_t N1, size_t N2>
inline bool operator>= ( const fixed_vector< T, N1 > & lhs,
const fixed_vector< T, N2 > & rhs )
nodiscardnoexcept

Compares the contents of two fixed vector lexicographically.

Checks if the contents of lhs are lexicographically greater than or equal to the contents of rhs.

Template Parameters
TThe type of the elements in the vector.
N1The size of the first vector.
N2The size of the second vector.
Parameters
[in]lhsThe first vector to compare.
[in]rhsThe second vector to compare.
Returns
true if lhs is lexicographically greater than or equal to rhs; otherwise, false.

◆ operator""_ip()

template<fixed_string FixedString>
inline ip_address operator""_ip ( )
nodiscardnoexcept

User-defined literal for creating an ip_address from a fixed string at compile time.

Template Parameters
FixedStringA compile-time fixed string representing the IPv6 address.
Returns
An ip_address object parsed from the fixed string.

◆ operator""_net()

template<fixed_string FixedString>
inline ip_network operator""_net ( )
nodiscardnoexcept

User-defined literal operator for creating an ip_network object from a string literal.

This operator allows the creation of ip_network objects using a string literal with the _net suffix.

Template Parameters
FixedStringA string literal representing the IP network.
Returns
An ip_network object representing the network specified by the string literal.

◆ summarize_address_range() [1/2]

template<typename FirstIp , typename LastIp >
inline auto summarize_address_range ( const FirstIp & first,
const LastIp & last,
error_code & code ) -> decltype(internal::summarize_address_range( typename internal::ip_address_type<FirstIp, LastIp>::type{first}, typename internal::ip_address_type<FirstIp, LastIp>::type{last}, code))
nodiscardnoexcept

Summarizes an IP address range into the smallest set of contiguous network blocks.

This function is designed specifically for iterating over the minimal number of contiguous network blocks that fully cover a given IP address range. By summarizing the range, it reduces redundancy and enhances efficiency, making it ideal for scenarios like routing table generation or network optimization tasks.

Example:

error_code code{};
auto summarized = summarize_address_range(
ipv6_address::parse("2001:db8::1"),
ipv6_address::parse("2001:db8::8"),
code
);
if (code == error_code::no_error) {
for (const auto& net : summarized) {
std::cout << net << std::endl;
}
}
// out:
// 2001:db8::1/128
// 2001:db8::2/127
// 2001:db8::4/126
// 2001:db8::8/128
// When working with ip_address, you can also use ipv4_address or ipv6_address as one of the arguments.
// In this case, this address will be interpreted as ip_address, and iteration will occur for ip_network
// summarize_address_range(ipv6_address::parse("2001:db8::1"), ip_address::parse("2001:db8::8"), code); // OK
static consteval inline ip_address_base< ipv6_address_base > parse() noexcept
Definition ip-address-base.hpp:123
constexpr inline auto summarize_address_range(const FirstIp &first, const LastIp &last, error_code &code) noexcept -> decltype(internal::summarize_address_range(typename internal::ip_address_type< FirstIp, LastIp >::type{first}, typename internal::ip_address_type< FirstIp, LastIp >::type{last}, code))
Summarizes an IP address range into the smallest set of contiguous network blocks.
Definition ip-functions.hpp:409
error_code
Enumeration of error codes for IP address parsing and validation.
Definition errors.hpp:52
@ no_error
Indicates the absence of any errors.
Template Parameters
FirstIpThe type representing an IP address.
LastIpThe type representing an IP address.
Parameters
[in]firstThe starting IP address of the range.
[in]lastThe ending IP address of the range.
[out]codeA reference to an error_code object that will be set if the operation is not possible.
Returns
A container of summarized network blocks.
Note
This function performs an efficient summarization of IP ranges, but the computational complexity may depend on the size of the range.

◆ summarize_address_range() [2/2]

template<typename FirstIp , typename LastIp >
inline auto summarize_address_range ( const FirstIp & first,
const LastIp & last ) -> decltype(summarize_address_range(first, last, *std::declval<error_code*>()))
nodiscard

Summarizes an IP address range into the smallest set of contiguous network blocks.

This function is designed specifically for iterating over the minimal number of contiguous network blocks that fully cover a given IP address range. By summarizing the range, it reduces redundancy and enhances efficiency, making it ideal for scenarios like routing table generation or network optimization tasks.

Example:

for (const auto& net : summarize_address_range(ipv4_address::parse("192.0.2.0"), ipv4_address::parse("192.0.2.130"))) {
std::cout << net << std::endl;
}
// out:
// 192.0.2.0/25
// 192.0.2.128/31
// 192.0.2.130/32
// When working with ip_address, you can also use ipv4_address or ipv6_address as one of the arguments.
// In this case, this address will be interpreted as ip_address, and iteration will occur for ip_network
// summarize_address_range(ipv4_address::parse("192.0.2.0"), ip_address::parse("192.0.2.130")); // OK
Template Parameters
FirstIpThe type representing an IP address.
LastIpThe type representing an IP address.
Parameters
[in]firstThe starting IP address of the range.
[in]lastThe ending IP address of the range.
Returns
A container of summarized network blocks.
Exceptions
logic_errorThrown with a message corresponding to the error code.
Note
This function performs an efficient summarization of IP ranges, but the computational complexity may depend on the size of the range.

◆ collapse_addresses() [1/8]

template<typename Net , size_t N>
inline fixed_vector< Net, N > collapse_addresses ( const std::array< Net, N > & nets,
error_code & code )
nodiscardnoexcept

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

consteval ipv4_network get_last_collapsed() {
constexpr std::array nets = {
ipv4_network::parse("192.0.2.0/25"),
ipv4_network::parse("192.0.2.128/25")
};
error_code code{};
constexpr auto collapsed = collapse_addresses(nets, code);
return code == error_code::no_error ? collapsed.back() : ipv4_network{};
}
int main() {
constexpr auto net = get_last_collapsed();
std::cout << net << std::endl;
// out:
// 192.0.2.0/24
return 0;
}
static consteval ip_network_base parse() noexcept
Definition ip-network-base.hpp:65
constexpr inline fixed_vector< Net, N > collapse_addresses(const std::array< Net, N > &nets, error_code &code) noexcept
Collapses a collection of IP networks into the smallest set of contiguous networks.
Definition ip-functions.hpp:498
ip_network_base< ipv4_network_base > ipv4_network
Alias for the specialized ip_network_base class for IPv4.
Definition ipv4-network.hpp:50
Template Parameters
NetThe type of the IP network.
NThe number of networks in the collection.
Parameters
[in]netsThe collection of IP networks to be collapsed.
[out]codeA reference to an error_code object that will be set if the operation is not possible.
Returns
A container of collapsed networks.

◆ collapse_addresses() [2/8]

template<typename Net , size_t N>
inline fixed_vector< Net, N > collapse_addresses ( const Net(&) nets[N],
error_code & code )
nodiscardnoexcept

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

consteval ip_network get_last_collapsed() {
constexpr ip_network nets[] = {
ip_network::parse("192.0.2.0/25"),
ip_network::parse("192.0.2.128/25")
};
error_code code{};
constexpr auto collapsed = collapse_addresses(nets, code);
return code == error_code::no_error ? collapsed.back() : ip_network{};
}
int main() {
constexpr auto net = get_last_collapsed();
std::cout << net << std::endl;
// out:
// 192.0.2.0/24
return 0;
}
A class that encapsulates both IPv4 and IPv6 network functionalities.
Definition ip-any-network.hpp:67
static consteval inline ip_network parse() noexcept
Parses a network address and prefix from a fixed string at compile time.
Definition ip-any-network.hpp:867
Template Parameters
NetThe type of the IP network.
NThe number of networks in the collection.
Parameters
[in]netsThe collection of IP networks to be collapsed.
[out]codeA reference to an error_code object that will be set if the operation is not possible.
Returns
A container of collapsed networks.

◆ collapse_addresses() [3/8]

template<typename... Nets, typename std::enable_if< internal::is_ip_network_types< Nets... >::value, bool >::type = true>
inline auto collapse_addresses ( error_code & code,
const Nets &... nets ) -> fixed_vector<typename internal::ip_network_type_extract<Nets...>::type, sizeof...(Nets)>
nodiscardnoexcept

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

consteval ip_network get_last_collapsed() {
error_code code{};
auto collapsed = collapse_addresses(
code,
ipv4_network::parse("192.0.2.0/25"),
ip_network::parse("192.0.2.128/25"),
ip_network::parse("192.0.2.255/32"),
ip_network::parse("192.0.2.255/32"));
return code == error_code::no_error ? collapsed.back() : ip_network{};
}
int main() {
constexpr auto net = get_collapsed_net();
std::cout << net << std::endl;
// out:
// 192.0.2.0/24
return 0;
}
Template Parameters
NetsThe types of the IP networks.
Parameters
[out]codeA reference to an error_code object that will be set if the operation is not possible.
[in]netsThe collection of IP networks to be collapsed.
Returns
A container of collapsed networks.

◆ collapse_addresses() [4/8]

template<typename It >
inline auto collapse_addresses ( It first,
It last,
error_code & code ) -> std::vector<typename std::iterator_traits<It>::value_type>
nodiscardnoexcept

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

std::vector<ip_network> nets = {
ip_network::parse("2001:db8::1/128"),
ip_network::parse("2001:db8::2/128"),
ip_network::parse("2001:db8::3/128"),
ip_network::parse("2001:db8::5/128") };
error_code code{};
const auto collapsed = collapse_addresses(nets.begin(), nets.end(), code);
if (code == error_code::no_error) {
for (const auto& net : collapsed) {
std::cout << net << std::endl;
}
}
// out:
// 2001:db8::1/128
// 2001:db8::2/127
// 2001:db8::5/128
Template Parameters
ItThe type of the iterator.
Parameters
[in]firstThe beginning of the range of IP networks to be collapsed.
[in]lastThe end of the range of IP networks to be collapsed.
[out]codeA reference to an error_code object that will be set if the operation is not possible.
Returns
A container of collapsed networks.

◆ collapse_addresses() [5/8]

template<typename Net , size_t N>
inline fixed_vector< Net, N > collapse_addresses ( const std::array< Net, N > & nets)
nodiscard

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

constexpr std::array<ipv4_network, 2> nets = {
ipv4_network::parse("192.0.2.0/25"),
ipv4_network::parse("192.0.2.128/25")
};
constexpr auto collapsed = collapse_addresses(nets);
for (const auto& net : collapsed) {
std::cout << net << std::endl;
}
// out:
// 192.0.2.0/24
Template Parameters
NetThe type of the IP network.
NThe number of networks in the collection.
Parameters
[in]netsThe collection of IP networks to be collapsed.
Returns
A container of collapsed networks.
Exceptions
logic_errorThrown with a message corresponding to the error code.

◆ collapse_addresses() [6/8]

template<typename Net , size_t N>
inline fixed_vector< Net, N > collapse_addresses ( const Net(&) nets[N])
nodiscard

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

constexpr ip_network nets[] = {
ip_network::parse("192.0.2.0/25"),
ip_network::parse("192.0.2.128/25")
};
constexpr auto collapsed = collapse_addresses(nets);
for (const auto& net : collapsed) {
std::cout << net << std::endl;
}
// out:
// 192.0.2.0/24
Template Parameters
NetThe type of the IP network.
NThe number of networks in the collection.
Parameters
[in]netsThe collection of IP networks to be collapsed.
Returns
A container of collapsed networks.
Exceptions
logic_errorThrown with a message corresponding to the error code.

◆ collapse_addresses() [7/8]

template<typename... Nets, typename std::enable_if< internal::is_ip_network_types< Nets... >::value, bool >::type = true>
inline auto collapse_addresses ( const Nets &... nets) -> fixed_vector<typename internal::ip_network_type_extract<Nets...>::type, sizeof...(Nets)>
nodiscard

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

constexpr auto collapsed = collapse_addresses(
ip_network::parse("192.0.2.255/32"),
ipv4_network::parse("192.0.2.0/25"),
ipv4_network::parse("192.0.2.128/25"));
for (const auto& net : collapsed) {
std::cout << net << std::endl;
}
// out:
// 192.0.2.0/24
Template Parameters
NetsThe types of the IP networks.
Parameters
[in]netsThe collection of IP networks to be collapsed.
Returns
A container of collapsed networks.
Exceptions
logic_errorThrown with a message corresponding to the error code.

◆ collapse_addresses() [8/8]

template<typename It >
inline auto collapse_addresses ( It first,
It last ) -> std::vector<typename std::iterator_traits<It>::value_type>
nodiscard

Collapses a collection of IP networks into the smallest set of contiguous networks.

This function is designed to take a collection of IP networks and reduce them into the smallest number of contiguous networks. This is useful for optimizing routing tables or enhancing network efficiency.

Example:

std::vector<ip_network> nets = {
ip_network::parse("2001:db8::1/128"),
ip_network::parse("2001:db8::2/128"),
ip_network::parse("2001:db8::3/128"),
ip_network::parse("2001:db8::5/128") };
const auto collapsed = collapse_addresses(nets.begin(), nets.end());
for (const auto& net : collapsed) {
std::cout << net << std::endl;
}
// out:
// 2001:db8::1/128
// 2001:db8::2/127
// 2001:db8::5/128
Template Parameters
ItThe type of the iterator.
Parameters
[in]firstThe beginning of the range of IP networks to be collapsed.
[in]lastThe end of the range of IP networks to be collapsed.
Returns
A container of collapsed networks.
Exceptions
logic_errorThrown with a message corresponding to the error code.

◆ operator""_ipv4() [1/2]

template<fixed_string FixedString>
inline ipv4_address operator""_ipv4 ( )
nodiscardnoexcept

User-defined literal for creating an ipv4_address from a fixed string at compile time.

Template Parameters
FixedStringA compile-time fixed string representing the IPv4 address.
Returns
An ipv4_address object parsed from the fixed string.

◆ operator""_ipv4() [2/2]

inline ipv4_address operator""_ipv4 ( unsigned long long value)
nodiscardnoexcept

User-defined literal for creating an ipv4_address from an unsigned long long integer at compile time.

Parameters
[in]valueAn unsigned long long integer representing the IPv4 address in host byte order.
Returns
An ipv4_address object created from the integer.

◆ operator""_ipv4_net()

template<fixed_string FixedString>
inline ipv4_network operator""_ipv4_net ( )
nodiscardnoexcept

User-defined literal operator for creating an ipv4_network object from a string literal.

This operator allows the creation of ipv4_network objects using a string literal with the _ipv4_net suffix.

Template Parameters
FixedStringA string literal representing the IPv4 network.
Returns
An ipv4_network object representing the network specified by the string literal.

◆ operator""_ipv6()

template<fixed_string FixedString>
inline ipv6_address operator""_ipv6 ( )
nodiscardnoexcept

User-defined literal for creating an ipv6_address from a fixed string at compile time.

Template Parameters
FixedStringA compile-time fixed string representing the IPv6 address.
Returns
An ipv6_address object parsed from the fixed string.

◆ operator""_ipv6_net()

template<fixed_string FixedString>
inline ipv6_network operator""_ipv6_net ( )
nodiscardnoexcept

User-defined literal operator for creating an ipv6_network object from a string literal.

This operator allows the creation of ipv6_network objects using a string literal with the _ipv6_net suffix.

Template Parameters
FixedStringA string literal representing the IPv6 network.
Returns
An ipv6_network object representing the network specified by the string literal.

◆ operator+()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator+ ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs addition between an integer and a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value to be added.
[in]valueThe uint128_t value to be added.
Returns
uint128_t the result of the addition.

◆ operator-()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator- ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs subtraction of a uint128_t value from an integer.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value from which the uint128_t value is subtracted.
[in]valueThe uint128_t value to be subtracted.
Returns
uint128_t the result of the subtraction.

◆ operator*()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator* ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs multiplication between an integer and a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value to be multiplied.
[in]valueThe uint128_t value to be multiplied.
Returns
uint128_t the result of the multiplication.

◆ operator/()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator/ ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs division of an integer by a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value to be divided.
[in]valueThe uint128_t value that divides the integer.
Returns
uint128_t the result of the division.

◆ operator%()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator% ( T lower,
const uint128_t & value )
nodiscardnoexcept

Calculates the remainder of division of an integer by a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value to be divided.
[in]valueThe uint128_t value that divides the integer.
Returns
uint128_t the remainder of the division.

◆ operator&()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator& ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs bitwise AND operation between an integer and a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value.
[in]valueThe uint128_t value.
Returns
uint128_t the result of the bitwise AND operation.

◆ operator|()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator| ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs bitwise OR operation between an integer and a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value.
[in]valueThe uint128_t value.
Returns
uint128_t the result of the bitwise OR operation.

◆ operator^()

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
inline uint128_t operator^ ( T lower,
const uint128_t & value )
nodiscardnoexcept

Performs bitwise XOR operation between an integer and a uint128_t value.

Template Parameters
TInteger type.
Parameters
[in]lowerThe integer value.
[in]valueThe uint128_t value.
Returns
uint128_t the result of the bitwise XOR operation.

◆ operator==() [4/4]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
inline bool operator== ( T lower,
const uint128_t & other )
nodiscardnoexcept

Checks if an integer value is equal to a uint128_t value.

Template Parameters
TIntegral type.
Parameters
[in]lowerThe integer value to compare.
[in]otherThe uint128_t value to compare.
Returns
true if the integer value is equal to the uint128_t value, false otherwise.

◆ operator!=() [4/4]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
inline bool operator!= ( T lower,
const uint128_t & other )
nodiscardnoexcept

Checks if an integer value is not equal to a uint128_t value.

Template Parameters
TIntegral type.
Parameters
[in]lowerThe integer value to compare.
[in]otherThe uint128_t value to compare.
Returns
true if the integer value is not equal to the uint128_t value, false otherwise.

◆ operator<() [4/4]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
inline bool operator< ( T lower,
const uint128_t & other )
nodiscardnoexcept

Compares if an integer value is less than a uint128_t value.

This function template overloads the less than operator (<) to compare an integer of type T with a uint128_t value. It checks if the integer value is lexicographically less than the uint128_t value.

Template Parameters
TAn integral type parameter that is checked at compile-time to ensure it is an integer type.
Parameters
[in]lowerThe integer value of type T to be compared.
[in]otherThe uint128_t value to compare against.
Returns
true if lower is less than other, false otherwise.

◆ operator>() [4/4]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
inline bool operator> ( T lower,
const uint128_t & other )
nodiscardnoexcept

Compares if an integer value is greater than a uint128_t value.

This function template overloads the greater than operator (>) to compare an integer of type T with a uint128_t value. It checks if the integer value is lexicographically greater than the uint128_t value.

Template Parameters
TAn integral type parameter that is checked at compile-time to ensure it is an integer type.
Parameters
[in]lowerThe integer value of type T to be compared.
[in]otherThe uint128_t value to compare against.
Returns
true if lower is greater than other, false otherwise.

◆ operator<=() [4/4]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
inline bool operator<= ( T lower,
const uint128_t & other )
nodiscardnoexcept

Compares if an integer value is less than or equal to a uint128_t value.

This function template overloads the less than or equal to operator (<=) to compare an integer of type T with a uint128_t value. It checks if the integer value is lexicographically less than or equal to the uint128_t value.

Template Parameters
TAn integral type parameter that is checked at compile-time to ensure it is an integer type.
Parameters
[in]lowerThe integer value of type T to be compared.
[in]otherThe uint128_t value to compare against.
Returns
true if lower is less than or equal to other, false otherwise.

◆ operator>=() [4/4]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
inline bool operator>= ( T lower,
const uint128_t & other )
nodiscardnoexcept

Compares if an integer value is greater than or equal to a uint128_t value.

This function template overloads the greater than or equal to operator (>=) to compare an integer of type T with a uint128_t value. It checks if the integer value is lexicographically greater than or equal to the uint128_t value.

Template Parameters
TAn integral type parameter that is checked at compile-time to ensure it is an integer type.
Parameters
[in]lowerThe integer value of type T to be compared.
[in]otherThe uint128_t value to compare against.
Returns
true if lower is greater than or equal to other, false otherwise.