== Quote from bearophile (bearophileh...@lycos.com)'s article > Oliver: > > ... > struct Ts { > int d; > union { > int[] intData; > double[] doubleData; > } > } > struct Rs { > int i; > union { > int intData; > Ts* tsData; > } > this(int i, int d, int[] data) { > this.i = i; > this.tsData = new typeof(*tsData); > this.tsData.d = d; > this.tsData.intData = data; > } > } > Rs* makeData(int i, int d, int[] data) { > return new Rs(i, d, data); > } > void main () { > int i = 1; > int[] data = [1, 2]; > auto test = makeData(i, 1, data); > } > - You have not created the pointed inner struct.
Yes, thanks, I got it. > - Don't use aliases like those ones, they confuse the code. > - Struct names are better with a starting uppercase letter in D. > Bye, > bearophile Thanks for the comments. Olier