Need trait of isPod.

Paolo Invernizzi arathorn at NOSPAM_fastwebnet.it
Wed Oct 10 06:26:09 PDT 2007


This static assert is false under GDC 0.24...

template isAssocArrayType( T )
{
    const bool isAssocArrayType = is( typeof(T.init.values[0][typeof(T.init.keys[0])]) == T );
}
static assert( isAssocArrayType!( int[char[]] ) );

Paolo


Marcin Kuszczak Wrote:

> Paolo Invernizzi wrote:
> 
> > Not related... but what's the expression for testing an associative
> > array? DMD 1.0 please...
> > 
> > Paolo
> >
> 
> I found following template in Tango core/Traits.d:
> 
> private template isAssocArrayType( T )
> {
>     const bool isAssocArrayType = is( typeof(T.init.values[0]
> [typeof(T.init.keys[0])] == T );
> }
> 
> I don't know if it really works (why is there private access qualifier???).
> 
> Probably better answer could give Tango people... and tests of course :-)
> 
> -- 
> Regards
> Marcin Kuszczak (Aarti_pl)
> -------------------------------------
> Ask me why... I believe in Jesus - http://www.zapytajmnie.com (en/pl)
> Doost (port of few Boost libraries) - http://www.dsource.org/projects/doost/
> -------------------------------------
> 




More information about the Digitalmars-d mailing list