• Tin Švagelj@mastodon.social
    link
    fedilink
    arrow-up
    1
    ·
    3 年前

    @kixik Inheritance can always be substituted by composition which is what #Rust does pretty well. Constexpr isn’t on C++ level, but I guess you can generate code from build script so there’s ways around it.
    As for virtual functions - Traits are effectively to virtual function lookup table declarations that get used by dyn SomeTrait type. So calling a fn on Box\<dyn T\> generates VMT lookup.

  • nachtigall@feddit.de
    link
    fedilink
    arrow-up
    1
    ·
    3 年前

    Oh please not. Spare us from the C++ type-polymorphy nightmare. Traits are so much better than inheritance.