std::find(first, last, value) returns an iterator to the first element that matches value in the range [first, last]. If there is no match, it returns last .
In particular, std :: find does not return a boolean value. To get the boolean value you are looking for, you need to compare the return value (without converting it to a boolean first!) Std :: find to last (i.e. if they are equal, no match is found).
source share