digitalmars.D - Re: Associative Arrays
- Stewart Gordon <smjg_1998 yahoo.com> Mar 16 2007
Dan Wrote:Walter, what's happening with them? Last I checked, I couldn't use practically anything of them: const char[] TEXT_x = "x"; int[char[]] x; x.length = 1; // doesn't work, no property length
Of course it doesn't. You can't set the length of an AA: - you can't use it to add elements, because an AA element cannot exist without a key - you can't use it to remove elements, as how would it know which to remove?x["hello"] = 1; // doesn't work, array out of bounds x[TEXT_x] = 1; // doesn't work, array out of bounds
Works for me (DMD 1.009, Win98SE). Which version and OS are causing a problem for you? <snip>Is it possible to use opIndex etc to override associatives?
What do you mean? Stewart.
Mar 16 2007