Boost logo

Boost Users :

Subject: Re: [Boost-users] break and return statement in lambda expression
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-07-22 07:45:00


On Thu, Jul 22, 2010 at 5:36 AM, Conoscenza Silente
<abruzzoforteegentile_at_[hidden]> wrote:
> Hi All
> I created a lambda expression inside my std::for_each call.
> Inside it there is code like this one, but I have building error telling me
> that
>
> error: expected primary-expression before ‘break’
> error: expected `]' before ‘break’
>
> Do you know what it is and how to fix it?
> The same applies to return statement
> Thanks
> AFG
>
> namespace bl = boost::lambda;
> int a, b;
> bl::var_type< int >::type a_( bl::var( a ) );
> bl::var_type< int >::type b_( bl::var( b ) );
>
> std::for_each( v.begin(), v.end(), (
> if_(  a_ > _b_ )
> [
> std::cout << _1,
>  break
> ]
> ));

'break' is not a lazy command, hence it will not work there. What are
you even trying to do anyway?


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