I have a C background and I am recoding some old code in C++... In the process, I am starting to use C++ Vectors, which are so easy to use!
Would vectors deal well with very long streams of data? For example, in audio apps, loading a stereo 3 minutes song would need almost 16M floats
float *stereoSong = NULL;
stereoSong = new floats[15787800];
Not having to deal with memory management with vectors is very nice, but I was wondering if that huge amount of data would be handled well by C++ vectors
Thanks!
This is a false comparison.
For a start, vectors use pointers. They have to. Vectors are containers that use dynamic allocation to provide you with a buffer of data items. You could try to implement the same thing "with pointers", but you'd end up with something someway between a vector, and a worse version of vector.
So, vectors can handle as much data as you'd be able to handle with new double[] — that is, a lot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With