mpl for_each: stop applying functor when runtime predicate is true

18 Feb
2010
18 Feb
'10
10:39 p.m.
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,
5484
Age (days ago)
5484
Last active (days ago)
0 comments
1 participants
participants (1)
-
Hicham Mouline