Array collection ?
GG
g at g.com
Tue Feb 9 22:16:53 PST 2010
Actually I use an associative array with name as index, to contain different data but it allows only string type. It forces me to cast all time.
ex:
string[char[]][int] a;
a[0]["Month"] = "Jan";
a[0]["Profit"] = to!string(1000); // when I want use this as int, I use : to!int()
a[0]["Expenses"] = "6000"; // when I want use this as int, I use : to!int()
But as you can see, "Profit" and "Expenses" should be int or double to avoid cast when I want calculate these fields.
It works with cast but I suppose it's slower than use exact type.
I would like to know if it's possible to have a associative array with multiple type as a collection with phobos.
Thanks !
More information about the Digitalmars-d
mailing list