Reputation: 165
I'm trying to compile the following code in 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
Note: I'm using a C++14 compiler.
Upvotes: 1
Views: 185
Reputation: 96043
Those ain't the regular generic lambdas. Specifying the template parameter list for a lambda is a C++20 feature. The C++14 "generic lambdas" merely let you use auto
in lambda parameters.
Upvotes: 6