alias not valid with ~

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 18 18:15:04 PST 2017


On 19/01/2017 3:08 PM, Ignacious wrote:
>
> class Y
> {
>    int y;
>    alias y this;
> }
>
> class X
> {
>    Y[] x;
>    alias x this;
> }
>
>
> Yet X ~= 3; fails.
>
> 3 should be implicitly convertible to Y and then ~ should assign it.
>
> ?

This should not fail:

X x = new X;
x ~= 3;

This should fail as x is a member of an instance of class X:

X ~= 3;


More information about the Digitalmars-d-learn mailing list