auto toNumber = [&](string const& s) -> unsigned {
...
}
[]:定义匿名函数
[&]:以引用形式捕获所有外部变量,也就是外部变量均可用
(string const &s) :匿名函数的参数
->:定义匿名函数
unsigned:函数返回值类型
{...}:函数实现体
C++ 这个语句中[&]是什么意思
最新推荐文章于 2024-06-20 12:59:41 发布
auto toNumber = [&](string const& s) -> unsigned {
...
}
[]:定义匿名函数
[&]:以引用形式捕获所有外部变量,也就是外部变量均可用
(string const &s) :匿名函数的参数
->:定义匿名函数
unsigned:函数返回值类型
{...}:函数实现体