Strange error in C++

Правка en1, от fugazi, 2019-05-09 22:16:52

I am getting a very strange bug in my code for today's round problems B1, 2.

At a moment, I'm having a set of pairs.

[s]: {(1, 1), (1, 4), (1, 5), (1, 9), (1, 10), (2, 2), (2, 7)}

Then I'm accessing the last and second last element.

it = s.rbegin();  // prints *it = (2, 7)
it--; 
// prints *it = (1, 10)

But for some weird reason it jumps off (2, 2) and I'm unable to figure out why.

Any help will be appreciated.

Теги #c++, c++ error, strange, #help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский fugazi 2019-05-09 22:20:47 22 Tiny change: ' element. \n\n```\ni' -> ' element. (line 51-54 in mycode)\n\n```\ni'
en1 Английский fugazi 2019-05-09 22:16:52 498 Initial revision (published)