How do you check that an element is in a set?
Is there a simpler equivalent of the following code:
myset.find(x) != myset.end()
The typical way to check for existence in many STL containers such as std::map, std::set, ... is:
std::map
std::set
const bool is_in = container.find(element) != container.end();
2.1m questions
2.1m answers
60 comments
57.0k users