If all the values in vector are less than or equal to M then "i" will point to v.end().
auto i = upper_bound(v.begin(), v.end(), M)- v.begin();
Now if I want to do certain action if "i" points to the end of vector, I tried
if(i == v.end()){ // Code }
But it doesn't work, throwing error error: no match for ‘operator==’ (operand types are ‘long int’ and ‘std::vector::iterator’)
Can someone tell me a way to achieve this....