#include <type_traits>
int main()
{
auto f = [] {};
static_assert(std::is_same_v<decltype(!f), bool>); // ok
f.operator bool(); // error: ‘struct main()::<lambda()>’
// has no member named ‘operator bool’
}
Does C++ guarantee the lambda unnamed class always has an operator bool()
defined?