C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Improved Member Operator Syntax
From: Tae Lim Kook (uruwi_at_[hidden])
Date: 2019-10-17 10:29:14


On Thursday, October 17, 2019 4:57 AM, Jake Arkinstall via Std-Proposals <std-proposals_at_[hidden]> wrote:

> It's an interesting idea. Perhaps it needn't be a change, but an addition - allow one or the other. I'm not sure if it's solving a major problem, but the whole fake int parameter bodge is certainly a slight annoyance.
>
> Im against using "this" though. "this" is a pointer and I believe it might confuse people to have a syntax that *almost* looks like a pointer increment but actually defines a custom increment on the object. If we had a keyword that mapped to (*this), E.g. Python's "self", I'd choose that keyword instead.

I have another idea for how to improve member operator syntax. How would this work?

ResultType operator infix+(RightSideType); // a + b
ResultType operator prefix+(); // +a
ResultType operator prefix++(); // ++a
ResultType operator postfix++(); // a++


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups