P
Przemek
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
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