Because sizeof(a vector) means how much space the vector itself needs(which means, not related to the elements). The vector may holds a pointer that is 8 bytes long, and two ints that are 4*2=8bytes long.
Well, not ALWAYS 4 bytes, but there is a definite pattern that shows the sizeof a vector doesn't matter what the POD data type is. The bitness and type of compile makes a difference.
Just for giggles what about a simple C++ class? What is the sizeof that? (x86 Release)
so you mean, it doesn't matter what type vector object is, the size always 4 bytes?
The size is implementation dependent. That means it might be one value for one template type/compiler/operating system and a different value on another. You can't rely on it being anything specific.