Array< Array<int> > safe?


#1

Is Array< Array<int> > safe?

I guess yes, indeed the array points to a external heap memory, but it can be relocated without loosing its function.
And when i the outer array, recreates the inner array, it uses the copy-constructor, which itself ensures that the inner array copies the heap memory into new memory.

But why I don’t use OwnedArray< Array<int> >?
Because if i duplicated the outer array, i would have two arrays pointing the same heap memory.
But i would like make a complete deep copy.

So again is Array< Array<int> > safe?


#2

however, i think i will switch to std::vector < std::vector< int > >


#3

That can be very inefficient depending on what you’re doing, just to be aware.
http://upcoder.com/2/efficient-vectors-of-vectors