Date: Wed, 22 Feb 2023 09:15:36 +0000
On 22 February 2023 09:09:31 GMT, Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> wrote:
>Why don't we have a means of determining if something is a lambda?
Why should we? What's the benefit?
>template<typename Lambda>
>requires std::is_lambda_v<Lambda>
>struct OnScopeExit {
> Lambda f;
> OnScopeExit(Lambda arg) : f(arg) {}
> ~OnScopeExit(void) { f(); }
>};
>
>void Func(void) { }
>
>int main(void)
>{
> OnScopeExit myguard([](){ /* Do Something */ });
>}
Why prohibit anything callable here?
If anything, I would require noexcept invocable for scope exit.
Cheers,
Lénárd
>Why don't we have a means of determining if something is a lambda?
Why should we? What's the benefit?
>template<typename Lambda>
>requires std::is_lambda_v<Lambda>
>struct OnScopeExit {
> Lambda f;
> OnScopeExit(Lambda arg) : f(arg) {}
> ~OnScopeExit(void) { f(); }
>};
>
>void Func(void) { }
>
>int main(void)
>{
> OnScopeExit myguard([](){ /* Do Something */ });
>}
Why prohibit anything callable here?
If anything, I would require noexcept invocable for scope exit.
Cheers,
Lénárd
Received on 2023-02-22 09:15:43