I am making an array of pointers to objects. I initialize the array by setting every pointer to NULL to indicate that the array element points to no object (and has always pointed to no object). Whenever an new object is declared, the value of one of the array elements is pointed at the new object.
My problem is that whenever an object is removed from the array I would like to set the pointer at that element to a value such that I know a object was there, but has been deleted. I obviously cannot reset that pointer to NULL because NULL is my "flag" that the pointer at that element is, and always has, pointed to no objects. I need a unique "flaq" that indicates the pointer at that array element once pointed to an object but that it no longer does. Any suggestions as to how I can do this?
maybe you should create an object with a certain "indicator member" that is set to some arbitrary self indicating flag. Like 'count = -1', "name = "deleted". Then you can easily implement it by having all elements that get rid of their current objects, point to that indicator object. Then just test it by comparing the member with the arbitrary and unique flag.
Thx indigo0086, I just implemented something similar to that right now. I think that's the best flag I can use while dealing with array of pointers to objects.