Reputation: 13267
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.
Upvotes: 0
Views: 2778
Reputation: 16320
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.
Upvotes: 6