|
Boost Users : |
From: David Gruener (gruenedd_at_[hidden])
Date: 2005-04-14 03:52:20
Joaquin M Lopez Munoz wrote:
> There's no particular provision for swapping keys. You
> could do something like:
>
> blah.modify_key(blah.find(foo1), _1 = unused_value);
> blah.modify_key(blah.find(foo2), _1 = foo1);
> blah.modify_key(blah.find(unused_value), _1 = foo2);
Well, i did something like this (in my case unused_value is INT_MIN).
But i really dont find that a clean solution. I think
the container must not assume that i always have something
like an "unused" value in the particular domain, it seems
easy for int, but that might not be true for other types.
> Providing a general key_swap facility is not as simple as it
> might seem
Thats what I expected. Not simple, but don't you think thats possible,
do you? I think we need a swap() for values too, because a value might
be used as a uniq key in another index. IMHO such a swap method is valuable.
--David
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