1,range for; alto
for (const Auto& Agent:componentagents_)
{
Agent->interface ();
}
See http://www.cnblogs.com/h46incon/archive/2013/06/02/3113737.html
The latest C + + standard updates the features of the Auto keyword
In addition to having the original meaning, it also adds a type derivation feature similar to other high-level languages
Use Auto to replace the type of the variable,
If initialized with a definite type of initialization variable, you can use the Auto keyword
such as int i=10; Auto A = i; So a is an int type.
This is useful for reducing redundant code when using some template classes
See Http://zhidao.baidu.com/link?url=6_MLuvtOysRI0Mar386KMVr4_akcjfecdhUkg14esU7wM7G3UAtoR5ngvT50zM5yqdjxzxWxtB6t4Isn3Zh1W_
2,LANBDA-expression
The type of a closure cannot is named, but can is inferred with auto auto func1 = [] (int i) {return i+4;};
[ capture ] ( params ) mutable exception attribute -> ret { body }
capture Specifies a list of external variables that are visible within the code of a lambda expression within the visible domain scope, as explained below:
[a,&b]A variable is captured in the form of a value, and B is captured as a reference.
[this]Captures the this pointer in a value manner.
[&]Captures all external automatic variables in a reference manner.
[=]All external automatic variables are captured in a value manner.
[]No external variables are captured.
See http://www.cnblogs.com/haippy/archive/2013/05/31/3111560.html
Several new features of C + + 11