Boost logo

Boost Users :

Subject: [Boost-users] mpl for_each: stop applying functor when runtime predicate is true
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-02-18 17:39:06


With a mpl sequence, applying a functor f with for_each on that sequence
applies f at runtime on every element of the sequence.

If I wish to stop applying f once I've found the element in the sequence
which satisfies some runtime predicate, how can I do that?

I'm thinking of putting a bool state in f, and turn it to false once I
decide not to apply anymore, and on invocations of, just do nothing when the
state is false.

Any better way of doing this?

Regards,


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