
Nathan Ridge wrote:
1) As a variant of [std|boost]::array where not all the elements are constructed/used at the same time, and which keeps track of how many elements are currently in use.
Can you please give some examples of such use?
For starters, any use of [std|boost]::array<T> where T is not default constructible and I do not wish to make it so just so I can use it in an array.
Yes, but this is a fixed size case. I was interested in the variable-sized ones. Jeffrey Lee Hellrung, Jr. wrote:
My problem required storing a variable but compile-time-bounded number of not-necessarily-default-constructible-objects in an array. Specifically, I was storing some representation of the sub-simplex intersections between two d-dimensional simplices, where d was a compile-time constant (typically 2 or 3). The number of such intersections is bounded in terms of the dimension d, and this was a computational intensive part of the application, so avoiding heap access was desirable.
This is a good example. If the intended use case of this class is only when the size is compile time bounded, I agree that push_back/insert/resize should assert. If it's intended to have a wider use, though...