3 ms·
It doesn't capture the variables "if they ever happen to be instantiated." They get captured once; the lambda gets instantiated. It's the operator() method th
by SamReidHughes 6y ago
It doesn't capture the variables "if they ever happen to be instantiated." They get captured once; the lambda gets instantiated. It's the operator() method that is templated, not the lambda object's type itself. Basically a template lambda might be equivalent to this:
struct foo {
std::string capture;
template <class T>
std::string operator()(T x) {
return capture + std::to_string(x);
}
};