libsigc++  2.99.5
Modules | Classes | Functions
Functors

Functors are copyable types that define operator()(). More...

Modules

 Slots
 Slots are type-safe representations of callback methods and functions.
 
 mem_fun()
 mem_fun() Creates a functor from a pointer to a method.
 
 ptr_fun()
 ptr_fun() creates a functor from a pointer to a function.
 

Classes

struct  sigc::functor_trait< T_functor >
 Trait that specifies the appropriate functor type of any callable type. More...
 
struct  sigc::visitor< T_functor >
 sigc::visitor<T_functor>::do_visit_each() performs a functor on each of the targets of a functor. More...
 

Functions

template<class T_action , class T_functor >
void sigc::visit_each (const T_action& _A_action, const T_functor& _A_functor)
 This function performs a functor on each of the targets of a functor. More...
 
template<class T_type , class T_action , class T_functor >
void sigc::visit_each_type (const T_action& _A_action, const T_functor& _A_functor)
 This function performs a functor on each of the targets of a functor limited to a restricted type. More...
 

Detailed Description

Functors are copyable types that define operator()().

Types that define operator()() overloads with different return types are referred to as multi-type functors. Multi-type functors are only partially supported in libsigc++.

Closures are functors that store all information needed to invoke a callback from operator()().

Adaptors are functors that alter the signature of a functor's operator()().

libsigc++ defines numerous functors, closures and adaptors. Since libsigc++ is a callback library, most functors are also closures. The documentation doesn't distinguish between functors and closures.

The basic functor types libsigc++ provides are created with ptr_fun() and mem_fun() and can be converted into slots implicitly. The set of adaptors that ships with libsigc++ is documented in the Adaptors module.

Function Documentation

template <class T_action , class T_functor >
void sigc::visit_each ( const T_action &  _A_action,
const T_functor &  _A_functor 
)

This function performs a functor on each of the targets of a functor.

template <class T_type , class T_action , class T_functor >
void sigc::visit_each_type ( const T_action &  _A_action,
const T_functor &  _A_functor 
)

This function performs a functor on each of the targets of a functor limited to a restricted type.