小编Set*_*eth的帖子

是否有任何理由将 Lambda 包装在命名函数中?

我最近偶然发现了这个示例代码,我很困惑:

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)

是否有任何理由将匿名函数包装在命名函数中?似乎无缘无故地创建了一个额外的函数调用堆栈。

c++ lambda function c++11

5
推荐指数
1
解决办法
79
查看次数

标签 统计

c++ ×1

c++11 ×1

function ×1

lambda ×1