Access to intersection fields of an algebraic data type

sighoya sighoya at gmail.com
Sat Jan 19 17:40:53 UTC 2019


Is there a solution for the following problem:

import std.variant : Algebraic;

struct A
{
     int a=2;
}

struct B
{
     int a=2;
};

void main()
{
     Algebraic!(A,B) c=A();
     writeln(c.a);
     return;
}

Error: no property a for type VariantN!(4LU, A, B)


More information about the Digitalmars-d mailing list