template Iterator find_if(Iterator current, Iterator stop, Pred pre) { while (current != stop) { if (pred(*current)) return current; ++current; } return stop; } template void count_if(Iterator current, Iterator stop, Pred pred) { int count = 0; while (current != stop) { if (pred(*current)) ++count; ++current; } return count; } template void replace_if(Iterator current, Iterator stop, Pred pred, Value a) { while (current != stop) { if (pred(*current)) *current = a; ++current; } } template Iterator2 remove_copy_if(Iterator1 current, Iterator1 stop, Iterator2 to, Pred pred) { while (current != stop) { if (pred(*current)) { *to = *current; ++to; } ++current; } }