I am trying to understand what exactly is vector and it seems that it is very different from array. I tested the following simple code to see what it is storing
std::vector<int> A = { { 1, 2, 3 } };
If I query the memory of the vector with &A, I get the following values
e0 32 6a f7 f5 01 00 00
00 27 6a f7 f5 01 00 00
0c 27 6a f7 f5 01 00 00
0c 27 6a f7 f5 01 00 00
The second and third line is the start of value 1 and the next address of value 3 (the address for 3 is ...2708 to ...270B). What about the first and last line?
If I try with a vector array, the second and third line is no longer the starting and ending address of any values which I guess makes sense since the different vectors are not contiguous. But the question is what are the values stored in the vector in this case? and where is the address of the different vectors stored? The vector array is still 32 bytes. It doesn't seem like it can store the address of all the vectors.
I would greatly appreciate any assistance provided on this matter.
Did a quick search but can't seem to find anybody talking about this stuff. Is this specific to some compiler or IDE?
Edit: Don't understand why the other post answers my question. I read that post before posting this and while there is a reply that talks about some implementation of vector class, that is not all I am asking here. If vector stores the capacity, start and end pointer, how to explain why I can't find the address of any vectors in my vector array? If there is only 1 start and end pointer, how does it point to all the vectors in a vector array considering that the different vectors are not stored contiguously and the size of vector array is fixed??