event/ServerSocket: make AddAddress() a template
This commit is contained in:
parent
3ddc7a5353
commit
ce9f09c69a
@ -265,20 +265,12 @@ ServerSocket::Close() noexcept
|
|||||||
i.Close();
|
i.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename A>
|
||||||
ServerSocket::OneServerSocket &
|
ServerSocket::OneServerSocket &
|
||||||
ServerSocket::AddAddress(SocketAddress address) noexcept
|
ServerSocket::AddAddress(A &&address) noexcept
|
||||||
{
|
{
|
||||||
sockets.emplace_back(loop, *this, next_serial,
|
sockets.emplace_back(loop, *this, next_serial,
|
||||||
address);
|
std::forward<A>(address));
|
||||||
|
|
||||||
return sockets.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerSocket::OneServerSocket &
|
|
||||||
ServerSocket::AddAddress(AllocatedSocketAddress &&address) noexcept
|
|
||||||
{
|
|
||||||
sockets.emplace_back(loop, *this, next_serial,
|
|
||||||
std::move(address));
|
|
||||||
|
|
||||||
return sockets.back();
|
return sockets.back();
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OneServerSocket &AddAddress(SocketAddress address) noexcept;
|
template<typename A>
|
||||||
OneServerSocket &AddAddress(AllocatedSocketAddress &&address) noexcept;
|
OneServerSocket &AddAddress(A &&address) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a listener on a port on all IPv4 interfaces.
|
* Add a listener on a port on all IPv4 interfaces.
|
||||||
|
Loading…
Reference in New Issue
Block a user