mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
ircd::net::hostport: Add complementary boolean conversion.
This commit is contained in:
parent
1f82b884ff
commit
9c62b0f61a
1 changed files with 11 additions and 2 deletions
|
@ -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 &
|
||||
|
|
Loading…
Reference in a new issue