Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Class trackable

boost::signals::trackable — Enables safe use of multicast callbacks.

Synopsis

class trackable {
public:
  // construct/copy/destruct
  trackable();
  trackable(const trackable&);
  trackable& operator=(const trackable&);
  ~trackable();
};

Description

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/destruct

  1. trackable();

    Effects:

    Sets the list of connected slots to empty.

    Throws:

    Will not throw.

  2. 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.

  3. trackable& operator=(const trackable& other);

    Effects:

    Sets the list of connected slots to empty.

    Returns:

    *this

    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.

  4. ~trackable();

    Effects:

    Disconnects all signal/slot connections that contain a pointer or reference to this trackable object that can be found by visit_each.


PrevUpHomeNext