Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-09-23 09:39:33


Hi Joel!

On 9/22/07, Joel de Guzman <joel_at_[hidden]> 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_at_[hidden]]
[+63 928 7291459]
[+1 408 4049523]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk