
----- Original Message ----- From: "Robert Jones" <robertgbjones@gmail.com> To: <boost@lists.boost.org> Sent: Monday, July 21, 2008 11:07 PM Subject: Re: [boost] [lambda] Writing pass-through 'standard' algorithms
On Mon, Jul 21, 2008 at 9:55 PM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
What exactly do not compiles? I have not founf ptr_fun on your function. If predicate is a predicate functor this should compile, isn't it? The following compiles:
<snip>
Sorry, I'm not explaining myself too well. Yes your example compiles, provided the predicate is an adaptable functor (typedefs argument_type). If the predicate is a raw function then the ptr_fun adaptor is required, but that will ONLY work for a raw pointer. My difficulty is in finding a direct solution that works for all cases.
Hi, all cases are a lot of cases. Please could you be more explicit on the cases you want to cover. Are you thinking on boost::function<bool(typename InputIterator::value_type)>. What about? template <typename InputIterator, typename Predicate > inline bool all_if(InputIterator first, InputIterator last, Predicate pred) { boost::function<bool(typename InputIterator::value_type)> predicate=pred; return std::find_if(first, last, std::not1( predicate ) ) == last; } Vicente