Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-06-03 13:59:23


Rodolfo Lima skrev:
> Thorsten Ottosen escreveu:
>> iterator insert( iterator, ref_pair<key,T*> ).
>>
>> such that we can insert an element from another ptr_map.
>>
>> Would this be satisfactory?
>
>
> Hi, I was thinking of something along the lines of
>
> iterator insert(iterator, const key_type &key, std::auto_ptr<T> ptr);
>
> and
>
> iterator insert(iterator, const key_type &key, mapped_type val);
>
> to mimic the insert overload that doesn't take the iterator.

Ok. I'll add those.

> And while you're at it, I've noticed that the member
> std::pair<iterator,bool> ptr_map_adapter::iterator(key_type &key,
> mapped_type x)
>
> takes the key as a non-const reference, is there a reason for that?

Yes. It provides stronger exception-safety guarantees (though not
bullet-proof) since then creating a key must be done in a seperate
statement.

-Thorsten


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net