|
Boost Users : |
Subject: [Boost-users] [signals2] Connect to overloaded slots
From: Florian Lindner (mailinglists_at_[hidden])
Date: 2017-11-10 12:54:34
Hello,
this code compiles just fine:
#include <boost/signals2.hpp>
#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<void(int)> 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<void (int), boost::signals2::optional_last_value<void>, int,
std::less<int>, boost::function<void (int)>, boost::function<void (const boost::signals2::connection &, int)>,
boost::signals2::mutex>::slot_type' (aka 'const slot<void (int), boost::function<void (int)> >') 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?
Thanks,
Florian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net