Discussion
I'm aware that all the implementations (i.e., C++ compilers) that I know, implement the dynamic dispatch mechanism via the use of virtual dispatch tables and virtual table pointers (i.e., the known vtable and vptr).
However, interrogating the C++ standard I found out that the C++ standard does not mandate exactly how dynamic dispatch must be implemented. This means that a vendor could use an alternative method for dynamic dispatch provided that its behaviour complies to the C++ standard demands for dynamic dispatch behaviour.
Questions
Q1. Are there any other valid methods, beside
vtables andvptrs, that dynamic dispatch could be implemented with?Q2. If Q1 is true: What are the reasons, if any, that made implementers decide to use
vtables andvptrs to implement dynamic dispatch instead of some other valid method?