
On 7/19/06, Steven Burns <royalstream@hotmail.com> wrote:
Recently I came up with a modified version of boost::array that supports runtime sized arrays.
It is backwards compatible:
boost::array<int, 10> sarray;
but it can be used this way now:
boost::array<int> darray(10);
How did you implement this? A partial specialisation for when the size is the new default of -1 or something? Of course, with that constructor you no longer have an aggregate, which is one of the big advantages of boost::array.
I realize you could simply use std::vector, but sometimes all you want is a fixed-size array (but sized at runtime). Besides, I am not sure about the overhead involved with std::vector for these simple scenarios.
Up to your implementation, but for most I'd expect it to be only the one extra pointer needed per container to hold the capacity information. Check to see whether in your implementation the initial capacity is the same as the size after construction from a size. I don't think there'd be any speed difference. ~ Scott McMurray