libsigc++: sigc::const_volatile_limit_reference< T_type, I_derives_trackable > Class Template Reference

libsigc++ 2.6.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

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

Public Member Functions | List of all members
sigc::const_volatile_limit_reference< T_type, I_derives_trackable > Class Template Reference

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

## Detailed Description

### template<class T_type, bool I_derives_trackable = std::is_base_of<trackable, T_type>::value>
class sigc::const_volatile_limit_reference< T_type, I_derives_trackable >

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.

- T_type The type of the reference.

## Constructor & Destructor Documentation

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

sigc::const_volatile_limit_reference< T_type, I_derives_trackable >::const_volatile_limit_reference | ( | const T_type & | _A_target | ) |
| inline

Constructor.

Parameters

  _A_target | The reference to limit.

## Member Function Documentation

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

const volatile T_type& sigc::const_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 = std::is_base_of<trackable, T_type>::value>

const T_type& sigc::const_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.