C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Make 'this' a reference
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-03-05 03:22:10


On Thu, 5 Mar 2020 at 10:59, Jake Arkinstall via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> I'd choose a different new keyword rather than add a new rule on 'this' which is bound to have some confusing edge cases (especially when passing this to template functions - does it resolve as a pointer? A reference? A special object that tries to behave as both?).
>
> I'd personally go with self ≡ *this, such that self.member = this->member.

And then we'd just decide that a local self shadows the special
meaning, since using such a name is fairly
widespread in existing code. Seems like a complication not worth its benefit.


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups