3 ms·
>checking if a map or set contain a key requires lots of code Well, we all have our own standards, but... std::set<int> numbers = ...; if (numbers.count(5
by 8xde0wcNwpslOw 8y ago
>checking if a map or set contain a key requires lots of code
Well, we all have our own standards, but...
std::set<int> numbers = ...;
if (numbers.count(5)) {} // we have a 5
- JanisL 8y agoWhat's the complexity of that operation?
- plorkyeran 8y agoIt is exactly the same operation as `contains()` for set/map. There's only a difference between `count()` and `contains()` for multiset/multimap.