...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::signals2::slot — Pass slots as function arguments, and associate tracked objects with a slot.
// In header: <boost/signals2/slot.hpp> template<typename Signature, // Function type R (T1, T2, ..., TN) typename SlotFunction = function<Signature> > class slot : public slotN<R, T1, T2, ..., TN, SlotFunction> { public: // construct/copy/destruct template<typename F> slot(const F &); template<typename Func, typename Arg1, typename Arg2, ..., typename ArgN> slot(const Func &, const Arg1 &, const Arg2 &, ..., const ArgN &); };
Class template slot is a thin wrapper around the numbered class templates slot0, slot1, etc. It accepts a function type with N arguments instead of N separate arguments, and derives from the appropriate slotN instantiation.
All functionality of this class template is in its base class slotN.
slot
public
construct/copy/destructtemplate<typename F> slot(const F & f);
Effects: |
Passes argument to the base type slotN constructor. |
template<typename Func, typename Arg1, typename Arg2, ..., typename ArgN> slot(const Func & f, const Arg1 & a1, const Arg2 & a2, ..., const ArgN & aN);
Effects: |
Syntactic sugar for |