8 ms·
The real problem with defaulting to virtual isn't the vtable pointer, it's the lack of inling. Not being able to inline a method like (from vector) T& ope
by CJefferson 12y ago
The real problem with defaulting to virtual isn't the vtable pointer, it's the lack of inling.
Not being able to inline a method like (from vector)
T& operator[](size_t pos)
{ return data[pos]; }
Would kill performance.
In languages which do run-time optimisation you can inline such methods later, but in C++ that's not possible and proving when you can de-virtualise a method (which most compilers do) is very hard and often fails.