use variant as associative array

downs default_357-line at yahoo.de
Thu Feb 11 15:19:29 PST 2010


On 10.02.2010 22:28, GG wrote:
> I try to use variant as associative array with dmd2.039, 
> 
> Variant[char[]][int] aa;
> aa[0]["Month"] = "Jan";
> aa[0]["Profit"] = 500;
> aa[1]["Month"] = "Feb";
> aa[1]["Profit"] = 800;
> 
> I got core.exception.RangeError at main(28): Range violation
> I'm doing something wrong ? Or it's same problem as :
> http://digitalmars.com/d/archives/digitalmars/D/Variant_string_associative_array_..._fail_87248.html
> Same problem with dmd2.040
> 
> Thanks !
> GG

I don't have a D2 compiler, but try this.

Variant[char[]] v;
aa[0] = v;
aa[0]["Month"] = "Jan";

If that also fails, file a bug.


More information about the Digitalmars-d-learn mailing list