I have two questions:
1. What is the best STL container for this? std::vector can do a .push_back() and .erase( .first() ) and supports .data() in C++11. std::queue is more effecient at push/pop, but doesn't have .data() support. My target build enviornment doesn't support .data() anyways.
2. Is there an alternative to .data? At work we are using VS2008 which has no support for C++11's .data() member of std::vector. I need to find an equivalent solution that will work in C++03.
Nevermind, .front() doesn't give me what I expected. I actually get different results between using .front and .data. This seems to indicate that on this compiler (g++), the memory is not stored successively or that it is padded.
The temporary array with dynamic memory allocation works. Just curious, why did you set temp = 0; instead of delete temp;? It looks intentional, but that would cause a memory leak no?