源码
template <class InputIterator, class UnaryPredicate>
std::find_if(InputIterator first, InputIterator last, UnaryPredicate pred)
{
while(first != last){
if(pred(*first)) return first;
++first;
}
return last;
}
找到第一个返回指针,找不到返回最后一个指针。