better than union and array questions

Saaa empty at needmail.com
Fri Sep 18 12:31:28 PDT 2009


(D1 Phobos)
I use the struct below like: Struct[][char[]] _struct;

Is there a better way to support arrays of any type?
Currently all the code working with these Structs are templated with loads 
of static ifs in them.

Also, is it possible to add a .deepdup property to all arrays?

One last question:
Will "a[]=b.dup;" copy b twice?

----

struct Struct
{
enum TYPE{ UNKNOWN, BOOL, BYTE,INT, FLOAT};
// I excluded boolean and byte to shorten this message
TYPE type = TYPE.UNKNOWN;
union
{
 float floatMin;
 int intMin;
}
union
{
 float floatMax;
 int intMax;
}
union
{
 int[][] intArray;
 float[][] floatArray;
}
}




More information about the Digitalmars-d-learn mailing list