Need trait of isPod.

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Wed Oct 10 07:37:25 PDT 2007


Paolo Invernizzi wrote:
> 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[]] ) );

The closing bracket of the first typeof() is misplaced. The correct code is
---
template isAssocArrayType( T )
{
     const bool isAssocArrayType = is( 
typeof(T.init.values[0])[typeof(T.init.keys[0])] == T );

}

static assert( isAssocArrayType!( int[char[]] ) );
---

Which also seems to be how it appears in Tango. Maybe Marcin typed it 
over from Tango with a typo? (since the file hasn't changed for 7 months 
according to the svn repository, a copy-paste from an older buggier 
version seems unlikely)



More information about the Digitalmars-d mailing list