Boost logo

Boost :

From: gruenedd_at_[hidden]
Date: 2006-02-28 06:11:28


Joaquín Mª López Muñoz wrote:
> c.insert(std::make_pair(0,1));
> c.insert(std::make_pair(1,0));
> c.insert(std::make_pair(1,1));
> c.swap_keys(c.begin(),++c.begin()); // would yield a duplicate element (1,1)

> ... it implies that a possible outcome
> of swap_keys() is that both elements get deleted

That`s what i would expect here. :]
Now, why is this surprising? Consider the following snippet:

multi_index_container<int> c; // default "set"-like
c.insert(1);
c.insert(2);
c.modify_key(--c.end(), _1 = 1);

Isn`t it "surprising" in the same way, that c.size() == 1? ;-)

> On another issue, you might be interested to know that the problem
> you brought forward in
>
> http://lists.boost.org/Archives/boost/2005/02/80589.php
>
> has been solved in 1.34

Nice!

Best Regards,
David.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk