C++ Logo

std-discussion

Advanced search

Re: subscripting fold expression

From: Christof Meerwald <cmeerw_at_[hidden]>
Date: Fri, 26 Apr 2019 08:47:12 +0200
On Thu, Apr 25, 2019 at 08:22:49PM -0700, Thiago Macieira via Std-Discussion wrote:
> On Thursday, 25 April 2019 15:42:16 PDT Nicolas Lesser via Std-Discussion
> wrote:
> > I'd expect it to return a std::tuple or some other tuple like type right?
> > Consider this:
[...]
> I expect you're right in terms of what the OP is expecting.

No.

> But if you talk
> about fold expression for operator[], I kinda expect the very unuseful
> expansion of foo(t, a0, a1, a2, a3) to be:
>
> t[a0][a1][a2][a3];
>
> I don't see how this is a likely usecase.

Yes, that's what I would be expecting. And we do support it for ".*"
and "->*" which don't look any more useful to me.

> Besides, how do you expand the zero-production of operator[] ?

Like any of the other (but 3) zero-productions for fold expression -
make it ill-formed.


And while we are on the topic. What would be the use-case for any of
the comparison operators that are allowed? Aren't those doing more
harm than good by being allowed (and not doing what a user might
expect)?


Christof

-- 
http://cmeerw.org                              sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org

Received on 2019-04-26 01:48:53