C++ std::find_if用法
std::find_if
是 C++ 标准库中的一个算法函数,用于在指定范围内查找满足特定条件的元素,并返回第一个满足条件的元素的迭代器。它的声明位于 <algorithm>
头文件中。
函数原型如下:
template< class InputIt, class UnaryPredicate >
InputIt find_if( InputIt first, InputIt last, UnaryPredicate p );
参数解释:
first
和last
定义了查找范围,表示要在[first, last)
区间内查找。