C++ Logo

std-proposals

Advanced search

Re: [std-proposals] How should we tag a class? Use an empty base class or a typedef?

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 27 May 2024 21:50:09 +0100
On Mon, May 27, 2024 at 4:04 PM Gašper Ažman wrote
>
> strongly against a baseclass. The reason anyone would use anything but
> std::elide is because they have their own, and changing that is
> difficult.
>
> Request a `bool std::is_elider_v<my-class>` specialization and then
> have `template <typename X> concept elider = std::is_elider_v<remove_cvref_t<X>>`.


I think that's more complicated than just having:

    class elide {
    public:
        typedef true_type tag_elide;
    };

Plus, my strategy has the added versatility of being able to override
it in a derived class with "false" instead of "true":

    class MyElide : public std::elide {
    public:
        typedef std::false_type tag_elide;
    };

Received on 2024-05-27 20:50:21