Hi,
What is wrong in my syntax in the std::for_each call (the BOOST_FOREACH works fine):
...
class Session
{
virtual void stopSession();
}
class ServerSession : public Sessoon
{
}
typedef std::map ServerSessions;
ServerSessions serverSessions;
...
...
typedef std::pair ServerSessionsIterator;
BOOST_FOREACH(ServerSessionsIterator session,serverSessions)
{
session.second->stopSession();
}
std::for_each( serverSessions.begin(),
serverSessions.end(),
boost::lambda::bind( &ServerSession::stopSession, // function
boost::bind(&ServerSessions::value_type::second, boost::lambda::_1))); // object
The actual error is:
make -k -j6 all
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I/home/jkr/Programming/C++/Dagda/library/DagdaCom -I../../include/Dagda/DagdaConfig -DDEVELOPMENT -DDANUEXE=1 -I/home/jkr/Programming/C++/Danu/include/Danu -DDAGDADLL=1 -I /home/jkr/Programming/C++/Dagda/library/../include/Dagda -pipe -Wall -Wextra -Wundef -Wshadow -Wconversion -I/usr/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -g -O2 -MT libdagdacom_la-Server.lo -MD -MP -MF .deps/libdagdacom_la-Server.Tpo -c -o libdagdacom_la-Server.lo `test -f 'Server.cpp' || echo '/home/jkr/Programming/C++/Dagda/library/DagdaCom/'`Server.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/home/jkr/Programming/C++/Dagda/library/DagdaCom -I../../include/Dagda/DagdaConfig -DDEVELOPMENT -DDANUEXE=1 -I/home/jkr/Programming/C++/Danu/include/Danu -DDAGDADLL=1 -I /home/jkr/Programming/C++/Dagda/library/../include/Dagda -pipe -Wall -Wextra -Wundef -Wshadow -Wconversion -I/usr/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -g -O2 -MT libdagdacom_la-Server.lo -MD -MP -MF .deps/libdagdacom_la-Server.Tpo -c /home/jkr/Programming/C++/Dagda/library/DagdaCom/Server.cpp -fPIC -DPIC -o .libs/libdagdacom_la-Server.o
/usr/include/boost/lambda/detail/actions.hpp: In static member function ‘static RET boost::lambda::function_action<2, T>::apply(A1&, A2&) [with RET = void, A1 = void (DagdaCom::Session::* const)(), A2 = const boost::_bi::bind_t >, boost::_bi::list1 > >, T = boost::lambda::detail::unspecified]’:
/usr/include/boost/lambda/detail/lambda_functor_base.hpp:418: instantiated from ‘RET boost::lambda::lambda_functor_base, Args>::call(A&, B&, C&, Env&) const [with RET = void, A = std::pair, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Act = boost::lambda::function_action<2, boost::lambda::detail::unspecified>, Args = boost::tuples::tuple >, boost::_bi::list1 > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>]’
/usr/include/boost/lambda/detail/lambda_functors.hpp:175: instantiated from ‘typename T::sig >::type boost::lambda::lambda_functor<Base>::operator()(A&) const [with A = std::pair, T = boost::lambda::lambda_functor_base >, boost::tuples::tuple >, boost::_bi::list1 > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >]’
/usr/include/c++/4.3/bits/stl_algo.h:3791: instantiated from ‘_Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = std::_Rb_tree_iterator >, _Funct = boost::lambda::lambda_functor >, boost::tuples::tuple >, boost::_bi::list1 > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >]’
/home/jkr/Programming/C++/Dagda/library/DagdaCom/Server.cpp:204: instantiated from here
/usr/include/boost/lambda/detail/actions.hpp:87: error: no matching function for call to ‘boost::lambda::function_adaptor::apply(void (DagdaCom::Session::* const&)(), const boost::_bi::bind_t >, boost::_bi::list1 > >&)’
/usr/include/boost/lambda/detail/actions.hpp:87: error: return-statement with a value, in function returning 'void'
make: *** [libdagdacom_la-Server.lo] Error 1
make: Target `all' not remade because of errors.
TIA
--
Groeten,
Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl