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.)