Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Class template slot

boost::signals2::slot — Pass slots as function arguments, and associate tracked objects with a slot.

Synopsis

// 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 &);
};

Description

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/destruct

  1. template<typename F> slot(const F & f);

    Effects:

    Passes argument to the base type slotN constructor.

  2. 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 bind() when the constructor is passed more than one argument. As if: slot(boost::bind(f, a1, a2, ..., aN))


PrevUpHomeNext