| Corey Wirun 2005-03-02, 9:00 pm |
| (Excuse me if this appears twice. I posted and the server deleted it right
away for some reason).
Yet another question to y'all:
If I'm adding heap objects to a std::list<T> (created on the heap): e.g:
for (int i = 0; i < 10; i++)
{
TObject * p = new TObject();
pColl->push_back(p);
}
I noticed that the list destructor appears to 'delete' the TObject pointers
when the std::list<T> itself is 'delete'd. In xmemory, I see executing:
void deallocate(pointer _Ptr, size_type)
{ // deallocate object at _Ptr, ignore size
operator delete(_Ptr);
}
Sure enough, _Ptr, is an instantiation of my TObject object.
Can this behavior be conditionally modified? I have a situation where a
std::list contains a copy of some (not all) ptr's from a master std::list
and I don't want to 'delete' these objects since it would blow away the
master list contents as well.
Thanks for all your help! You guys are great!
Corey.
|