On Thu, Mar 22, 2012 at 07:04:09PM +0100, Andrej Mitrovic wrote: > On 3/22/12, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote: > > Your test files work ok. > > Well unfortunately isAssociativeArray from std.traits fails on your > hashes (reasonable, since it calls __traits internally and has no way > of knowing about external hashes). > > I also can't use your hashes with some helper functions that I use: > > template ValueType(V : V[K], K) { > alias V ValueType; > } > > The function that needs the above is: > > void addKey(AA, Key)(ref AA hash, Key key) > if (isAssociativeArray!AA && is(KeyType!AA == Key)) > { > hash[key] = (ValueType!AA).init; > } > > I can temporarily remove those constraints, but how do I extract the > value type of your hash?
Hmm. Perhaps some aliases are in order? struct AssociativeArray(K,V) { ... alias Key keytype; alias Value valuetype; ... } Presumably this won't be an issue once it's integrated with dmd. But these aliases might be useful for other things, too. T -- "You know, maybe we don't *need* enemies." "Yeah, best friends are about all I can take." -- Calvin & Hobbes