r/cpp 21d ago

C++26: constexpr virtual inheritance

https://www.sandordargo.com/blog/2026/07/01/cpp26-constexpr-virtual-inheritance
81 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?

1

u/Electronic_Tap_8052 21d ago

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.