[patch, so_7]: Allowing __move on const references

chris jefferson caj@cs.york.ac.uk
Sun Sep 11 00:34:00 GMT 2005


Paolo Carlini wrote:

>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?
>  
>
Yes, and more accurate :)

Chris



More information about the Libstdc++ mailing list