libsigc++: track_obj()

libsigc++ 2.10.0

Classes | Functions
track_obj()
Adaptors

sigc::track_obj() tracks trackable objects, referenced from a functor. More...

## Classes
class | sigc::track_obj_functor1< T_functor, T_obj1 >
| track_obj_functor1 wraps a functor and stores a reference to a trackable object. More...
class | sigc::track_obj_functor2< T_functor, T_obj1, T_obj2 >
| track_obj_functor2 wraps a functor and stores 2 references to trackable objects. More...
class | sigc::track_obj_functor3< T_functor, T_obj1, T_obj2, T_obj3 >
| track_obj_functor3 wraps a functor and stores 3 references to trackable objects. More...
class | sigc::track_obj_functor4< T_functor, T_obj1, T_obj2, T_obj3, T_obj4 >
| track_obj_functor4 wraps a functor and stores 4 references to trackable objects. More...
class | sigc::track_obj_functor5< T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5 >
| track_obj_functor5 wraps a functor and stores 5 references to trackable objects. More...
class | sigc::track_obj_functor6< T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5, T_obj6 >
| track_obj_functor6 wraps a functor and stores 6 references to trackable objects. More...
class | sigc::track_obj_functor7< T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5, T_obj6, T_obj7 >
| track_obj_functor7 wraps a functor and stores 7 references to trackable objects. More...

## Functions
template<typename T_functor , typename T_obj1 >
track_obj_functor1< T_functor, T_obj1 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1)
| Creates an adaptor of type sigc::track_obj_functor1 which wraps a functor. More...
template<typename T_functor , typename T_obj1 , typename T_obj2 >
track_obj_functor2< T_functor, T_obj1, T_obj2 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1, const T_obj2& _A_obj2)
| Creates an adaptor of type sigc::track_obj_functor2 which wraps a functor. More...
template<typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 >
track_obj_functor3< T_functor, T_obj1, T_obj2, T_obj3 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1, const T_obj2& _A_obj2, const T_obj3& _A_obj3)
| Creates an adaptor of type sigc::track_obj_functor3 which wraps a functor. More...
template<typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 >
track_obj_functor4< T_functor, T_obj1, T_obj2, T_obj3, T_obj4 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1, const T_obj2& _A_obj2, const T_obj3& _A_obj3, const T_obj4& _A_obj4)
| Creates an adaptor of type sigc::track_obj_functor4 which wraps a functor. More...
template<typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 , typename T_obj5 >
track_obj_functor5< T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1, const T_obj2& _A_obj2, const T_obj3& _A_obj3, const T_obj4& _A_obj4, const T_obj5& _A_obj5)
| Creates an adaptor of type sigc::track_obj_functor5 which wraps a functor. More...
template<typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 , typename T_obj5 , typename T_obj6 >
track_obj_functor6< T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5, T_obj6 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1, const T_obj2& _A_obj2, const T_obj3& _A_obj3, const T_obj4& _A_obj4, const T_obj5& _A_obj5, const T_obj6& _A_obj6)
| Creates an adaptor of type sigc::track_obj_functor6 which wraps a functor. More...
template<typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 , typename T_obj5 , typename T_obj6 , typename T_obj7 >
track_obj_functor7< T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5, T_obj6, T_obj7 > | sigc::track_obj (const T_functor& _A_func, const T_obj1& _A_obj1, const T_obj2& _A_obj2, const T_obj3& _A_obj3, const T_obj4& _A_obj4, const T_obj5& _A_obj5, const T_obj6& _A_obj6, const T_obj7& _A_obj7)
| Creates an adaptor of type sigc::track_obj_functor7 which wraps a functor. More...

## Detailed Description

sigc::track_obj() tracks trackable objects, referenced from a functor.

It can be useful when you assign a C++11 lambda expression or a std::function<> to a slot, or connect it to a signal, and the lambda expression or std::function<> contains references to sigc::trackable derived objects.

The functor returned by sigc::track_obj() is formally an adaptor, but it does not alter the signature, return type or behaviour of the supplied functor. Up to 7 objects can be tracked. operator()() can have up to 7 arguments.

