Subject: [Potential defect] std::vector::push_back reallocation wording
From: Florian Mayer (florian.mayer_at_[hidden])
Date: 2020-06-30 06:52:43
I noticed something while reading the standard.
The Remarks for push_back / emplace_back  in all the standards from
C++11 to the current draft say
> Remarks: Causes reallocation if the new size is greater than the old
Logically, this means 'size > capacity IMPLIES rellocation'. By ex falso
quodlibet, this means that rellocations can happen even if size <=
capacity, but it also means that a reallocation HAS to happen if size >
I am pretty sure that is not the intention, and it should say "Causes
reallocation *only* if the new size is greater than the old capacity."
Is that correct?
STD-DISCUSSION list run by herb.sutter at gmail.com
Older Archives on Google Groups