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