libsigc++: sigc::signal< T_return(T_arg...)> Class Template Reference

libsigc++ 3.2.0

Classes | Public Types | Public Member Functions | List of all 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>`

Inheritance diagram for sigc::signal< T_return(T_arg...)>:
[legend]

## Classes
class | accumulated
| Like sigc::signal but the additional template parameter T_accumulator defines the accumulator type that should be used. More...

## Public Types
using | accumulator_type = void
Public Types inherited from sigc::signal_with_accumulator< T_return, void, T_arg... >
using | slot_type = slot< T_return(T_arg...)>
Public Types inherited from sigc::signal_base
using | size_type = std::size_t

## Public Member Functions
| signal ()=default
| signal (const signal & src)
| signal (signal && src)
signal & | operator= (const signal & src)
signal & | operator= (signal && src)
Public Member Functions inherited from sigc::signal_with_accumulator< T_return, void, T_arg... >
| signal_with_accumulator ()=default
| signal_with_accumulator (const signal_with_accumulator & src)
| signal_with_accumulator (signal_with_accumulator && src)
connection | connect (const slot_type & slot_)
| Add a slot to the list of slots. More...
connection | connect (slot_type && slot_)
| Add a slot to the list of slots. More...
decltype(auto) | emit (type_trait_take_t< T_arg >... a) const
| Triggers the emission of the signal. More...
decltype(auto) | make_slot () const
| Creates a functor that calls emit() on this signal. More...
decltype(auto) | operator() (type_trait_take_t< T_arg >... a) const
| Triggers the emission of the signal (see emit()). More...
signal_with_accumulator & | operator= (const signal_with_accumulator & src)
signal_with_accumulator & | operator= (signal_with_accumulator && src)
Public Member Functions inherited from sigc::signal_base
| signal_base () noexcept
| signal_base (const signal_base & src) noexcept
| signal_base (signal_base && src)
| ~signal_base ()
void | block (bool should_block=true) noexcept
| Sets the blocking state of all slots in the list. More...
bool | blocked () const noexcept
| Returns whether all slots in the list are blocked. More...
void | clear ()
| Empties the list of slots. More...
bool | empty () const noexcept
| Returns whether the list of slots is empty. More...
signal_base & | operator= (const signal_base & src)
signal_base & | operator= (signal_base && src)
size_type | size () const noexcept
| Returns the number of slots in the list. More...
void | unblock () noexcept
| Unsets the blocking state of all slots in the list. More...

## Additional Inherited Members
Protected Types inherited from sigc::signal_base
using | iterator_type = internal::signal_impl::iterator_type
Protected Member Functions inherited from sigc::signal_base
iterator_type | connect (const slot_base & slot_)
| Adds a slot at the end of the list of slots. More...
iterator_type | connect (slot_base && slot_)
| Adds a slot at the end of the list of slots. More...
std::shared_ptr< internal::signal_impl > | impl () const
| Returns the signal_impl object encapsulating the list of slots. More...
iterator_type | insert (iterator_type i, const slot_base & slot_)
| Adds a slot at the given position into the list of slots. More...
iterator_type | insert (iterator_type i, slot_base && slot_)
| Adds a slot at the given position into the list of slots. More...
Protected Attributes inherited from sigc::signal_base
std::shared_ptr< internal::signal_impl > | impl_
| The signal_impl object encapsulating the slot list. More...

## 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);
  sigc::ptr_fun
  decltype(auto) ptr_fun(T_return(*func)(T_args...))
  Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
  Definition: ptr_fun.h:109

## Member Typedef Documentation

## ◆ accumulator_type

template <typename T_return , typename... T_arg>

using sigc::signal< T_return(T_arg...)>::accumulator_type = void

## Constructor & Destructor Documentation

## ◆ signal() [1/3]

template <typename T_return , typename... T_arg>

sigc::signal< T_return(T_arg...)>::signal | ( |  | ) |
| default

## ◆ signal() [2/3]

template <typename T_return , typename... T_arg>

sigc::signal< T_return(T_arg...)>::signal | ( | const signal< T_return(T_arg...)> & | src | ) |
| inline

## ◆ signal() [3/3]

template <typename T_return , typename... T_arg>

sigc::signal< T_return(T_arg...)>::signal | ( | signal< T_return(T_arg...)> && | src | ) |
| inline

## Member Function Documentation

## ◆ operator=() [1/2]

template <typename T_return , typename... T_arg>

signal & sigc::signal< T_return(T_arg...)>::operator= | ( | const signal< T_return(T_arg...)> & | src | ) |
| inline

## ◆ operator=() [2/2]

template <typename T_return , typename... T_arg>

signal & sigc::signal< T_return(T_arg...)>::operator= | ( | signal< T_return(T_arg...)> && | src | ) |
| inline