[signals] problem when disconnecting slots
Hello! I'm trying to use the boost signals library to implement a callback system, but my first test-application (see boost_test_app.cpp in attachment) won't compile. The connect method works as expected, but if I'm trying to disconnect my slot (in line 28: " mySignal.disconnect(slot);") a compiler error message appears. The error message: /path_to_boost/include/boost-1 _34_1/boost/boost/function_equal.hpp:17: error: no match for 'operator==' in 'f == g' /path_to_boost/include/boost-1_34_1/boost/function/function_base.hpp:577: note: candidates are: bool boost::operator==(const boost::function_base&, boost::detail::function::useless_clear_type*) /path_to_boost/include/boost-1_34_1/boost/function/function_base.hpp:589: note: bool boost::operator==(boost::detail::function::useless_clear_type*, const boost::function_base&) My compile command: g++ -I/path_to_boost/include/boost-1_34_1/ -g -o boost_test_app boost_test_app.cpp -L/path_to_boost/lib -lboost_signals-gcc41 I'm using boost 1.34.1 with g++ (GCC) 4.1.0 (SUSE Linux) as compiler. Best regards Raimar
On Tue, 15 Jan 2008 19:30:00 +0200, raimar wagner
Hello! I'm trying to use the boost signals library to implement a callback system, but my first test-application (see boost_test_app.cpp in attachment) won't compile. The connect method works as expected, but if I'm trying to disconnect my slot (in line 28: " mySignal.disconnect(slot);") a compiler error message appears.
The error message: /path_to_boost/include/boost-1 _34_1/boost/boost/function_equal.hpp:17: error: no match for 'operator==' in 'f == g' /path_to_boost/include/boost-1_34_1/boost/function/function_base.hpp:577: note: candidates are: bool boost::operator==(const boost::function_base&, boost::detail::function::useless_clear_type*) /path_to_boost/include/boost-1_34_1/boost/function/function_base.hpp:589: note: bool boost::operator==(boost::detail::function::useless_clear_type*, const boost::function_base&)
This reminds me of bug #1076 - see http://svn.boost.org/trac/boost/ticket/1076 (although that bug was reported for Visual Studio). Boris
AMDG Boris wrote:
On Tue, 15 Jan 2008 19:30:00 +0200, raimar wagner
wrote: Hello! I'm trying to use the boost signals library to implement a callback system, but my first test-application (see boost_test_app.cpp in attachment) won't compile. The connect method works as expected, but if I'm trying to disconnect my slot (in line 28: " mySignal.disconnect(slot);") a compiler error message appears.
This reminds me of bug #1076 - see http://svn.boost.org/trac/boost/ticket/1076 (although that bug was reported for Visual Studio).
It's somewhat different though in that there is no way to make this work correctly. Try making Button::unregisterCallback a template template<class T> void unregisterCallback(const T& slot) { mySignal.disconnect(slot); } In Christ, Steven Watanabe
participants (4)
-
Boris
-
raimar wagner
-
Raimar Wagner
-
Steven Watanabe