C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Bo Persson Re: noexcept({ if constexpr (cond) { ... } else { ... } })

From: Bo Persson <bo_at_[hidden]>
Date: Mon, 10 Aug 2026 16:49:16 +0200
On 2026-08-10 at 16:15, Bingzhi via Std-Proposals wrote:
> 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.

I have only had to use it once, so cannot tell if it has any effect on
compilation times.

However, this is something that already works, which is an advantage.


>
>
> At 2026-08-10 20:00:08, std-proposals-request_at_[hidden] wrote:
>>Message: 4
>>Date: Mon, 10 Aug 2026 12:36:29 +0200
>>From: Bo Persson <bo_at_[hidden]>
>>To: std-proposals_at_[hidden]
>>Subject: Re: [std-proposals] noexcept({ if constexpr (cond) { ... }
>> else { ... } })
>>Message-ID: <115c9jd$nef$1_at_[hidden]>
>>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; }() )
>>
>
>

Received on 2026-08-10 14:49:23