[英]generic lambdas in c++14
I'm trying to compile the following code in VS2019:我正在尝试在 VS2019 中编译以下代码:
auto moveToEnd = []<typename T>(std::vector<T>& into, std::vector<T>& from)
{
into.insert(std::end(into), std::make_move_iterator(std::begin(from))
, std::make_move_iterator(std::end(from)));
};
However, I get an error:但是,我收到一个错误:
'<' skipping unexpected token/s before lambda body
'<' 在 lambda 正文之前跳过意外令牌
Note: I'm using a C++14 compiler.注意:我使用的是 C++14 编译器。
Those ain't the regular generic lambdas.那些不是常规的通用 lambda。 Specifying the template parameter list for a lambda is a C++20 feature.
为 lambda 指定模板参数列表是 C++20 功能。 The C++14 "generic lambdas" merely let you use
auto
in lambda parameters. C++14 “通用 lambdas” 仅允许您在 lambda 参数中使用
auto
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.