Re:Appending to an std:string character-by-character: how do...
by kadoban on Thursday October 26, 2023 @07:45PM
(#38033092)
Woops, thanks. Not sure how I missed that.
Re:Appending to an std:string character-by-character: how do...
by AnimalMuppet on Thursday October 26, 2023 @10:17PM
(#38033941)
Yeah. It was only on page 797! How could you miss that?
;-)
Table 76 (page 797-798 of the C++20 draft [0]; page numbers read 789-790) specifies the sequence operations on containers that shall take amortized constant time. Among these includes push_back() for basic_string.
[0] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/n48...
This was also the case in the C++11 draft, and quite possibly before then as well. (I don't have a copy of the C++03 spec handy)