accessing a vector from the back
Posted
by Faken
on Stack Overflow
See other posts from Stack Overflow
or by Faken
Published on 2010-06-16T21:12:08Z
Indexed on
2010/06/16
21:22 UTC
Read the original article
Hit count: 104
Is there a way to access an element on a vector starting from the back? I want to access the second last element.currently I'm using the following to achieve that:
myVector[myVector.size() - 2]
but this seems slow and clunky, is there a better way?
© Stack Overflow or respective owner