[signals2] Connect to overloaded slots
Hello,
this code compiles just fine:
#include
Florian Lindner via Boost-users писал 2017-11-10 15:54:
Hello,
Hi,
this code compiles just fine:
#include
#include <iostream> // void slot() { std::cout << "No args slot called." << std::endl; } void slot(int i) { std::cout << "Int " << i << " arg slot called." << std::endl; }
int main(int argc, char **argv) { boost::signals2::signal
s; s.connect(&slot); return 0; }
However, when I uncomment the slot() function, it does not do so, anymore:
boostsignals.cpp:78:5: error: no matching member function for call to 'connect' s.connect(&slot); ~~^~~~~~~ /usr/include/boost/signals2/detail/signal_template.hpp:689:18: note: candidate function not viable: no overload of 'slot' matching 'const boost::signals2::signal
, boost::function , boost::signals2::mutex>::slot_type' (aka 'const slot >') for 1st argument connection connect(const slot_type &slot, connect_position position = at_back) ^ /usr/include/boost/signals2/detail/signal_template.hpp:693:18: note: candidate function not viable: requires at least 2 arguments, but 1 was provided connection connect(const group_type &group, ^ Is there a way to make it working with overloaded slot functions?
Because: https://stackoverflow.com/questions/14279874/how-to-use-static-cast-to-resov... -- Regards, niXman ___________________________________________________ Work for Bitcoins ___________________________________________________ Dual-target(32 & 64-bit) MinGW-W64 compilers for 32 and 64-bit Windows: https://sf.net/p/mingw-w64/
participants (2)
-
Florian Lindner
-
niXman