//: C05:copy_if.h // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // Roll your own STL-style algorithm #ifndef COPY_IF_H #define COPY_IF_H template OutputIter copy_if(ForwardIter begin, ForwardIter end, OutputIter dest, UnaryPred f) { while(begin != end) { if(f(*begin)) *dest++ = *begin; begin++; } return dest; } #endif // COPY_IF_H ///:~