I have a C++ class which is something like
class Block {
...
scoped_array<Columns> columns_
...
}
Now as i understand because of using an array, the memory for Columns array will be contiguous .
Several parts of the code access the elements of this array randomly i.e. columns_[x].
I want to re-factor the code so that contiguous memory is no longer a constraint. Therefore i assume i have to replace the scoped_array with something which is not contagious.
However if i can i don't want to re-factor other code so that the columns_[x] type access is still possible.
Is there a data structure available that i can use here? I suppose i can replace it with C++ list but then i will lose the columns_[x] style access. is there any data-structure in boost i can use instead which doesn't require contiguous memory?
std::deque
?contiguous
instead ofcontagious
?