libsigc++: sigc::slot< T_return, T_arg > Class Template Reference

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

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

Detailed Description

template<typename T_return, typename... 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:

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.