What are functors?
Functions with state
Why do we want functors?
What are lambda expressions?
Anonymous functors, functors that are not explicitly named or identified. Useful for simple cases
What does the auto keyword?
Gets the compiler to determine the best possible type to use in the context it is given
When should we use lambda?
When should we not use lambda’s?
-Instead of proper function calls.
- When they need to be stateful
What does the inline function do?
Used for compiler optimisation, substitutes all functors calls to the item in the return statement.
What is a stateful functor?
Functor with state
This is a lambda expression that takes an int x and returns an int.
Should be: [] (int x) -> int {}
For lamba expressions how do we capture all the variables of a file?
By putting “=” in the rectangular brackets: [=]
Does lambda need to capture the this pointer in classes?
No it is automatically captured.