net/IPv4Address: add struct sockaddr_in constructor

This commit is contained in:
Max Kellermann 2018-08-20 15:53:06 +02:00
parent 234a6193bb
commit 9cb9154b08

View File

@ -126,11 +126,14 @@ class IPv4Address {
public: public:
IPv4Address() = default; IPv4Address() = default;
constexpr IPv4Address(const struct sockaddr_in &_address) noexcept
:address(_address) {}
/** /**
* @param port the port number in host byte order * @param port the port number in host byte order
*/ */
constexpr IPv4Address(struct in_addr _address, uint16_t port) noexcept constexpr IPv4Address(struct in_addr _address, uint16_t port) noexcept
:address(Construct(_address, port)) {} :IPv4Address(Construct(_address, port)) {}
/** /**
* @param port the port number in host byte order * @param port the port number in host byte order