namespace ste {
template<typename In, typename Out, typename Pred>
Out copy_if(In first, In last, Out res, Pred p)
{
while (first != last)
{
if (p(*first)) *res++ = *first;
++first;
}
return res;
}
}
It can be placed in file algorithm.hpp under directory .../ext/, whose parent may be added as an entry in included directories. As such, it may then be included as
#include <ext/algorithm.hpp>