Thanks for the feedback guys, but I have to say one more time that I just wanted to simplify it. Also, maybe the subject field was not chosen very well. "The syntax of forward and move and a possible implementation as  macros" might have been a better choice, at least it does not conflate macros and templates trying to keep it short. Anyway, please try out the code from the original email, it works quite well, and all the building blocks already exist. One simply does not have to keep track of the template parameter T anymore. One more thing, I definitely agree on "minimal-syntax".... and my whole point was that a macro will do it as of now. But, if we consider extending the syntax, then it does not have to be a macro anymore, of course, and that would definitely like that. On a related note, it would be nice if those macros could be tucked away safely into a namespace,... but I digress.



On Mon, Aug 29, 2022 at 5:25 PM Михаил Найденов via Std-Proposals <> wrote:

On Mon, Aug 29, 2022 at 5:08 PM Marcin Jaczewski <> wrote:
pon., 29 sie 2022 o 15:54 Михаил Найденов via Std-Proposals
<> napisał(a):
> I personally think, this should be a minimal-syntax, non-overridable, unary postscript operator that will work for both forward and move, much like cast-to-T&& today
> template <typename T> Dog(T&& name) : name(name&&)  //< forward
> {}
> Name(string&& aName) : name(aName&&)  //< move
> {
>   cout << "Rvalue Name constructor." << endl;
> }
> If there is ambiguity with binary operator &&, the latter is chosen
> template<class T>
> void func(T&& a, int b) {
>   a&&-b   //< ok, still operator&&(a,-b)
>   (a&&)-b //< ok, std::forward<T>(a) - b;
> }

Should this be the other way around? `&&a` not `a&&`?
As far I understand this is available in standard but it is used by
computed goto labels in GCC.

Nah, the idea is not have the association with address-of (double ampersand before a value looks like address-of-address-of, similar to the pointer-to-pointer syntax)
where if it is behind, has the association of universal/r-value references (behind the type, now behind the value, simple)

Lastly, this way one can have usage as: 
Which will do forward-and-call, something often needed in generic code.
Because we lack a natural syntax, and the official one is a nightmare, some people, like Eric Niebler, are forced into using the hacky c-cast 


Or alternatively, people invent a FWD macro... which is a macro. 
Std-Proposals mailing list