But lambda is slower in compilation speed. That noexcept({ if constexpr (cond) { ... } else { ... } }) idea is to support something like short-circuit ternary operator inside noexcept, to achieve faster compilation speed when using large scale template libraries.
At 2026-08-10 20:00:08, std-proposals-request@lists.isocpp.org wrote:
>Message: 4
>Date: Mon, 10 Aug 2026 12:36:29 +0200
>From: Bo Persson <bo@bo-persson.se>
>To: std-proposals@lists.isocpp.org
>Subject: Re: [std-proposals] noexcept({ if constexpr (cond) { ... }
> else { ... } })
>Message-ID: <115c9jd$nef$1@ciao.gmane.io>
>Content-Type: text/plain; charset=UTF-8; format=flowed
>
>On 2026-08-10 at 11:45, Bingzhi via Std-Proposals wrote:
>> Somebody who tried to implement ranges library can get what I mean.
>> I prefer noexcept(auto) than this one, but I believe this one is simpler
>> to achieve.
>>
>
>You can already use a lambda in the noexcept(), like
>
>noexcept([] {if (cond) return something; else return other; }() )
>