C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Specify Constant Expression

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sun, 5 Jan 2025 12:47:45 +0000
On Sunday, January 5, 2025, Frederick Virchanza Gotham wrote:

>
> consteval unsigned DoubleFactorial(unsigned const arg)
> {
> [constexpr arg : carg];
> return 2u * Factorial<carg>::value;
> }
>



Two possible alternative syntaxes:

consteval unsigned DoubleFactorial(unsigned const arg)
{
    constexpr unsigned carg = [constexpr arg];
    return 2u * Factorial<carg>::value;
}

consteval unsigned DoubleFactorial(constexpr unsigned arg)
{
    return 2u * Factorial<arg>::value;
}

Received on 2025-01-05 12:47:47