C++ Logo


Advanced search

Re: [wg14/wg21 liaison] [isocpp-ext] P2128, multi-dimensional subscript operator

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 4 Oct 2021 14:25:26 +0300
On Mon, 4 Oct 2021 at 14:05, Corentin <corentin.jabot_at_[hidden]> wrote:
> The premise that "in C++ [] should return an lvalue" is not based in existing practices. As observed, the proposal does not dictate the value category of the return object.
> So, I am not sure how this is a SG22 matter. C has no reference, if a similar proposal was adopted in C, it would be limited to lvalue (Similarly, C functions return lvalues, c++ functions and call operators might not, and none of the containers return an actual lvalue).
> If anything, this proposal alleviate the need of proxies by allowing to index the underlying object directly instead of having[muliple][intermediate][proxies].

The gist of the matter is not lvalues and proxies, it's

"A more useful core language meaning might be:

    int a[4] = {1,2,3,4};

    a[1,2] = a[2,1]; // swap
    a[1,2,3,0] = a[0,1,2,3]; // it's a rotate !

> So, from what I understand, this person objects to the C++ proposal as a whole, rather than it being a C compatibility concern.

It's a question of one committee performing a syntactic and semantic
land grab, and that constraining what the other committee
can evolve their language to. That makes it a liaison concern. Thus my
question whether this was ever discussed in a SG21
meeting. Thus far I'll take these responses as a "no".

Received on 2021-10-04 06:25:40