Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-05-04 17:57:56


Hi Joaquin,

>even swappable. A paradigmatic case of use is
>Boost.PtrContainer: the types held in this kind
>of containers are in general not swappable, but
>an iter_swap() overload than simply exchanges the
>internal pointers makes a lot of sense: the
>overall result is that rotate, reverse, etc.
>will work as expected, save the minor detail that
>this "extended swap" concept does not work as
>usual with raw pointers to the ext-swapped elements
>--only iterators to the elements get their
>pointed-to elements interchanged.
>
>What do you think of this? IMHO this can solve
>the problem of making std swapping algorithms
>work with ptr_containers, a problem for which
>(if I'm not wrong) no satisfying solution has been
>designed.

you're right that no satisfiable solution has been reached.

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1771.html

explains a different way to fix standard algorithms by mandating moving is
used if available.

my understanding of this, based on discussion with Howard, is that we can
actually
make an iterator with a proxy-reference for pointer containers that works.

hence I don't feel a great need to do anything about it right now.

-Thorsten


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