C++ Logo

std-proposals

Advanced search

Re: Template qualifiers

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Thu, 3 Oct 2019 16:07:07 -0400
On Thu, Oct 3, 2019 at 12:26 AM Phil Bouchard <phil_at_[hidden]> wrote:

> Verdict?
>

Phil, you should pause and try to come up with a motivating example for the
feature you claim to want.
Once you have a motivating example, the next step would be to look at what
would be the best way to solve it. Maybe there's even a better way than
what you originally proposed as a feature!
That is, start with a problem, and then propose a solution for the problem.
If (by thinking) you end up realizing that you don't have a problem after
all, that's actually a *good* thing.

You do need to *slow down and think* about your examples. Here's your
latest one:

    template <typename T>
    struct construct
    {
        T operator () (node_proxy &, T && t) { return T(t); } // will lose
constexpr
    };

And here's the perfectly valid C++11 code that solves your stated problem:

    template <typename T>
    struct construct
    {
        *constexpr* T operator () (node_proxy &, T && t) { return T(t); }
// no longer loses constexpr
    };

See also: http://sscce.org

–Arthur

>

Received on 2019-10-03 15:09:29