...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::signals::trackable — Enables safe use of multicast callbacks.
// In header: <boost/signals/trackable.hpp> class trackable { public: // construct/copy/destruct trackable(); trackable(const trackable&); trackable& operator=(const trackable&); ~trackable(); };
The trackable
class provides automatic
disconnection of signals and slots when objects bound in
slots (via pointer or reference) are destroyed. The
trackable
class may only be used as a public
base class for some other class; when used as such, that
class may be bound to function objects used as part of
slots. The manner in which a trackable
object
tracks the set of signal-slot connections it is a part of is
unspecified.
The actual use of trackable
is contingent
on the presence of appropriate
visit_each overloads for any
type that may contain pointers or references to trackable
objects.
trackable
public
construct/copy/destructtrackable();
Effects: |
Sets the list of connected slots to empty. |
Throws: |
Will not throw. |
trackable(const trackable& other);
Effects: |
Sets the list of connected slots to empty. |
Throws: |
Will not throw. |
Rationale: |
Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied. |
trackable& operator=(const trackable& other);
Effects: |
Sets the list of connected slots to empty. |
Returns: |
|
Throws: |
Will not throw. |
Rationale: |
Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied. |
~trackable();
Effects: |
Disconnects all signal/slot connections that contain a pointer or reference to this trackable object that can be found by visit_each. |