"Markus Pesti" <[EMAIL PROTECTED]> writes:

> I can't find any good documentation about boost::mpl::find_if. 

http://www.mywikinet.com/mpl/ref/Reference/find_if.html

> The syntax is different to that of std::find_if

that's because it's only an analogy.  mpl::find_if is not a function;
it's a metafunction which is evaluated entirely at compile-time.

> and std::find_if cannot be applied to lists of
> boost::shared_ptr's. 

Why do you say that?

> So I created my own find_if by modifying the std one.:
<snip>
> That works fine, but I don't know whether that is o.k. to do so. Or is there
> a better way?

For a better way, see the Boost.Lambda library.

Or you can use the indirect iterator adaptor from the boost sandbox 
(boost/iterator/iterator_adaptors.hpp)

bool find(const std::list<boost::shared_ptr<A> >& Alist, int v) {
 return std::::find_if(
        , make_indirect_iterator(Alist.begin())
        , make_indirect_iterator(Alist.end()) 
        A(v)) != Alist.end();
}


-- 
                       David Abrahams
   [EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to