gcc内置的for each
2012-05-15 12:08:53 来源:WEB开发网核心提示:#include <stdio.h>#include <string>#include <vector>#include <map>int main(int argc, char **argv){std::vector<int> myint;std::map&
#include <stdio.h>
#include <string>
#include <vector>
#include <map>
int main(int argc, char **argv)
{
std::vector<int> myint;
std::map<int,int> mymap;
for(int i=0;i<12;i++)
{
myint.push_back(i);
mymap[i]=i;
}
for(std::pair<const int,int> &x : mymap)
{
x.second=2*x.second;
}
for (auto &x : myint)
{
x=2*x;
}
for (auto x : myint)
{
printf("%d\n",x);
}
for(std::pair<const int,int> &x : mymap)
{
printf("%d %d\n",x.first,x.second);
}
return 0;
}
- ››Form Reset Function
- ››gcc内置的for each
- ››FOREACH 宏之GCC实现
- ››ForeFront让企业VPN连接高枕无忧
- ››Forefront TMG日志记录功能
- ››Forefront Security For Exchange文件传送限制测试...
- ››Forefront Security For Exchange关键字测试
- ››Forefront Security For Exchange的反病毒测试
- ››Forefront Security For Exchange部署指南
- ››gcc和g++的区别(很详细的描述)
- ››内置最新英特尔至强 联想服务器构筑数字法庭
- ››内置N多模板轻松制作Flash动感相册
更多精彩
赞助商链接
