format:
[Capture] (parameters) mutable-> returm-type {}; declaration of the function
[Capture] (parameters) mutable-> returm-type {} (); function call
[] Represents an expression begin, you must have:
If [] is empty inside, it will not represent any variables passed to the lambda expression
[=] Denotes default passed by value, {} is transmitted to the variable or an object used in
Passed by value: statement in vivo modify variable values, it will not affect the value of the variable out
[&] Indicates the default passed by reference
[Var]: var variable name is passed only variable var, the other can not pass; front & prefix may be added, var represents a variable passed by reference
() Parameter list - Optional
No argument can be omitted
May be passed by value, such as (a, b); can also be passed by reference, such as (& a, & b)
mutable option (optional) - Use when passed by value
After adding mutable, variable values may be modified based on the statement body; read-only variables can be omitted
returm-type --- return value type
If the return time, only one can be omitted, automatically determine the type
int ret=[]()->int{return 1000;}();
{} Statement to achieve body
Long emperor arrogance