I know that if a class contains any virtual functions, most compilers (if not all) add a vptr pointer to its objects. Some add it as the first element, some as the last. But does the C++ standard mandate usage of vptr and vtable? Could any compiler, theoretically, implement it any other way? If so, what are the guarantees regarding polymorphic objects' storage layout and overall size (e.g. are all the explicitly defined fields (+ padding) in a continuous memory block)?
I don't know if this differs between various C++ standards, that's why I only added the general C++ tag.