C++ Logo

std-proposals

Advanced search

Re: std::is_constexpr_constructible (/ std::is_constexpr)

From: Riley Paxton <rtpax.code_at_[hidden]>
Date: Mon, 1 Nov 2021 09:29:18 -0400
To extend the solution in a way that is DRY, you could wrap consteval in a
template and write something like eval_if<consteval>(expr) that results in
a substitution failure if expr does not satisfy the requirement, otherwise
resulting in expr. This could work with arbitrary other conditions (beyond
consteval) as well, so could be very flexible depending on the specifics

On Mon, Oct 25, 2021 at 5:08 PM Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Monday, 25 October 2021 10:50:08 PDT Michael Scire via Std-Proposals
> wrote:
> > But if a language level facility was under consideration, I would
> actually
> > propose `consteval(expr)` as returning whether or not an expression is
> > constant evaluable?
>
> That still violates DRY the same way noexcept(expr) does: I want to know
> if
> expr is $PROPERTY, so I need to write it twice.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel DPG Cloud Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2021-11-01 08:29:34