Subject: [std-proposals] Operator for reference casting
From: Bengt Gustafsson (bengt.gustafsson_at_[hidden])
Date: 2021-01-15 09:44:10
The operator approach has the advantage that you don't have to mention
the type name.
I think it should be a prefix operator, the only postfix operators we
have are ->, . and  and they all mean "get me part of" the lhs.
I would prefer >x or maybe >>x or =>x. There could be some template
related parsing issues with thw two first ones, but I don't see that
right off the bat.
Preferably the operator should work both as move and as forward, it is a
struggle understanding which one to use and why you have to provide the
type to forward but not to move (yes I know it is logical, but it is
still an obscure part that could be simplified). We definitely don't
want to get into a situation where we can use >x for forward and still
have to use std::move(x) in the other case.
But my understanding is that you can always use forward<T>(x) and
move(x) is just a shortcut which is allowed when you know that x is a
parameter passed by rvalue reference.
STD-PROPOSALS list run by firstname.lastname@example.org
Standard Proposals Archives on Google Groups