9#include <boost/signals2/connection.hpp>
15 class HandlerImpl :
public Handler {
17 explicit HandlerImpl(boost::signals2::connection
connection)
20 void disconnect()
override {
m_connection.disconnect(); }
25 class CleanupHandler :
public Handler {
27 explicit CleanupHandler(std::function<
void()> cleanup)
36 void disconnect()
override {
49 return std::make_unique<HandlerImpl>(std::move(
connection));
52std::unique_ptr<Handler>
MakeHandler(std::function<
void()> cleanup) {
53 return std::make_unique<CleanupHandler>(std::move(cleanup));
std::function< void()> m_cleanup
boost::signals2::scoped_connection m_connection
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
Implement std::hash so RCUPtr can be used as a key for maps or sets.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...