why do STL containers use copying to populate in resize?
问题 all the STL containers that implement resize use copies to populate the new elements even if the source of the copy is a default constructed object? Why is it done this way? I see no advantage and some cost. As context, I ran across this while looking for a random access container for elements that can't be copied: 回答1: It saves on complexity. We certainly need the copy-construction case, and default-construction can be modeled as replicating a default-constructed object. The performance