Блог пользователя vedant-z

Автор vedant-z, история, 18 месяцев назад, По-английски

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: no match for ‘operator==’ (operand types are ‘long int’ and ‘std::vector::iterator’)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится