serialization library - associative arrays ?

Christian Kamm kamm at nospam.de
Thu Dec 21 13:15:30 PST 2006


> Hm, is there a way to check if a template parameter is an associative  
> array and to get the key and value type without relying on .keys and  
> .values?

What I'm planning on using is:

static if(
   !is(T == struct) &&
   !is(T == class) &&
   is(typeof(T.keys) KEY == KEY[]) &&
   is(typeof(T.values) VALUE == VALUE[])
)
{
   // static assert( is(T == VALUE[KEY]) );
}

It seems to work, but is rather clumsy.

Christian



More information about the Digitalmars-d-announce mailing list