Thread
:
Getting last element from vector
View Single Post
xpi0t0s
Mentor
13May2009,16:26
you need back(), not end(). end() returns an iterator that points to the next "free" slot.
http://www.cplusplus.com/reference/stl/vector/back/
(found by plugging "c++ vector" into Google, so not a complex query. TFM is always worth an R.)