#include <vector> #include <iostream> int main() { std::vector<int> v{1, 2, 3}; v.pop_back(); std::cout << v.size() << " "; std::cout << v.back() << " "; } Output: 2 2