21 Internet protocol [internet]

21.11 Class template ip::network_v4 [internet.network.v4]

21.11.4 ip::network_v4 creation [internet.network.v4.creation]

constexpr network_v4 make_network_v4(const address_v4& addr, int prefix_len);

Returns: network_v4(addr, prefix_len).

constexpr network_v4 make_network_v4(const address_v4& addr, const address_v4& mask);

Returns: network_v4(addr, mask).

network_v4 make_network_v4(const char* str); network_v4 make_network_v4(const char* str, error_code& ec) noexcept; network_v4 make_network_v4(const string& str); network_v4 make_network_v4(const string& str, error_code& ec) noexcept; network_v4 make_network_v4(string_view str); network_v4 make_network_v4(string_view str, error_code& ec) noexcept;

Returns: If str contains a value of the form address '/' prefix-length, a network_v4 object constructed with the result of applying make_address_v4() to the address portion of the string, and the result of converting prefix-length to an integer of type int. Otherwise returns network_v4() and sets ec to reflect the error.

Error conditions:

  • errc::invalid_argument — if str is not a valid textual representation of an IPv4 address and prefix length.