Boost logo

Boost :

From: zaufi (zaufi_at_[hidden])
Date: 2004-08-27 05:56:10


Hi, everybody!

We've got a problem with a following code that does not compile:
--------------------------------------------------------------------------------------
#include <list>
#include <algorithm>
#include <boost/lambda/bind.hpp>

int main()
{
    using namespace boost::lambda;

    std::list<std::list<int> > l;
    bool some_are_empty = false;

    std::for_each(l.begin(), l.end(), var(some_are_empty) =
bind(&std::list<int>::empty, _1) || some_are_empty);

    return 0;
}
----------------------------------------------------------------------------------------
Compiler (gcc 3.4.1) gives the following errors:
----------------------------------------------------------------------------------------
lambda-problem.cc: In function `int main()':
lambda-problem.cc:13: error: no match for 'operator||' in
'boost::lambda::bind(const Arg1&, const Arg2&) [with Arg1 = bool
(std::list<int, std::allocator<int> >::*)() const, Arg2 =
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >](((const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >&)
(+boost::lambda::<unnamed>::_1))) || some_are_empty'
lambda-problem.cc:13: note: candidates are: operator||(bool, bool) <built-in>
--------------------------------------------------------------------------------------

Can anybody shed a light on what are we doing wrong in this example?


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