libsigc++ 2.99.3

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

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

sigc::slot< T_return, T_arg > Class Template Reference
Functors » Slots

Converts an arbitrary functor to a unified type which is opaque. More...

`#include <sigc++/functors/slot.h>`

## Detailed Description

### template<class T_return, class... T_arg>
class sigc::slot< T_return, T_arg >

Converts an arbitrary functor to a unified type which is opaque.

sigc::slot itself is a functor or, to be more precise, a closure. It contains a single, arbitrary functor (or closure) that is executed in operator()().

The template arguments determine the function signature of operator()():

- T_return The return type of operator()().
- T_arg Argument types used in the definition of operator()().

For instance, to declare a slot that returns void and takes two parameters of bool and int:

sigc::slot<void(bool, int)> some_slot;

To use, simply assign the desired functor to the slot. If the functor is not compatible with the parameter list defined with the template arguments then compiler errors are triggered. When called, the slot will invoke the functor with minimal copies. block() and unblock() can be used to block the functor's invocation from operator()() temporarily.