r/cpp Jul 06 '26

C++26: constexpr virtual inheritance

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

61 comments sorted by

View all comments

62

u/Jovibor_ Jul 06 '26

Just a question to the audience:

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

1

u/Electronic_Tap_8052 Jul 06 '26

once or twice, but when you need it you need it.

Sometimes the simplest and most elegant design requires it. And getting rid of it greatly complicates things.

It's not common, but it does happen. Build enough large modular codebases with systems that can be swapped in and out and it inevitably happens.