I want to define a std::map with key as std::pair<std::string, std::string> something like follow
typedef std::map< std::pair<std::string, std::string>, std::string> my_map
Is this allowed, and how do i write comparasion operator for such map.
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.
Yes, it is allowed.
std::pairalready has anoperator<which compares the two values in order, so you may not need to do anything special for a comparator at all.