Well, you can have sort of what you're after by using multiset instead of multimap like the following: Suppose your multimap is originally defined as:
std::multimap<type_a,type_b>
So, define a struct holding the two parts of the multimap:
struct pair_ab
{
type_a first; // names of members à la std::pair
type_b second;
bool operator<(const pair_ab& x)const
{
if(first<x.first)return true;
if(x.first<first)return false;
return second<x.second;
}
};
and replace your multimap with
std::multiset<pair_ab>
Now, this multiset really behaves as a multimap on type_a with the added feature that elements with equivalent first members are further sorted by second. Please report back if this works. Good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo