Just saw a question on STL. The question is
“<“does not need to be overloaded when the key of map belongs to certain types.
What are these types?
Don’t quite understand this question! Thanks for answering.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming the map is instantiated with the default comparator (i.e. as
map<Key,Value>with no third argument):std::less<Key>has been specialised (as long as the specialisation doesn’t requireoperator<).operator<.For any other key type, the map will try to compare them using an expression like
key1 < key2, which will only compile if there is an overload ofoperator<for the key type.