It requires mutable
because by default, a function object should produce the same result every time it’s called. This is the difference between an object orientated function and a function using a global variable, effectively.
More Related Contents:
- Declaring lambda with int type not working [closed]
- What is a lambda expression in C++11?
- Is it possible to figure out the parameter type and return type of a lambda?
- Recursive lambda functions in C++11
- Passing capturing lambda as function pointer
- What is the type of lambda when deduced with “auto” in C++11?
- How to convert a lambda to an std::function using templates
- How is std::function implemented?
- Bind Vs Lambda?
- C++0x lambda capture by value always const?
- C++11 lambda implementation and memory model
- Can lambda functions be templated?
- Error: variable “cannot be implicitly captured because no default capture mode has been specified”
- Lambda capture as const reference?
- Why can’t I create a vector of lambdas (of the same type) in C++11?
- Lifetime of lambda objects in relation to function pointer conversion
- Why can’t I capture this by-reference (‘&this’) in lambda?
- How to immediately invoke a C++ lambda?
- std::remove_if – lambda, not removing anything from the collection
- Lambda functions as base classes
- How do static variables in lambda function objects work?
- Lambdas and capture by reference local variables : Accessing after the scope
- What is the purpose of std::function and how to use it?
- Can we get the type of a lambda argument?
- In lambda functions syntax, what purpose does a ‘capture list’ serve?
- Lambdas and std::function
- Explicit Return Type of Lambda
- Using data member in lambda capture list inside a member function
- C++ priority_queue with lambda comparator error
- Overload resolution with std::function