3 ms·
Not really an oxymoron: virtual calls could always be replaced by direct calls if the identity of the class object can be determined, and if the compiler can de
by not2b 5y ago
Not really an oxymoron: virtual calls could always be replaced by direct calls if the identity of the class object can be determined, and if the compiler can determine both the identity of the class and that value returned by the virtual function call, either by inlining or link-time optimization, the call can be replaced by the value. That was true in the 1998 version of the standard. So constexpr just adds a mechanism to help the compiler do this early evaluation, marking where it should be done, plus adding the ability to use calls in context where the grammar needs a constant, by promising that the call can be reduced to a constant.