c++ - How to use Boost.Signals2 connect_extended? -
i have working boost.signals2 signal & slot combination in c++ project & set so;
//declare signal signals2::signal<void (const en_data_stream, long, double, double, double, double, double)> signal; //connect dataupdate() of candidate instance signal.connect(bind(&candidate::dataupdate, candidateinstance, _1, _2, _3, _4, _5, _6, _7)); //fire signal signal(idatanumber, barnumber(), datetime(), open(), high(), low(), close()); i've been trying take further , use boost.signals2 connect_extended functionality i'd pass details of invoking signal slot slot may disconnect signal @ later time. syntax escaping me. please demonstrate how convert above code uses connect_extended pass connection information slot.
p.s. i've been looking @ example provided @ boost website still none wiser how tailor requirements parameters use bind.
boost.signals2 connect_extended example
thanks
the advantage of connect_extended allows slot receive connection object, may crucial in multi-threaded program, slot invocation might occur in thread before connect_extended returns. not need connect_extended pass other information, can bind directly. anyway, here how can connect_extended:
#include <boost/signals2.hpp> using namespace boost::signals2; void your_slot(connection conn, int, double, int, char) { } int main() { signal<void(int, double, int)> your_signal; your_signal.connect_extended(boost::bind(&your_slot, _1, _2, _3, _4, 'a')); your_signal(1, 2.0, 3); }
Comments
Post a Comment