Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-06-06 18:58:55

Konstantin Litvinenko wrote:
> Hello, Thorsten!
> You wrote on Thu, 01 Jun 2006 18:49:17 +0200:
> KL>> 2) Why ptr_multimap_adapter::transfer( iterator object,
> KL>> ptr_multimap_adapter& from ) has void return type instead of iterator?
> TO> Why do you think it should return an iterator?
> ptr_multimap<std::string, int> a1;
> ptr_multimap<std::string, int> a2;
> typedef ptr_multimap<std::string, int>::iterator iterator;
> a1.insert("a", 1);
> a1.insert("a", 2);
> a2.insert("a", 1);
> a2.insert("a", 2);
> iterator i = a1.insert("a", 3);
> iterator r = a2.transfer(i, a1); /// Will not work
> return r;

I see.

The return value has been a little different than the usual ones.
For example, insert() in ptr_set<> returns bool.

> How can I do this with current interface in a simple way?

I'm afraid there is no simple way to do it.

If you're not afraid of using the main cvs, I can update that.

Do you agree that for ptr_set/ptr_map the return value should be

single object transfer: std::pair<iterator,size_type>
multi object transfer: std::pair<iterator,size_type>

and for ptr_multiset/ptr_multimap the return value should be the same too?

I'm not saying this is the only options. Just a suggestion.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at