retrieving key and value type of an associative array (D1)

bearophile bearophileHUGS at lycos.com
Thu Feb 24 04:17:30 PST 2011


Funog:

> Thanks ^^ But I actually asked my question wrong ; I also need to check 
> whether abc is an associative array or not.

Adapted from the module tango.core.Traits:

template IsAA(T) {
    const bool IsAA = is( typeof(T.init.values[0])[typeof(T.init.keys[0])] == T );
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list