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 <
> 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.
> Ryan P. Nicholl
> Tel: (678)-358-7765
> Std-Proposals mailing list
STD-PROPOSALS list run by email@example.com
Standard Proposals Archives on Google Groups