ipaddress 1.1.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  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_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  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  uint128_t
 Class for representing a 128-bit unsigned integer. More...
 

Typedefs

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_address = ip_address_base<ipv6_address_base>
 Alias for the base class specialized for IPv6 address manipulation.
 
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 ,
  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 ,
  unexpected_symbol ,
  wrong_encoding_sequence
}
 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<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<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

◆ 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_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.

◆ 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.

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.

unexpected_symbol 

The input string contains an unexpected character.

wrong_encoding_sequence 

Incorrect byte sequence in Unicode encoding.

◆ 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/3]

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.

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/3]

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.

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/3]

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.

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/3]

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 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/3]

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 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/3]

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.

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()

constexpr inline bool is_little_endian ( )
noexcept

Checks if the system is little-endian.

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

◆ swap_bytes()

constexpr inline uint32_t swap_bytes ( uint32_t value)
noexcept

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 >
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.

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/3]

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.

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/3]

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.

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/3]

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.

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/3]

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.

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/3]

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.

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/3]

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.

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>
constexpr inline fixed_string< N - 1 > make_fixed_string ( const T(&) data[N])
noexcept

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>
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.

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""_ip()

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 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>
consteval inline ip_network operator""_net ( )
noexcept

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.

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

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.

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]

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.

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>
consteval inline ipv4_network operator""_ipv4_net ( )
noexcept

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>
consteval inline ipv6_address operator""_ipv6 ( )
noexcept

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>
consteval inline ipv6_network operator""_ipv6_net ( )
noexcept

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>
constexpr inline uint128_t operator+ ( T lower,
const uint128_t & value )
noexcept

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>
constexpr inline uint128_t operator- ( T lower,
const uint128_t & value )
noexcept

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>
constexpr inline uint128_t operator* ( T lower,
const uint128_t & value )
noexcept

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>
constexpr inline uint128_t operator/ ( T lower,
const uint128_t & value )
noexcept

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>
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 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>
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 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>
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 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>
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 Parameters
TInteger type.
Parameters
[in]lowerThe integer value.
[in]valueThe uint128_t value.
Returns
uint128_t the result of the bitwise XOR operation.

◆ operator==() [3/3]

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 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!=() [3/3]

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 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<() [3/3]

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.

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>() [3/3]

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.

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<=() [3/3]

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.

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>=() [3/3]

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.

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.