I’ll come up with some clarifications then.

But I can say right now the “struct construct {};” is meant to work with all types of constructors, including those with and without a constexpr constructor. That’s why it needs to become a qualifier so that operator () can be overloaded properly.

The goal is to keep the constexpr qualifier as long as possible given the case the arbitrary class uses a constexpr constructor, this way the code will be more efficient...

-- 

Phil Bouchard
Founder
C.: (819) 328-4743

Fornux Logo

On Oct 3, 2019, at 4:07 PM, Arthur O'Dwyer <arthur.j.odwyer@gmail.com> wrote:

On Thu, Oct 3, 2019 at 12:26 AM Phil Bouchard <phil@fornux.com> 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