Boost logo

Boost :

From: Nicola Musatti (Nicola.Musatti_at_[hidden])
Date: 2006-06-26 03:17:39


Hallo,
The following code gives an error with g++ 4.1:

#include <boost/bind.hpp>
#include <boost/signal.hpp>

struct connection
{
     boost::signal<void()> disc_sig;
};

struct statement
{
     statement(connection & c);

     void disconnect() {}
};

statement::statement(connection & c)
{
   c.disc_sig.connect(boost::bind(&statement::disconnect, this));
}

The error message is:
D:/src/boost/boost/bind.hpp: In function 'void boost::visit_each(V&,
const boost::_bi::value<T>&, int) [with V =
boost::signals::detail::bound_objects_visitor, T = statement*]':
D:/src/boost/boost/bind.hpp:239: instantiated from 'void
boost::_bi::list1<A1>::accept(V&) const [with V =
boost::signals::detail::bound_objects_visitor, A1 =
boost::_bi::value<statement*>]'
D:/src/boost/boost/bind/bind_template.hpp:150: instantiated from 'void
boost::_bi::bind_t<R, F, L>::accept(V&) const [with V =
boost::signals::detail::bound_objects_visitor, R = void, F =
boost::_mfi::mf0<void, statement>, L =
boost::_bi::list1<boost::_bi::value<statement*> >]'
D:/src/boost/boost/bind.hpp:1213: instantiated from 'void
boost::visit_each(V&, const boost::_bi::bind_t<R, F, L>&, int) [with V =
boost::signals::detail::bound_objects_visitor, R = void, F =
boost::_mfi::mf0<void, statement>, L =
boost::_bi::list1<boost::_bi::value<statement*> >]'
D:/src/boost/boost/visit_each.hpp:25: instantiated from 'void
boost::visit_each(Visitor&, const T&) [with Visitor =
boost::signals::detail::bound_objects_visitor, T =
boost::_bi::bind_t<void, boost::_mfi::mf0<void, statement>,
boost::_bi::list1<boost::_bi::value<statement*> > >]'
D:/src/boost/boost/signals/slot.hpp:121: instantiated from
'boost::slot<SlotFunction>::slot(const F&) [with F =
boost::_bi::bind_t<void, boost::_mfi::mf0<void, statement>,
boost::_bi::list1<boost::_bi::value<statement*> > >, SlotFunction =
boost::function<void ()(), std::allocator<void> >]'
boost_signals.cpp:18: instantiated from here
D:/src/boost/boost/bind.hpp:1208: error: no matching function for call
to 'visit_each(boost::signals::detail::bound_objects_visitor&,
statement* const&, int)'

I tried this both on Fedora Core 5 and Windows/Cygwin. My command line
is just:
g++-4.1.0 -c boost_signals.cpp -ID:/src/boost

Cheers,
Nicola Musatti


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk