serialization library - associative arrays ?

Christian Kamm kamm at nospam.de
Thu Dec 21 14:11:43 PST 2006


> static if(is(T == typeof(T.values[$])[typeof(T.keys[$])]){
> 	// it is an AA, now do your KEY and VALUE magic
> }

Good idea! However, it doesn't compile for T = int, for example (unless  
that was changed between 0.173 and 0.177):
- no property 'keys' for type 'int'

Why is T.values[$] allowed, though - and is the [$] neccessary? I've so  
far relied on typeof returning the type of the return value for functions,  
but couldn't find it in the spec. Maybe it would be best to use  
is(T.values VALUE == return)?

Christian



More information about the Digitalmars-d-announce mailing list