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)
29 ~CleanupHandler()
override {
36 void disconnect()
override {
48std::unique_ptr<Handler>
MakeHandler(boost::signals2::connection connection) {
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.