??????????????10??C++11????????????????е?C++??????????????á?C++11?????????????????????????????????μ????????????????????????????????????е?????????????????????????????????С?????????????????C++11?????汾?????????????????????г??????????????ЩC++???????
????????????:
???????????(auto)
?????????(nullptr)
???????????(Range-based for loops??
????override??final???(override and final)
?????????????????(Strongly-typed enums)
???????????(Smart pointers)
????Lambdas????(Lambdas)
??????????begin()??end()????(non-member begin() and end())
????????????????????(static_assert and type traits)
???????????(Move semantics)
???????????
??????C++11??auto???????????????洢????????????????±????auto????????????auto??????????????λ???????????????????????????????????????????????????????????????б???????壬??????????顢for????е??????????
????1 auto i = 42;        // i is an int
????2 auto l = 42LL;      // l is an long long
????3 auto p = new foo(); // p is a foo*
????Using auto usually means less code (unless your type is int which is one letter shorter). Think of iterators in STL that you always had to write while iterating over containers. It makes obsolete creating typedefs just for the sake of simplicity.
???????auto?????????????int????????auto???????????????????STL????????????????????ò?д????????????auto?ж???????????????typedef??????????????????????
????1 std::map<std::string?? std::vector<int>> map;
????2 for(auto it = begin(map); it != end(map); ++it)
????3 {
????4 }
?????????????????auto??????????????????????????????β??????????????????????????д???????????????????auto????????????????壬??????????C++14??????????????????auto????????????????????????????????????????β????????????????????????У?????compose??????????????(t1+t2)??????????
????1 template <typename T1?? typename T2>
????2 auto compose(T1 t1?? T2 t2) -> decltype(t1 + t2)
????3 {
????4     return t1+t2;
????5 }
????6 auto v = compose(2?? 3.14);  // v's type is double
?????????
????C98?п???????0??????????????????????????????????nullptr???????std::nullptr_tr??????????????????????塣????????????????nullptr???κ?????????????????κγ??????????????????????????bool????????false?????????????????????????????
1 void foo(int* p) {}
2
3 void bar(std::shared_ptr<int> p) {}
4
5 int* p1 = NULL;
6 int* p2 = nullptr;
7 if(p1 == p2)
8 {
9 }
10
11 foo(nullptr);
12 bar(nullptr);
13
14 bool f = nullptr;
15 int i = nullptr;    // error: A native nullptr can only converted to bool or?? using reinterpret_cast?? to an integral type
??????????????0???????????????????