libsigc++: sigc::adapts< T_functor > Struct Template Reference

# sigc::adapts< T_functor > Struct Template Reference
[Adaptors]

Base type for adaptors. More...

`#include <sigc++/adaptors/adaptor_trait.h>`

Inheritance diagram for sigc::adapts< T_functor >:
[legend]

List of all members.

## Public Types
typedef adaptor_trait < T_functor >::result_type | result_type
typedef adaptor_trait < T_functor >::adaptor_type | adaptor_type
## Public Member Functions
| adapts (const T_functor& _A_functor)
| Constructs an adaptor that wraps the passed functor.
## Public Attributes
adaptor_type | functor_
| Adaptor that is invoked from operator()().

## Detailed Description

### template <class T_functor>
struct sigc::adapts< T_functor >

Base type for adaptors.

adapts wraps adaptors, functors, function pointers and class methods. It contains a single member functor which is always a sigc::adaptor_base. The typedef adaptor_type defines the exact type that is used to store the adaptor, functor, function pointer or class method passed into the constructor. It differs from T_functor unless T_functor inherits from sigc::adaptor_base.

Example of a simple adaptor:

       template <T_functor>
         struct my_adpator : public sigc::adapts<T_functor>
         {
           template <class T_arg1=void, class T_arg2=void>
           struct deduce_result_type
           { typedef typename sigc::deduce_result_type<T_functor, T_arg1, T_arg2>::type type; };
           typedef typename sigc::functor_trait<T_functor>::result_type result_type;

           result_type
           operator()() const;

           template <class T_arg1>
           typename deduce_result_type<T_arg1>::type
           operator()(T_arg1 _A_arg1) const;

           template <class T_arg1, class T_arg2>
           typename deduce_result_type<T_arg1, T_arg2>::type
           operator()(T_arg1 _A_arg1, class T_arg2) const;

           explicit adaptor_functor(const T_functor& _A_functor) // Constructs a my_functor object that wraps the passed functor.
             : sigc::adapts<T_functor>(_A_functor) {}

           mutable T_functor functor_; // Functor that is invoked from operator()().
         };

## Constructor & Destructor Documentation

template <class T_functor>

sigc::adapts< T_functor >::adapts | ( | const T_functor & | _A_functor | ) | `[inline, explicit]`

Constructs an adaptor that wraps the passed functor.

Parameters:

  | _A_functor | Functor to invoke from operator()().