Re:We have C++14
by CJefferson on Tuesday August 19, 2014 @04:40AM
(#8196455)
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.
Not being able to inline a method like (from vector)
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.