using STL to find all elements in a vector

前端 未结 7 657
时光取名叫无心
时光取名叫无心 2020-12-31 08:01

I have a collection of elements that I need to operate over, calling member functions on the collection:

std::vector v;
... // vector is popula         


        
7条回答
  •  傲寒
    傲寒 (楼主)
    2020-12-31 08:17

    Lamda functions - the idea is to do something like this

    for_each(v.begin(), v.end(), [](MyType& x){ if (Check(x) DoSuff(x); })  
    

    Origial post here.

提交回复
热议问题