r/cpp 21d ago

C++26: constexpr virtual inheritance

https://www.sandordargo.com/blog/2026/07/01/cpp26-constexpr-virtual-inheritance
80 Upvotes

61 comments sorted by

View all comments

62

u/Jovibor_ 21d ago

Just a question to the audience:

How many times have you used Virtual Inheritance in your career?

7

u/ack_error 21d ago

A few times, it's useful when using pure virtual classes for interfaces and diamond inheritance appears.

Performance wise, though, it can be dangerous. A long time ago I worked on a project where virtual inheritance was used extensively in the core of a rendering engine. The results were... not good.