C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::elide

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 5 Jun 2024 10:46:16 +0100
On Tue, Jun 4, 2024 at 11:49 PM I wrote:
>
> If a programmer doesn't want to use "std::elide" because it fails to
> be a constructor parameter, then they can use their own elider. Or use
> "std::elide_nofail".


So then the class hierarchy would become:

namespace std {

    class elide_base {};

    template<typename F, typename... Params>
    class elide : public elide_base { /* implementation */ };

    template<typename F, typename... Params>
    class elide_nofail : public elide_base { /* implementation */ };

}

The two classes, "elide" and "elide_nofail" would be identical except
that the latter doesn't fail to be the sole parameter type of a
constructor.

If anyone doesn't like the idea of having two separate classes like
that, then instead the two classes could be one template class
differentiated by a boolean template parameter, for example:

    using elide = elide_base<false>;
    using elide_nofail = elide_base<true>;

Anyone liking the sound of this? Remember, we're not looking for a
perfect solution, we're looking for the best solution.

Received on 2024-06-05 09:46:29