This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Fix stable_sort to work on iterators returning rvalue
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 28 May 2012 11:52:22 +0200 (CEST)
- Subject: Re: Fix stable_sort to work on iterators returning rvalue
- References: <4FBFEE9B.5080504@gmail.com>
- Reply-to: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
On Fri, 25 May 2012, François Dumont wrote:
dereference the iterator as late as possible
Cool :-)
that is to say only when we need to pass it to the std::move function.
As a side note, I am wondering whether, once the relevant DR is fixed, we
should aim to avoid move(*iter) and use *make_move_iterator(iter) instead
(or something similar, with the main effect that it doesn't turn
temporaries into rvalue references). It wouldn't have any effect here, but
in other cases it might allow the compiler to elide a move construction.
--
Marc Glisse