C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Automatic perfect forwarding is possible and not too complicated

From: Robin Savonen Söderholm <robinsavonensoderholm_at_[hidden]>
Date: Sun, 13 Apr 2025 17:46:35 +0200
But '&&' does not mean 'forwarding reference'. It means 'rvalue reference'.
It's just that an rvalue reference of an lvalue reference is an lvalue
reference.

// Robin

On Sun, Apr 13, 2025, 17:41 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
>
> On Saturday, April 12, 2025, Jonathan Wakely wrote:
>>
>>
>> The fact you don't have a better name for it than "trigraph reference" is
>> telling.
>>
>> I can imagine the conversations now:
>> "So what is this ugly &&& thing?"
>> "It's a trigraph reference"
>> "erm, ok ... so what does it do?"
>> "it's a qualifier composed of three characters."
>> "ok, but what does it mean?"
>> "it's like && but 50% more."
>>
>
>
>
> Call it a _Kangaroo reference if ya want:
>
> template<typename T>
> void Func( T _Kangaroo arg ) { }
>
> Or maybe move the _Kangaroo part somewhere else:
>
> template<typename _Kangaroo T>
> void Func( T &&arg ) { }
>
> I'm not too fussed about the syntax or what it's called, or even if its
> invention is attributed to me. Just want a function argument that
> automatically gets forwarded where it is safe and efficient. Maybe
> _AutoForward would be more intuitive than _Kangaroo, although the image of
> a majestic kangaroo in locomotion does conjure up mental images of hopping
> forward with efficiency, and such mental images might spur programmers on
> to enthusiastically adopt the new feature. Actually yeah I'll go with
> _Kangaroo.
>
> ......although actually I don't want to seem biased toward Australian
> ideals of locomotive supremacy. Let me mull this one over because I'm not
> sure if Americans see eye to eye with the Ozzies -- and the last thing I
> want is for Trump to up tariffs, all because an Irishman wanted a cool name
> for his new feature.
>
> By the way, and I know that there's no point in saying this now since
> C++11 happened 15 - 25 years ago, but I think that choosing '&&' as the
> notation for forwarding references was beyond horrid. I don't know how that
> got accepted by a majority of sane, rational, skilled C++ programmers. I
> didn't program for a few years around about that time period owing to a
> bereavement, but if I had been on the circuit at the time I'd have been
> harassing all of you loudly with a megaphone with backup batteries to urge
> you all to see sense. '&&' for forwarding references is horrendous. I
> probably would have pushed for something like "LorR" to mean "Lvalue or
> Rvalue", something like:
>
> template<typename T>
> void Func( T LorR arg ) { }
>
> This would of course mean that we could do the following:
>
> template<typename T>
> void Func( T LorR arg0, T &&arg1 ) { }
>
> Guess what that second argument is . . . yeah you guessed right . . . it's
> a bloody R-value reference. Isn't that something.
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-04-13 15:46:47