我最近偶然发现了这个示例代码,我很困惑:
auto named_funct(const MyClass& some_class)
{
return [some_class](const MyClass2& some_other_class)
{
return some_class <= some_other_class; // some expression between capture and input parameter to the Lambda
};
}
Run Code Online (Sandbox Code Playgroud)
是否有任何理由将匿名函数包装在命名函数中?似乎无缘无故地创建了一个额外的函数调用堆栈。