How to make a fast search for an object with a particular value in a vector of structs or classes? c++

前端 未结 4 2020
无人及你
无人及你 2021-01-24 06:38

If I have thousands of struct or class objects in a vector, how to find those that are needed, in a fast way?
For example:
Making a game, and I need fas

4条回答
  •  故里飘歌
    2021-01-24 07:20

    For example:

    for_each(v.begin(),v.end(), [](int e) 
    {
        if (e%2==1)//vector elements that are not divided by 2 without remainder
        cout<

提交回复
热议问题