C++ Logo


Advanced search

Re: [std-proposals] Flat Dynamic Polymorphism Library

From: Barry Revzin <barry.revzin_at_[hidden]>
Date: Sat, 16 Jul 2022 09:37:50 -0500
What you're calling "flat dynamic polymorphism" is what is typically
referred to as "type erasure." It would be better to stick with existing
names for things rather than introducing new ones. And there is definitely
no reason any of these things should be an initialism (FDP for Germans is a
political party, DST for Americans is daylight savings time).

I think it would help if you took a look at all the existing work around
type erasure. There are many libraries that solve this problem. Some

   - Boost.TypeErasure (
   - Dyno (https://github.com/ldionne/dyno)
   - FB's Poly (
   - Adobe's Poly (https://stlab.adobe.com/group__poly__related.html)
   - Boost::extTE (https://github.com/boost-ext/te)

I'm sure I'm missing several. There's also plenty of good talks on this
subject - I'd recommend Louis Dionne's (
https://www.youtube.com/watch?v=gVGtNFg4ay0) and Sy Brand's (
https://www.youtube.com/watch?v=8c6BAQcYF_E). While Louis' more covers what
we can do in libraries today, Sy's is more what we could do in libraries

Lastly, the paper doesn't really do a good job of presenting the library
facility. Dyno and Folly Poly's docs, for instance, both go through a
complete example for Drawable. This paper just has a single alias

using any_drawable = any with<Draw, Method2, Method3>;

What are Draw, Method2, and Method3? What is any_with? What can I do with
this type? How do I construct it? What are its members? What does its
storage look like? Can I customize operations?


On Sat, Jul 16, 2022 at 8:03 AM Nikl Kelbon via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> The current tools for dynamic polymorphism in C++ are not expressive and
> efficient enough, almost all uses of virtual functions in the standard
> library are poorly extensible and pay for what we do not use. I would like
> to offer my vision of solving these problems.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2022-07-16 14:38:02