Date: Wed, 5 Jul 2023 22:12:46 +0100
On Mon, Jun 26, 2023 at 7:30 AM Frederick Virchanza Gotham wrote:
>
> Personally I like the idea of having '^^' as a unary operator that
> works as either 'move' or 'forward':
>
> template<class T>
> void Func(T &&arg)
> {
> static T obj;
> obj = ^^arg;
> }
I'm bringing this up again because I think something should be done about it.
A few people would like for us to have an operator for "move" and "forward".
One person suggested a unary '&&' operator, as follows:
template<class T>
void Func(T &&arg)
{
static T obj;
obj = &&arg;
}
and another person wrote a paper in which they suggested a unary '&&'
postfix operator:
template<class T>
void Func(T &&arg)
{
static T obj;
obj = arg&&;
}
Either of these would be fine unless anyone can think of a situation
where it could possibly be interpreted as the binary '&&' operator (I
don't think there is any such circumstance).
If implementing unary '&&' operator would be a nightmare for parsers,
then maybe it would be easier to implement "^^", as in:
template<class T>
void Func(T &&arg)
{
static T obj;
obj = ^^arg;
}
>
> Personally I like the idea of having '^^' as a unary operator that
> works as either 'move' or 'forward':
>
> template<class T>
> void Func(T &&arg)
> {
> static T obj;
> obj = ^^arg;
> }
I'm bringing this up again because I think something should be done about it.
A few people would like for us to have an operator for "move" and "forward".
One person suggested a unary '&&' operator, as follows:
template<class T>
void Func(T &&arg)
{
static T obj;
obj = &&arg;
}
and another person wrote a paper in which they suggested a unary '&&'
postfix operator:
template<class T>
void Func(T &&arg)
{
static T obj;
obj = arg&&;
}
Either of these would be fine unless anyone can think of a situation
where it could possibly be interpreted as the binary '&&' operator (I
don't think there is any such circumstance).
If implementing unary '&&' operator would be a nightmare for parsers,
then maybe it would be easier to implement "^^", as in:
template<class T>
void Func(T &&arg)
{
static T obj;
obj = ^^arg;
}
Received on 2023-07-05 21:12:59