C++ Logo

std-proposals

Advanced search

Re: Language Feature for Reducing Duplicated Code

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 22 Jul 2020 13:14:15 +0300
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:17:44