Verdict?


On 10/2/19 8:42 AM, Phil Bouchard wrote:


On 10/2/19 8:29 AM, Barry Revzin wrote:
On Tue, Oct 1, 2019 at 12:56 PM Phil Bouchard via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

[I apologize for my mistakes, I wrote the email very quickly]

2 things here:

1. "constexpr" would ideally need to be treated like a qualifier. This way it could propagate like cv qualifier.

constexpr is not part of the type system, it cannot be treated like qualifier. Given:

constexpr int i = 1;
int const j = 2;

The types of i and j are the same, both int const. There is a proposal (P1045) for constexpr parameters, but there constexpr would work very differently than the way qualifiers work: a constexpr parameter would [have to] behave like a template.

If you want to "propagate" constexpr, you just declare your function constexpr. constexpr is already conditionally constexpr.

Barry

Well it won't work in my case where we have an "in between" wrapper:

struct NonConstClass

{

    NonConstClass() {}

};

struct ConstClass

{

    constexpr ConstClass() {}

};


template <typename T>

    struct construct

    {

        T operator () (node_proxy &, T && t) { return T(t); } // will lose constexpr

    };


--

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

Fornux Logo
--

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

Fornux Logo