the C++ STL vector has a lot of decent properties, but only works when the size of each item is known at run-time.
I would like to have a vector class that features
The problem is that if you don't have a way to store the size of each item in the vector you'll never be able to get the data back out.
What about just storing ALL the items as double
? This drastically simplifies things.
Alternately you could consider boost::variant
.
EDIT: But really can you explain further why you want to store two different types in the same sequence? That can sometimes indicate that the underlying design needs further thought.