I need a signals/slots c++ library with one specific feature that the signals automatically disconnect the slot when the object with the slot is destroyed.
Boost::signals2 offers this feature only for object created with boost::shared_ptr and I want to keep using std::shared_ptr everywhere. There is an option to make it work with std::shared_ptr but it requires writing some specialized templates and there is no info how it should like and generally I'd prefer to avoid it (unless there is the code somewhere in the internet, but I couldn't find it).
I know that Qt signals have this feature, but well Qt is too big to use it in every project.
According to Boost documentation (checked in 1.48.0), the necessary template specialisations for std::shared_ptr
and std::weak_ptr
already exist in Boost, so std
smart pointers should be usable out of the box with signals2 (via slot::track_foreign
).