I'm looking in the C++ Standard (draft n3797), and I can't find any documentation of pop_back
as it applies to std::vector
, only for std::list
. Is it really missing?
Specifically I was looking for the guarantee that pop_back
doesn't change the capacity. Or is there such a guarantee at all? (I expect that iterators and references to other elements will remain valid, but I can't find that guarantee, and it wouldn't restrict the case of removing the last element, anyway)
No it doesn't missed. In a table in 101 §23.2.3, you can see pop_back
exists for vector
.
16 Table 101 lists operations that are provided for some types of sequence containers but not others. An implementation shall provide these operations for all container types shown in the “container” column, and shall implement them so as to take amortized constant time.
Paragraph 16 mentioned they should implement to take amortized constant time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With