Re: [boost] [Spirit-devel] [fusion] Short-circuited Exception-based View Iteration

Hi Joel! On 9/22/07, Joel de Guzman <joel@boost-consulting.com> wrote:
Tobias Schwinger wrote:
Reading the rest of your post, it seems you're basically looking for algorithms like these:
visit_if(sequence_reference,runtime_predicate,action) visit_where_first(sequence_reference,runtime_predicate,action)
Seems those are specializations of:
any(seq, f)
??
Description
For a sequence seq and unary function object f, any returns true if f returns true for at least one element of seq.
Almost... But 'any' will just return a boolean, but not which element in seq (or a view of which elements in seq) where f returns true. Perhaps 'filter' is what I'm looking for, but I'm just interested in the first one where a predicate holds true, so even a find_if(...) might suit my needs. I'll explore a bit more. BTW, i haven't found a `find_first_if(...)` implementation (like what the STL has) which works with a homogeneous tuple -- somehow that container might be a special case that deserves attention (?) -- which returns a single value? Thoughts on this? Maybe this will solve at least my problem... :D -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mikhailberis@gmail.com] [+63 928 7291459] [+1 408 4049523]
participants (1)
-
Dean Michael Berris