I'm looking at the following (presumably C++14) piece of code
auto min_on = [](auto&& f) {
return [f=decltype(f)(f)](auto&& arg0, auto&&...args) {
// call your function here, using decltype(args)(args) to perfect forward
};
}
what is the weird assignment in the lambda capture list? I've never seen an assignment in a capture list
f=decltype(f)(f)
How does this work?
That's what's called a Generalized Lambda Capture, and yes, it's C++14.
Basically it allows you to create a new variable as part of the capture list.
Text from link:
In your specific instance, you have a lambda that is returning a lambda. The nested lambda is capturing
f
(which was only a parameter in the parent lambda) by using this new syntax.