132818Creator

最近写for循环,发现以前用过的方法都忘记了,这里整理下几种方法,欢迎大佬补充:

 

1、

for(itnt n =1;n<5;n++)

{

}

2、

for (auto it = list.begin(); it != list.end(); ++it)  
{  

}

3、

for each(auto item in list)  
{  
//item是list每个元素的值
}   

4、

for (auto item : list)

{

//item是list每个元素的值

}

5、

std::for_each(list.begin(), list.end(), [](string item)
{
string A = item;
});

分类:

技术点:

相关文章:

  • 2021-12-18
  • 2022-01-15
  • 2021-11-30
  • 2021-12-18
  • 2021-12-18
  • 2021-11-14
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2021-12-18
  • 2021-12-28
  • 2021-12-18
  • 2021-12-18
  • 2021-12-18
相关资源
相似解决方案