C++ Logo

std-proposals

Advanced search

Re: Language Feature for Reducing Duplicated Code

From: Gašper Ažman <gasper.azman_at_[hidden]>
Date: Wed, 22 Jul 2020 11:33:40 +0100
The wording changes that.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0847r4.html

The *new* version of the wording makes the wording far more clear (could
have sworn we sent it in a mailing, but I guess we'll have to send it
again):
https://htmlpreview.github.io/?https://raw.githubusercontent.com/BRevzin/cpp_proposals/master/0847_deducing_this/d0847r5.html
is the status quo of the paper. There are no design changes or semantic
woding changes, just Jens', Barry's and my wording refactors.

The relevant bits:

5b A function parameter declared with an
*explicit-this-parameter-declaration* is an *explicit this parameter*. An
explicit this parameter shall not be a function parameter pack
([temp.variadic]). An *object member function* is either a non-static
member function or a static member function with an explicit this parameter.

Change 12.6.4 [over.sub] <https://wg21.link/over.sub>/1:

1 A *subscripting operator function* is a function named operator[] that is a
non-static an object member function with exactly one ordinary member
parameter.


On Wed, Jul 22, 2020 at 11:14 AM Ville Voutilainen <
ville.voutilainen_at_[hidden]> wrote:

> On Wed, 22 Jul 2020 at 12:38, Gašper Ažman via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > Isn't it wonderful that deducing this makes the above SO much easier to
> do?
>
> Does it? an operator[] needs to be a non-static member function, and a
> deduced-this function isn't.
>
> >> T & operator[](size_t i) &;
> >> const T & operator[](size_t i) const &;
> >> T && operator[](size_t i) &&;
> >> const T && operator[](size_t i) const &&;
>

Received on 2020-07-22 05:37:11