2 ms·
A compiler can only devirtualize a virtual call if it knows the underlying object’s type at compile time, which it certainly won’t for a runtime populated array
by 10000truths 4y ago
A compiler can only devirtualize a virtual call if it knows the underlying object’s type at compile time, which it certainly won’t for a runtime populated array of base class pointers.
CSE doesn’t work across function boundaries unless those functions are inlined, which won’t happen with virtual functions due to the above.
- Arnavion 4y agoSee my reply to anonymoushn's comment.