vector<int> v; cout << v[v.size() - 1]; cout << *(v.end() - 1); cout << *v.rbegin(); // all three of them work