Example:
  struct bar : public sigc::trackable {};
  sigc::signal<void> some_signal;
  void foo(bar&);
  {
  bar some_bar;
  some_signal.connect([&some_bar](){ foo(some_bar); });
  // NOT disconnected automatically when some_bar goes out of scope
  some_signal.connect(sigc::track_obj([&some_bar](){ foo(some_bar); }, some_bar);
  // disconnected automatically when some_bar goes out of scope
  }

Since libsigc++ 2.4:

## Function Documentation

## § track_obj() [1/7]

template <typename T_functor , typename T_obj1 >

track_obj_functor1<T_functor, T_obj1> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor1 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4:

## § track_obj() [2/7]

template <typename T_functor , typename T_obj1 , typename T_obj2 >

track_obj_functor2<T_functor, T_obj1, T_obj2> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1,
|  | const T_obj2 & | _A_obj2
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor2 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.
  _A_obj2 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4:

## § track_obj() [3/7]

template <typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 >

track_obj_functor3<T_functor, T_obj1, T_obj2, T_obj3> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1,
|  | const T_obj2 & | _A_obj2,
|  | const T_obj3 & | _A_obj3
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor3 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.
  _A_obj2 | Trackable object.
  _A_obj3 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4:

## § track_obj() [4/7]

template <typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 >

track_obj_functor4<T_functor, T_obj1, T_obj2, T_obj3, T_obj4> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1,
|  | const T_obj2 & | _A_obj2,
|  | const T_obj3 & | _A_obj3,
|  | const T_obj4 & | _A_obj4
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor4 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.
  _A_obj2 | Trackable object.
  _A_obj3 | Trackable object.
  _A_obj4 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4:

## § track_obj() [5/7]

template <typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 , typename T_obj5 >

track_obj_functor5<T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1,
|  | const T_obj2 & | _A_obj2,
|  | const T_obj3 & | _A_obj3,
|  | const T_obj4 & | _A_obj4,
|  | const T_obj5 & | _A_obj5
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor5 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.
  _A_obj2 | Trackable object.
  _A_obj3 | Trackable object.
  _A_obj4 | Trackable object.
  _A_obj5 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4:

## § track_obj() [6/7]

template <typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 , typename T_obj5 , typename T_obj6 >

track_obj_functor6<T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5, T_obj6> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1,
|  | const T_obj2 & | _A_obj2,
|  | const T_obj3 & | _A_obj3,
|  | const T_obj4 & | _A_obj4,
|  | const T_obj5 & | _A_obj5,
|  | const T_obj6 & | _A_obj6
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor6 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.
  _A_obj2 | Trackable object.
  _A_obj3 | Trackable object.
  _A_obj4 | Trackable object.
  _A_obj5 | Trackable object.
  _A_obj6 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4:

## § track_obj() [7/7]

template <typename T_functor , typename T_obj1 , typename T_obj2 , typename T_obj3 , typename T_obj4 , typename T_obj5 , typename T_obj6 , typename T_obj7 >

track_obj_functor7<T_functor, T_obj1, T_obj2, T_obj3, T_obj4, T_obj5, T_obj6, T_obj7> sigc::track_obj | ( | const T_functor & | _A_func,
|  | const T_obj1 & | _A_obj1,
|  | const T_obj2 & | _A_obj2,
|  | const T_obj3 & | _A_obj3,
|  | const T_obj4 & | _A_obj4,
|  | const T_obj5 & | _A_obj5,
|  | const T_obj6 & | _A_obj6,
|  | const T_obj7 & | _A_obj7
| ) |  |
| inline

Creates an adaptor of type sigc::track_obj_functor7 which wraps a functor.

Parameters

  _A_func | Functor that shall be wrapped.
  _A_obj1 | Trackable object.
  _A_obj2 | Trackable object.
  _A_obj3 | Trackable object.
  _A_obj4 | Trackable object.
  _A_obj5 | Trackable object.
  _A_obj6 | Trackable object.
  _A_obj7 | Trackable object.

Returns
  Adaptor that executes _A_func() on invocation.

Since libsigc++ 2.4: