3 ms·
The vector is "valid" and that is what carries all the weight here. The vector is still a vector. push_back is absolutely defined. pop_back might be undefined,
by millstone 8y ago
The vector is "valid" and that is what carries all the weight here. The vector is still a vector.
push_back is absolutely defined. pop_back might be undefined, because pop_back is UB on an empty vector. If you like, call clear, and be assured of an empty, reusable vector. It's not idiomatic, but it's safe.