Boost logo

Boost Users :

Subject: Re: [Boost-users] Compilation error Boost lambda function (Boost 1.40)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-12-13 18:09:05


AMDG

Joost Kraaijeveld wrote:
> 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<unsigned long, ServerSession*> ServerSessions;
> ServerSessions serverSessions;
> ...
>
> ...
> typedef std::pair<unsigned long, ServerSession*> 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
>

You need to use boost::bind or boost::lambda::bind consistently.

In Christ,
Steven Watanabe


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