For an STL set (s), it seems like you should be able to say:
if(s.find(x)) {
//Something
}
as opposed to
if(s.find(x) != s.end()) {
//Something
}
Furthermore, if set-iterators could be cast to bool (true if the internal pointer is not null), you would be able to. Why don't STL set iterators have this simple functionality? Was this intentionally left out?
CLARIFICATION:
Alternatively, set's could just have a set::contains(x) method which returns a bool directly, but this doesn't seem to be implemented either. I know it's only a couple characters, but in the case where s is a return value from some function, this can be frustrating because of the need to create a temporary variable, ie (supposing m is of type map<int,set<int>>)
const set<int>& s = m[i];
return s.find(x) != s.end();
as opposed to
return m[i].contains(x);
or
return m[i].find(x);
EDIT:
I didn't realize the count() method could be used as contains(). Voted to close since this question doesn't properly phrase what I really should have asked: Do STL::set's have a "contains" method?