C++ 11 (C++ 0x)初探

1. auto,自动检测变量初始化类型,有些地方用起来特别方便

std::map<std::string, std::string> addrBooks;
// some inserting ...
// iterate elemants
// way before c11
std::map<std::string, std::string>::iterator it = addrBooks.begin();
// way in c11
auto it11 = addrBooks.begin();

2. for 循环新特性

std::vector<int> ints;
// some inserting ...
// ranged for loop
for( int& i : ints)
{ std::cout << i; }
// or use the auto feature
for( auto addr : addrBooks )
{ std::cout << addr.first << ' ' << addr.second; }

3. 连写右角符号'>>'

// pass before c11
std::vector<std::vector<int> > vvints;
// pass in c11
std::vector<std::vector<int>> vvints11;
4. 在标准库中加入多线程的支持

5.



版权声明:本文为博主原创文章,未经博主允许不得转载。

posted @ 2013-03-29 11:35  J.Way.C  阅读(150)  评论(0编辑  收藏  举报