My task is to write a lambda function that increments the value, but I need to use value-0 capture-specifier. I am thinking of the following function:
auto lambda = [value = 0]{return ++value}
When this function is called, it must increment each time. But I know that this implementation is incorrect because it passed by value. How can I do this in C ++ 14?
source
share