I'm looking for data structure where I can stores multiple vectors in one vector without risking fragmentation or any performance issues.

Now doing this

```
std::vector< std::vector<SomeType> > myMultiVector;

```

would help, but for my understanding the memory gets fragmented because obviously every vector within *myMultiVector* will not lie in a contiguous space, because of its allocation scheme.

This is not for creating arrays where I know the dimensions or sizes from the start. The sizes are dynamic in all directions. What I want is a structure like that one, in which the allocated size is contiguous. I want to be able to do something like **push\_back()** and **resize()** on the vector of vectors and every vector itself. The size of the vectors should be able to differ.

I have been taking a look at Boost::Multiarray. Seems promising, but don't want an array, I want something where dyanmic. I'm still not sure, though I can change sizes in the dimensions if it does that by an efficient way. So maybe Boost::Multiarray is the answer for that.

I also have been thinking about using **std::multimap** or even **std::unordered\_multimap** and use the key as index, because of the interal sorting and hashing I'm not sure if it the right structure though the allocation space should be contiguous.

Using *std::vector< std::vector > myMultiVector;* works for what I need but I feel there is a missed oportunity for optimization.

**What other Alternatives do you know which could help providing a more efficient vector of vectors?** Let me know :-)

NOTE: I know the question is quite similar to others asked here. I'm only asking for alternatives not quite for the solution of a particular problem.