Boost logo

Boost Users :

Subject: Re: [Boost-users] lambda control structures
From: Archie14 (admin_at_[hidden])
Date: 2010-02-05 18:52:53


Nat Goodspeed <nat <at> lindenlab.com> writes:

>
> Archie14 wrote:
>
> > What I am trying to achieve is to stop for_each if "getParamValue" returns
> > false. However I can't find a way to use "return" in the second part of
> > boost::lambda::if_, so I am using a dummy var "a" to check it after the
loop
> > completes.
> >
> > My question is: what is the right way to use lambda control structure in
this
> > case?
>
> Maybe you want std::find_if instead of std::for_each?
>

Well, what I have to do is to iterate through each and every element of the
container and calculate validity of the element. If current element fails the
test I don't have to continue further. I don't think that std::find_if would
work in this case.

My question is more to how the control structure of "lambda" library works in
respect to "return" or "brake" in the cycle.


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