Boost logo

Boost :

Subject: [boost] Does Boost has an utility to replace all OLD Keys with NEW one for MultiMap/Map?
From: Tushar Chowdhury (tchowdhury80_at_[hidden])
Date: 2009-05-07 04:09:47

Hi Guys,
As of now I failed to get such an algo. I've come up with an proposed
solution. Please verify:

namespace Boost{
template <typename CONTAINER>
   void replace_key(CONTAINER& container,
                    const typename CONTAINER::key_type& oldKey,
                    const typename CONTAINER::key_type& newKey)
       typename CONTAINER::iterator begin(container.find(oldKey));
           if(begin != container.end()){
               container.insert(typename CONTAINER::value_type(newKey,
               begin = container.find(oldKey);

make sense?

Boost list run by bdawes at, gregod at, cpdaniel at, john at