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<Key>); simply defaults to <.
Thank you for the reply, I should have supplied some code. My specific problem was
set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(c, c.begin()));
where
a,b,c are of type std::set<Key,CustomCompare>.
Apparently, std::inserter does not try to use CustomCompare.
I have implemented an operator< into the definition of Key, which does the job, but -
Can I not supply CustomCompare to std::insert_iterator somehow?
thanks.
EDIT:
alright, you supply it to set_intersect(...);