As someone indicated, it looks using vectors of arrays is usually more reasonable than using array of pointers; So here I have an array of pointers which I'd like to convert to vectors of arrays:
char ** ptr;
char * ptrContiguous;
ptr = new char*[numChannels];
ptrContiguous = new char[x*y*byteSize*nC*nM*nZ*nT];
char * p = ptrContiguous;
for(int i = 0; i < numChannels; i++)
{
ptr[i] = p;
p += x*y*byteSize;
}
My questions are: only ptr needs to be converted to vector right? and someone can write some simple code illustrating the array to vector conversion? Thanks.
std::vector<std::string>.std::vector<std::string> myvec( ptr, ptr+numChannels);