From 7f83d38bcaaac7c366395ae3a10e04de5ca744c0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Aug 2017 12:40:58 +0200 Subject: [PATCH] net/StaticSocketAddress: add struct sockaddr cast operators --- src/net/StaticSocketAddress.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/StaticSocketAddress.hxx b/src/net/StaticSocketAddress.hxx index 2305379aa..74427c61e 100644 --- a/src/net/StaticSocketAddress.hxx +++ b/src/net/StaticSocketAddress.hxx @@ -56,6 +56,14 @@ public: size); } + operator struct sockaddr *() noexcept { + return reinterpret_cast(&address); + } + + operator const struct sockaddr *() const noexcept { + return reinterpret_cast(&address); + } + struct sockaddr *GetAddress() noexcept { return reinterpret_cast(&address); }