0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd::net::hostport: Add complementary boolean conversion.

This commit is contained in:
Jason Volk 2019-03-05 20:49:23 -08:00
parent 1f82b884ff
commit 9c62b0f61a

View file

@ -58,6 +58,7 @@ struct ircd::net::hostport
string_view service {canon_service};
uint16_t port {canon_port};
explicit operator bool() const;
bool operator!() const;
hostport(const string_view &host, const string_view &service, const uint16_t &port = canon_port);
@ -130,12 +131,20 @@ ircd::net::hostport::hostport(const string_view &amalgam)
}
}
inline
ircd::net::hostport::operator
bool()
const
{
static const hostport defaults{};
return net::host(*this) != net::host(defaults);
}
inline bool
ircd::net::hostport::operator!()
const
{
static const hostport defaults{};
return net::host(*this) == net::host(defaults);
return !bool(*this);
}
inline ircd::string_view &