我写了以下代码:
我写了以下的代码:
static int count = []()->int
{
int count = 0;
for(int i = 0; i < categories.size(); ++i)
{
if(!categories[i].isCategory())
{
count++;
}
}
return count;
};
出现了错误:error: 在初始化时无法将 '__lambda0' 转换为 'int'
。
我的代码片段的含义是将 __lambda0
赋值给 static int count
而不是返回内部计数吗?