Proof of concept - library AA

IgorStepanov via Digitalmars-d digitalmars-d at puremagic.com
Sat May 30 07:13:49 PDT 2015


> struct Foo
> {
>     int a;
>     static Foo opImplicitConstructFrom(T)(T val) if(is(T : int))
>     {
>         return Foo(val);
>     }
> }

void test(Foo foo, int i)
{
     assert(foo.a == i);
}

test(42, 42); ->
test(Foo.opImplicitConstructFrom(42), 42);


More information about the Digitalmars-d mailing list