Boost logo

Boost Users :

From: Witz (witz_at_[hidden])
Date: 2003-09-13 05:52:12

You can find an implementation of copy_if in Boost Wiki here:

An extension that i find useful is the following:

template<class II, class OI, class PRED>
std::pair<II,OI> copy_if(II ibegin, II iend, OI obegin, OI oend, PRED p)
        for(; ibegin != iend; ++ibegin)
                        *obegin = *ibegin;
                        if(++obegin == oend)
        return std::make_pair(ibegin, obegin);

Here we have a finite sized sink. Items are copied from the source if they
satisfy the condition and if there is room left in the sink. The positions
reached are returned on termination of the algorithm.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at