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.
Yes, it is allowed.
std::pair
already has an operator<
which compares the two values in order, so you may not need to do anything special for a comparator at all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.