3 ms·
> Interestingly, the C++ standard doesn't specify a cost for this, or an implementation. Table 76 (page 797-798 of the C++20 draft [0]; page numbers read 789-7
by vitus 3y ago
> Interestingly, the C++ standard doesn't specify a cost for this, or an implementation.
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/n4849.pdf 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)
- kadoban 3y agoWoops, thanks. Not sure how I missed that.
- AnimalMuppet 3y agoYeah. It was only on page 797! How could you miss that? ;-)