Date: Fri, 11 Mar 2022 00:10:53 +0100
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,
>
> 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
Received on 2022-03-10 23:10:58