Nice. Let the game begin.

On Wed, 3 Feb 2021 at 01:32, Ryan P. Nicholl via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
I'd like to suggest a meaningful designation for const &&..

Consider for example, the value pointed to by a std::shared_ptr, which might be a shared state and therefore immutable, but if you have an rvalue shared_ptr, it might be temporary and therefore destroyed at the end of the current context. Thus, T const &&, a temporary value which may not be modified, might have some meaning.

Currently for ( : ) loop doesn't extend lifetime of T&&. I suggest, first, if the evaluation expression of for ( : ) results in T && type, then all temporaries in the object to be iterated upon are extended in lifetime until the end of the loop body.

This would give some meaning to T const &&, since it would designate a temporary which may not be modified. (getting const overloads to the iterator values and such) while extending the lifetime of the shared pointer throughout the life of the loop body.

Thoughts?

--
Ryan P. Nicholl
Tel: (678)-358-7765

Tox: 52B3A61CDAF88BCC854F568933F071E3530600CDBA3D5354AADC9AD179575D68021AE959719D


--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals