-
March 26th, 2009, 07:01 PM
#1
Deleting vectors
I'm having some troubles when I try to delete some pointers.
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|