Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-05-05 07:46:45


Thorsten Ottosen ha escrito:

> >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.

Could you elaborate on this? I'm interested on how to apply this tecnhique
for my own purposes. Thank you,
>>>>>>>>>

well, first of all, it requires the algorithm to move elements around if it
can (so nothing will work until C++0x).

secondly, your reference-type of the iterator is a proxy that can be moved
where moving it actually moves the pointer underneith.

maybe there is more to it, but Howard assured my that the algorithms in
question would never do a lvalue to rvalue conversion
(from the iterators reference to its value type)

-Thorsten


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