Distinct keys in the multimap
From: Przemek (przemyslaw.sliwa_at_gazeta.pl)
Date: 01/31/05
- Next message: Ioannis Vranos: "Re: C++ anamaly"
- Previous message: msalters: "Re: Intialisation order and statics"
- Next in thread: Ron Natalie: "Re: Distinct keys in the multimap"
- Reply: Ron Natalie: "Re: Distinct keys in the multimap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Jan 2005 05:39:33 -0800
All,
what is the efficient way to find all distinct keys in a multimap.
I use the code
template<class T1, class T2>
set<T1> GetDistinctKeys(multimap<T1, T2> nMap)
{
T1 temp;
multimap<T1, T2>::iterator i_ptr;
set<T1> lSet;
for(i_ptr=nMap.begin(); i_ptr!=nMap.end(); ++i_ptr)
{
lSet.insert(i_ptr->first);
}
return lSet;
}
but perhaps you have some fresh ideas :)
Pshem
- Next message: Ioannis Vranos: "Re: C++ anamaly"
- Previous message: msalters: "Re: Intialisation order and statics"
- Next in thread: Ron Natalie: "Re: Distinct keys in the multimap"
- Reply: Ron Natalie: "Re: Distinct keys in the multimap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]