(Skip down till "Question:" if you're in a rush)
Context: I'm coding on an audio application which involves storing buffers of audio. I'm currently using a
std::vector<float> , as a member of an
AudioBuffer instances are held in another class
In the "process" callback (where I want to use the buffers) im doing like so:
AudioBuffer* audioBuffer = resourceHolder->getAudioBufferPointer(); std::vector<float>* vector = audioBuffer->getVectorPointer(); // blah blah, read the vector x = vector->at(0);
This all works ok, its only when the vector get reallocated in memory (due to another thread loading a different sample into it) that I get
vector.size() back as 0.
The AudioBuffer destructor is *not* being called, so the vector isn't destructed.
Question: I want to detect when an std::vector<> gets reallocated in memory, to print its size before & after, to check if it actually contains what I expect it to.
How does one go about this..?