diff options
author | Max Kellermann <max@musicpd.org> | 2018-10-30 20:43:52 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-10-30 20:43:52 +0100 |
commit | ce9f09c69a2bba8068c72fd4bdaf5a01fd08e15f (patch) | |
tree | 4238538c6bc51a09347d8465efb054b463fd1c5a /src/event | |
parent | 3ddc7a53538bf650e716e62f2206524d9fc9ecd7 (diff) |
event/ServerSocket: make AddAddress() a template
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/ServerSocket.cxx | 14 | ||||
-rw-r--r-- | src/event/ServerSocket.hxx | 4 |
2 files changed, 5 insertions, 13 deletions
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 25e1e81ba..d3abb124a 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -265,20 +265,12 @@ ServerSocket::Close() noexcept i.Close(); } +template<typename A> ServerSocket::OneServerSocket & -ServerSocket::AddAddress(SocketAddress address) noexcept +ServerSocket::AddAddress(A &&address) noexcept { sockets.emplace_back(loop, *this, next_serial, - address); - - return sockets.back(); -} - -ServerSocket::OneServerSocket & -ServerSocket::AddAddress(AllocatedSocketAddress &&address) noexcept -{ - sockets.emplace_back(loop, *this, next_serial, - std::move(address)); + std::forward<A>(address)); return sockets.back(); } diff --git a/src/event/ServerSocket.hxx b/src/event/ServerSocket.hxx index 8d8c2aaee..3cb0ad422 100644 --- a/src/event/ServerSocket.hxx +++ b/src/event/ServerSocket.hxx @@ -49,8 +49,8 @@ public: } private: - OneServerSocket &AddAddress(SocketAddress address) noexcept; - OneServerSocket &AddAddress(AllocatedSocketAddress &&address) noexcept; + template<typename A> + OneServerSocket &AddAddress(A &&address) noexcept; /** * Add a listener on a port on all IPv4 interfaces. |