21 Internet protocol [internet]

21.4 Class ip::address [internet.address]

21.4.3 ip::address members [internet.address.members]

constexpr bool is_v4() const noexcept;

Returns: true if the object contains an IP version 4 address, otherwise false.

constexpr bool is_v6() const noexcept;

Returns: true if the object contains an IP version 6 address, otherwise false.

constexpr address_v4 to_v4() const;

Returns: v4_.

Remarks: bad_address_cast if is_v4() == false.

constexpr address_v6 to_v6() const;

Returns: v6_.

Remarks: bad_address_cast if is_v6() == false.

constexpr bool is_unspecified() const noexcept;

Returns: If is_v4(), returns v4_.is_unspecified(). Otherwise returns v6_.is_unspecified().

constexpr bool is_loopback() const noexcept;

Returns: If is_v4(), returns v4_.is_loopback(). Otherwise returns v6_.is_loopback().

constexpr bool is_multicast() const noexcept;

Returns: If is_v4(), returns v4_.is_multicast(). Otherwise returns v6_.is_multicast().

template<class Allocator = allocator<char>> basic_string<char, char_traits<char>, Allocator> to_string(const Allocator& a = Allocator()) const;

Returns: If is_v4(), returns v4_.to_string(a). Otherwise returns v6_.to_string(a).