Lambda Functions in C++ 11
From: http://en.cppreference.com/w/cpp/language/lambda
Syntax:
[capture-list](params) mutable(optional) exception attribute -> ret { body } [capture-list](params) -> ret { body } [capture-list](params) { body } [capture-list] { body }
Explanation:
- mutable: allows body to modify the parameters captured by copy, and to call their non-const member functions
- exception: provides the exception specification or the noexcept clause for operator() of the closure type
- attribute: provides the attribute specification for operator() of the closure type
- capture-list: a comma-separated list of zero or more captures, optionally beginning with a capture-default. Capture list can be passes as follows:
- [a,&b] where a is captured by value and b is captured by reference
- [this] captures the this pointer by value
- [&] captures all automatic variables odr-used in the body of the lambda by reference
- [=] captures all automatic variables odr-used in the body of the lambda by value
- [] captures nothing
- params: The list of parameters
- ret: Return type. If not present it’s implied by the function return statements (or void if it doesn’t return any value)
- body: Function body