Finding value in unordered_map

前端 未结 4 1479
忘了有多久
忘了有多久 2021-01-11 14:49

I am using Boost unordered_map. I have a key value pair for each entry. How could I determine whether a particular value exist in the map? (I don\'t want to create another u

4条回答
  •  孤城傲影
    2021-01-11 15:55

    You need to iterate over all the elements in the unordered_map and see if the given value exists.

    The std::find_if algorithm with a custom predicate can be used to simplify this.

提交回复
热议问题