Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-02-24 09:55:50

Hello David,

gruenedd_at_[hidden] ha escrito:

> Hello,
> What is the status of key swapping, issued here[1]?
> Do you see a chance to have this included sometime? :]

Nothing like that has been included in Boost 1.34, and I decided
to finally not implement the idea because:

* It can be simulated externally (admittedly, not in an optimal
* I don't see as a commonly wanted feature.
* It implies weird semantics: swapping keys can result
in collisions arising in other indices. Consider for instance:

    ordered_unique<member<std::pair<int,int>,int,&std::pair<int,int>::first> >,
    ordered_unique<identity<std::pair<int,int> > >
> c;

c.swap_keys(c.begin(),++c.begin()); // would yield a duplicate element (1,1)

Not that this cannot be handled, but it implies that a possible outcome
of swap_keys() is that both elements get deleted or the operation
rolled back, which is IMHO a little surprising to the unadvertent user.

I'm sorry the answer to your proposal is negative.

> Best Regards,
> David
> [1]

On another issue, you might be interested to know that the problem
you brought forward in

has been solved in 1.34, and the very sample snippet you provided
then now compiles and works cleanly. The solution does not follow
your proposed approach, but uses boost::disable_if<> instead.
More info at

(third bullet). Best regards,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

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