libsigc++ 2.99.6

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

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

sigc::signal< T_return, T_arg > Class Template Reference
Signals

signal can be used to connect() slots that are invoked during subsequent calls to emit(). More...

`#include <sigc++/signal.h>`

## Detailed Description

### template<typename T_return, typename... T_arg>
class sigc::signal< T_return, T_arg >

signal can be used to connect() slots that are invoked during subsequent calls to emit().

Any functor or slot can be passed into connect(). It is converted into a slot implicitly.

If you want to connect one signal to another, use make_slot() to retrieve a functor that emits the signal when invoked.

Be careful if you directly pass one signal into the connect() method of another: a shallow copy of the signal is made and the signal's slots are not disconnected until both the signal and its clone are destroyed, which is probably not what you want!

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

- T_return The desired return type of the emit() function. * - T_arg Argument types used in the definition of emit().

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

sigc::signal<void(bool, int)> some_signal;

To specify an accumulator type the nested class signal::accumulated can be used.

Example:
  void foo(int) {}
  sigc::signal<void, long> sig;
  sig.connect(sigc::ptr_fun(&foo));
  sig.emit(19);