If you want STL iterators to use a comparator other than operator<, you need to pass the comparator function to the constructor of the set or map or the algorithmic function in question (third parameter). http://www.cplusplus.com/reference/stl/set/set.html may be useful. The compare third argument to, say, sort(iterator, iterator, comparator=less); simply defaults to <. Thank you for the reply, I should have supplied ...