![]() |
![]() |
Inheritance diagram for sigc::signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::accumulated< T_accumulator >:
Public Member Functions | |
accumulated () | |
accumulated (const accumulated& src) |
Like sigc::signal but the additional template parameter T_accumulator defines the accumulator type that should be used.
An accumulator is a functor that uses a pair of special iterators to step through a list of slots and calculate a return value from the results of the slot invokations. The iterators' operator*() executes the slot. The return value is buffered, so that in an expression like
a = (* i)* (* i);
result_type
.
struct arithmetic_mean_accumulator { typedef double result_type; template<typename T_iterator> result_type operator()(T_iterator first, T_iterator last) const { result_type value_ = 0; int n_ = 0; for (; first != last; ++first, ++n_) value_ += *first; return value_ / n_; } };
struct interruptable_accumulator { typedef bool result_type; template<typename T_iterator> result_type operator()(T_iterator first, T_iterator last) const { for (; first != last; ++first, ++n_) if (!*first) return false; return true; } };
sigc::signal<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::accumulated<T_accumulator>::accumulated | ( | ) | [inline] |
sigc::signal<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::accumulated<T_accumulator>::accumulated | ( | const accumulated<T_accumulator>& | src | ) | [inline] |