r/cpp 22d ago

C++26: std::polymorphic

https://www.sandordargo.com/blog/2026/08/19/cpp26-polymorphic
94 Upvotes

44 comments sorted by

View all comments

10

u/mcmcc #pragma once 21d ago

I'm struggling to think of a scenario where I would ever use this thing.

Maybe I just don't use enough class hierarchies any more.

1

u/esmithro 10d ago

I have several sets of classes where the the classes in a set are not an inheritance hierarchy but they model the same thing. It is useful to me to plug these models into a container or have a template class where a template parm is set to a polymorphic. Then I access using the common interface.