r/cpp • Boost author • Sep 14 '26

Inside Boost.PolyCollection

https://bannalia.blogspot.com/2026/09/inside-boostpolycollection.html
35 Upvotes

1 comment sorted by

1

u/Curious-Escape-2435 11d ago

Don't really get this. If the concrete types involved can be enumerated at compile time, why use virtual polymorphism in the first place? The type variance is closed by construction, so some kind of variant type is surely more suitable. OTOH when the types being stored in the collection are truly open (eg load a type defined in a DLL), then this kind of container penalizes them.