Detecting array type without template specialization?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Tue May 9 18:43:16 PDT 2006
"Sean Kelly" <sean at f4.ca> wrote in message
news:e3qub9$odc$1 at digitaldaemon.com...
> template isArrayType( T ) { const bool isArrayType = false; }
> template isArrayType( T : T[] ) { const bool isArrayType = true; }
>
> template Spoon( T )
> {
> void knife()
> {
> static if( isArrayType( T ) )
> writefln( "array" );
> else
> writefln( "not array" );
> }
> }
Oh cool.
Thanks :)
More information about the Digitalmars-d-learn
mailing list