Hi,

I believe it's aligned for sequence containers, and subscript returns `reference` for a non-const container there, regardless of value category.

Cheers,
Lénárd



From: Giuseppe D'Angelo via Std-Proposals <std-proposals@lists.isocpp.org>
Sent: March 10, 2022 11:10:53 PM GMT+00:00
To: std-proposals@lists.isocpp.org
Cc: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Subject: Re: [std-proposals] C-style array specialization for std::get

On 10/03/2022 20:20, Zhihao Yuan via Std-Proposals wrote:

But other than the built-in array,
no operator[] in the standard is
aware of value-category (std::array,
std::vector, etc.) The built-in
array is special here as its "[i]"
models after a member access.

To be honest, this prompts the question as if this was an oversight
(does std::array predate move semantics?) or a deliberate design
decision to align with e.g. std::vector.

(I can understand why std::vector operator[] hasn't been changed to
return rvalue references invoked on a rvalue vector.)

Thanks,
--
Giuseppe D'Angelo