I am using btAlignedObjectArray<myObj *> to create new object, but when i try to remove it, i have problem.
My code is below :
Code: Select all
class myObj {
int index;
myObj(int index) ...
~myObj() ...
};
btAlignedObjectArray<myObj *> myArray;
myArray.push_back( new myObj(1) );
myArray.push_back( new myObj(2) );
// then i try to delete it, but the object is still there
myObj * ptrObj1 = myArray[0];
myArray.remove( ptrObj1 );
display << "obj still exists? = " << ptrObj1->index << endl;
and so later i checked into btAlignedObjectArray::remove() and found that it is just doing a destructor() call to the newly created object.
Does that imply that btAlignedObjectArray should not be used to call memory heap allocated objects?
If not, please let me know a better choice to remove the object.
Big Big Thanks!