At first I used a vector to store over 1,000,000 ints
A good idea.
but later decided that I really didnโt need the dynamic functions of the vector (I reserved 1,000,000 points as soon as it was declared anyway)
Not such a good idea. You need it.
and it would be useful instead to be able to add values โโanywhere in the data structure.
I do not follow.
I assume this is because declaring the size of the array at compile time puts it on the stack and instead uses a dynamic vector in the heap (what do I assume more?).
A lot of. By default, the call stack is typically 1 MB-2 MB in size. Your heap (free store) is really limited by your available RAM.
So what is the correct answer here? Return to the dynamic memory system to get it in a heap?
Yes.
[edit: Joachim right - static is another possible answer.]
Increase stack size?
You could, but even if you could pull 4 MB out of it, you left no room for yourself to view other local data variables. The best used dynamic memory is what the appropriate thing to do.
Or am I leaving the bottom of everything here ...?
No.
source share