From a08d5370f8d7ee4ee9e0de46ca35200e9679a69a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 1 Jun 2019 14:54:38 -0700 Subject: [PATCH] ircd::net::ipport: Add convenience conversion to ipaddr. --- include/ircd/net/ipport.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/ircd/net/ipport.h b/include/ircd/net/ipport.h index c1d348561..1648cd566 100644 --- a/include/ircd/net/ipport.h +++ b/include/ircd/net/ipport.h @@ -55,6 +55,9 @@ struct ircd::net::ipport explicit operator bool() const; bool operator!() const { return !static_cast(*this); } + explicit operator const ipaddr &() const; + explicit operator ipaddr &(); + template ipport(iparg&&, const uint16_t &port); template ipport(iparg&&, const string_view &port); ipport(const string_view &amalgam); @@ -111,6 +114,19 @@ ircd::net::ipport::ipport(iparg&& arg, } {} +inline ircd::net::ipport::operator +ipaddr &() +{ + return this->first; +} + +inline ircd::net::ipport::operator +const ipaddr &() +const +{ + return this->first; +} + inline ircd::net::ipport::operator bool() const