GG wrote: > 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 !
Questions like this belong in the d.learn group. If you're using D2, you can use Variant. If you're using D1, and you don't want to use Tango, there's std.boxer.
