I have a structure like this:
Code:
struct vPos{
int *vector;
int **pos;
};
struct Triangle{
int nrows;
vPos *positions;
};
I know there is a simpler way to do it, using a double-pointer for example (and clasess, ok). But it doesn't matter.
It works like this:
positions ------> pos....... vector [__][__][__][__][__][__][__][__][__][__][__]....
.......................[__]--------------------^
.......................[__]----------------------------------^
.......................[__]------------------------------------------------------^
.......................[__]---------------------------------------------------------------------------^
The problem is that I don't know how to delete all vectors.
If I do
delete [] pos, I will delete
pos[0], pos[1], pos[2], pos[3], etc but delete
pos is like delete
pos[0], and
pos[0] points to
vector[0], so I think
vector will be deleted too. And that's de problem. How can I delete all vector, and
pos (and then positions) ?
Thanks!