Boost logo

Boost :

From: Jeff Paquette (paquette_at_[hidden])
Date: 2001-01-09 17:01:07


Stroustrup's book said that it was accidentally dropped from the standard
and provides an implementation:

  // copy_if was dropped from the standard library by accident.
  template<typename In, typename Out, typename Pred>
  Out copy_if(In first, In last, Out res, Pred Pr)
  {
    while (first != last) {
      if (Pr(*first))
        *res++ = *first;
      ++first;
    }

    return res;
  }

--
Jeff Paquette
paquette at mediaone.net
http://www.atnetsend.net
> -----Original Message-----
> From: Dave Abrahams [mailto:abrahams_at_[hidden]]
> Sent: Tuesday, January 09, 2001 4:54 PM
> To: boost_at_[hidden]
> Subject: [boost] copy_if
>
>
> I just went through the SGI STL site looking for an algorithm fitting
> the following description:
>
>    Given a sequence s, a predicate p, and an output iterator r,
> copies the elements e of s for which p(e) is true to the range
> beginning with r.
>
> I was surprised not to find it. Have I missed something obvious? Time
> for boost/algorithm.hpp?
>
> -Dave
>
> P.S. yes, I know there are other obvious but missing algorithms.
>
>
>
>
>

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