C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] const && and for( : ) loop
From: VALERIU SMERICA (valeriu.smerica_at_[hidden])
Date: 2021-02-03 06:18:49


Nice. Let the game begin.

On Wed, 3 Feb 2021 at 01:32, Ryan P. Nicholl via Std-Proposals <
std-proposals_at_[hidden]> 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_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>



STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups