std::find
and other similar functions return the Iterator to the found element. If the element is not found in the container, the returned Iterator points to the end of the specified range (which in your case is std::end
). So, find(a.begin(), a.end(), s-i) == a.end()
means that element s-i
is not in the container a
.
6
solved what is the use of == a.end() in find() c++ stl in if conditional?