The standard containers define the requirements CopyConstructible and Assignable on the value type, and those requirements are sufficient to support all of the operations on containers and sequences (you might also want them to be comparable for associative containers, but even that's not required since you can instead supply a comparator).
What you're asking for, is to have one set of requirements for a set of operations consisting of part of the Container plus something from Sequence (namely 1-parameter resize()
on those containers which never relocate their contents, operator[]
, clear()
and the iterator interface excluding *it = t
), and another set of requirements for the rest. The standard libraries prefer to do this the other way around: choose a common set of requirements which cover almost everything, and then have additional requirements for small bits of functionality (like the requirement to be default-constructible in order to call resize()
without specifying the second parameter).
Containers just weren't conceived with your specific set of operations in mind - copying and assigning are intrinsic to what they're designed to do, which is to contain values that are put into them, so I speculate that in Stepanov's mind that is not a "small bit of functionality". So the wider requirements are there because the abstraction Container is bigger than your proposed ResizeableCollectionOfDefaultConstructedObjects. In fact, take away resize()
and CollectionOfDefaultConstructedObjects is pretty much just an array. I guess that the designers of the STL and the C++ standard didn't encounter your use-case often enough to think it worth abstracting.