libsigc++ 2.2.11

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
sigc::volatile_limit_reference< T_type, I_derives_trackable > Class Template Reference

A 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>`

List of all members.

## Public Member Functions

| volatile_limit_reference (T_type& _A_target)
| Constructor.
const T_type& | visit () const
| Retrieve the entity to visit for visit_each().
volatile T_type& | invoke () const
| Retrieve the reference.

## Detailed Description

### template<class T_type, bool I_derives_trackable = is_base_and_derived<trackable, T_type>::value>
class sigc::volatile_limit_reference< T_type, I_derives_trackable >

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

- T_type The type of the reference.

## Constructor & Destructor Documentation

template <class T_type, bool I_derives_trackable = is_base_and_derived<trackable, T_type>::value>

sigc::volatile_limit_reference< T_type, I_derives_trackable >::volatile_limit_reference | ( | T_type & | _A_target | ) |

inline

Constructor.

Parameters:

  _A_target | The reference to limit.

## Member Function Documentation

template <class T_type, bool I_derives_trackable = is_base_and_derived<trackable, T_type>::value>

volatile T_type& sigc::volatile_limit_reference< T_type, I_derives_trackable >::invoke | ( |  | ) | const

inline

Retrieve the reference.

This is always a reference to the derived instance.

Returns:
  The reference.

template <class T_type, bool I_derives_trackable = is_base_and_derived<trackable, T_type>::value>

const T_type& sigc::volatile_limit_reference< T_type, I_derives_trackable >::visit | ( |  | ) | const

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.

Returns:
  The reference.