0

I understand that dynamic arrays are stored on the heap, and cleared through the delete[] function.

And since vectors are originated and created through the implementation of dynamic arrays, I was wondering if they too are stored on the heap? And if at any time, pieces of a vector are stored on the stack?

(i.e. I need a simple answer that explains how vectors are stored in memory, be that on the stack or heap)

Thanks!

  • 1
    std::vector holds pointer to dynamic array allocated with allocator. default allocator allocates memory in the heap, but you can customize this with your allocator. – AnatolyS May 29 '16 at 16:03
  • Why do you need to know this information? What problem are you trying to solve? – Cody Gray May 29 '16 at 16:27

0 Answers0