opStarAssign?
0ffh
frank at frankhirsch.youknow.what.todo.net
Sat Nov 24 07:09:04 PST 2007
Frits van Bommel wrote:
> 0ffh wrote:
>> I'd guess that cases where both "x=y;" and "*x=y;" make sense are
>> rare. So overloading opAssign for the parameter type might be quite
>> sufficient.
>
> Even if they're rare, they *do* exist (for example, a variant type that
> can store both normal types and pointers).
You mean like:
int y=0;
Variant x=&y;
*x=3;
printf("%i\n",y); // prints 3
Wouldn't this be quite sufficient, without the need to "*x=":
int y=0;
Variant x=&y;
int* z;z=x;
*z=3;
printf("%i\n",y); // prints 3
Variant is obviously a very special case. I wonder if we really need
this... I think I see quite some potential for serious shootings of
feet here... okay, I'm all for it now! =)
regards, frank
More information about the Digitalmars-d
mailing list