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@lists.isocpp.org> 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@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals