This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch, so_7]: Allowing __move on const references
- From: Paolo Carlini <pcarlini at suse dot de>
- To: chris jefferson <caj at cs dot york dot ac dot uk>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sat, 10 Sep 2005 20:23:52 +0200
- Subject: Re: [patch, so_7]: Allowing __move on const references
- References: <4323026C.4030306@cs.york.ac.uk>
Hi Chris,
>+ // We shouldn't need this overload of __move. It is needed in particular
>+ // for forward (and better) iterators which don't return a non-const
>+ // reference to the value they represent. The standard says there shouldn't
>+ // be any such iterators. Then someone wrote vector<bool>, which breaks that
>+ // rule.
>
First, thanks for the patch, I will commit it soon.
In a nitpicking mood, maybe the comment could be improved: in my
understanding the real problem is with iterators having operator*()
returning by *value* not by const& (const& is a legal return type,
24.1/4). In fact, the latter return type, thanks to the "templatization"
of __move are already "digested" and processed correctly by your
infrastructure: only, downstream, correcty (otherwise we would move
const objects!), __is_moveable is false.
Do you agree that saying simply "by value" instead of "non-const
reference" is clearer?
Paolo.