Iterator-based find_first int* find_first(const int* begin, const int* end, bool pred(int)) { while (begin != end && !pred(*begin)) begin++; return begin; }