Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-03-14 17:20:02

"Caleb Epstein" <caleb.epstein_at_[hidden]> writes:

> I've recently wondered why std::copy doesn't have an analogous std::copy_if:
> template<class InIt, class OutIt, class Pr>
> OutIt *copy_if*(InIt first, InIt last, OutIt dest, Pr pred);
> that would copy elements to dest where the predicate returns true. Not
> unlike "grep" in Perl and "filter" in Python.
> The same goal can be achieved with std::remove_copy_if and the use of a
> sense-reversed predicate, but this leads to confusing code IMHO.
> Why wouldn't this be part of the Standard Library, or am I missing something
> ridiculously obvious?

This is the wrong forum for this question. Please take it to an
appropriate mailing list or newsgroup, such as c.l.c++.m

I don't see why anyone would knowingly start a thread with [off-topic]
in the subject line.

  Off-topic posts

  Discussions which stray from the acceptable topics are strongly
  discouraged. While off-topic posts are often well meaning and not as
  individually corrosive as other abuses, cumulatively the distraction
  damages the effectiveness of discussion.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at