libsigc++
2.10.8
|
A const_volatile_limit_reference<Foo> object stores a reference (Foo&), but make sure that, if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the sigc::trackable reference instead of the derived reference. More...
#include <sigc++/limit_reference.h>
Public Member Functions | |
const_volatile_limit_reference (const T_type & _A_target) | |
Constructor. More... | |
const volatile T_type & | invoke () const |
Retrieve the reference. More... | |
const T_type & | visit () const |
Retrieve the entity to visit for visit_each(). More... | |
A const_volatile_limit_reference<Foo> object stores a reference (Foo&), but make sure that, if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the sigc::trackable reference instead of the derived reference.
This avoids use of a reference to the derived type when the derived destructor has run. That can be a problem when using virtual inheritance.
If Foo inherits from trackable then both the derived reference and the sigc::trackable reference are stored, so we can later retrieve the sigc::trackable reference without doing an implicit conversion. To retrieve the derived reference (so that you invoke methods or members of it), use invoke(). To retrieve the trackable reference (so that you can call visit_each() on it), you use visit().
If Foo does not inherit from sigc::trackable then invoke() and visit() just return the derived reference.
This is used for bound (sigc::bind) slot parameters (via bound_argument), bound return values, and, with mem_fun(), the reference to the handling object.
|
inline |
Constructor.
_A_target | The reference to limit. |
|
inline |
Retrieve the reference.
This is always a reference to the derived instance.
|
inline |
Retrieve the entity to visit for visit_each().
Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.