C++ Logo

std-proposals

Advanced search

[std-proposals] std::is_lambda

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 22 Feb 2023 09:09:31 +0000
Why don't we have a means of determining if something is a lambda?

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 */ });
}

Received on 2023-02-22 09:09:43