On Jan 16, 10:20 pm, Leo jay <Python.Leo...@gmail.comwrote:
dear all,
i know i can use std::find to find specified value in an iterator
range,
i'd like to know is there any way to find the first value that not
equals to the specified value?
just like string::find_first_not_of,
or do i have to write a for loop and check manually?
thanks in advance.
std::find_if and std::not_equal_to should do nicely.
assuming a vector of char:
#include <vector>
#include <algorithm // find_if
#include <functional // bind1st, not_equal_to
int main()
{
...
std::vector<char>::const_iterator it
= std::find_if( vc.begin(),
vc.end(),
std::bind1st (std::not_equal_to<char>(),
'a') );
}