xargon
April 10th, 2003, 10:07 AM
Hello all,
I thought when I call erase() method on an STL deque, it is supposed to call the corresponding destructor of the object. However, it does not when I do this. Here is some code to illustrate the problem.
std::deque<Wave *> _wavePool;
std::deque<Wave *>::iterator it;
Wave *wav1 = new Wave("D:\\waves\\v1.wav", true);
Wave *wav2 = new Wave("D:\\waves\\think.wav", true);
_wavePool.push_back(wav1);
_wavePool.push_back(wav2);
it = _wavePool.begin()
Now, if I call...
_wavePool.erase(it);
The wave destructor never gets called. Am I not supposed to put heap pointers in a queue or do I have to do this manually.
Thanks for any help you might give me.
Xargon
I thought when I call erase() method on an STL deque, it is supposed to call the corresponding destructor of the object. However, it does not when I do this. Here is some code to illustrate the problem.
std::deque<Wave *> _wavePool;
std::deque<Wave *>::iterator it;
Wave *wav1 = new Wave("D:\\waves\\v1.wav", true);
Wave *wav2 = new Wave("D:\\waves\\think.wav", true);
_wavePool.push_back(wav1);
_wavePool.push_back(wav2);
it = _wavePool.begin()
Now, if I call...
_wavePool.erase(it);
The wave destructor never gets called. Am I not supposed to put heap pointers in a queue or do I have to do this manually.
Thanks for any help you might give me.
Xargon