Need trait of isPod.

Matti Niemenmaa see_signature at for.real.address
Tue Oct 9 05:57:43 PDT 2007


Aarti_pl wrote:
> Yang Bo pisze:
>> Because I really want to know whether a type is pod.
> 
> Simple template should be just enough.
> 
> See: http://dsource.org/projects/tango/browser/trunk/tango/core/Variant.d
> 
> 
> template isAtomicType( T ) {
> 	static if( is( T == bool )
>  		|| is( T == char )
>  	        || is( T == wchar )
>  	        || is( T == dchar )
>  	        || is( T == byte )
>  	        || is( T == short )
>  	        || is( T == int )
>  	        || is( T == long )
>  	        || is( T == ubyte )
>  	        || is( T == ushort )
>  	        || is( T == uint )
>  	        || is( T == ulong )
>  	        || is( T == float )
>  	        || is( T == double )
>  	        || is( T == real )
>  	        || is( T == ifloat )
>  	        || is( T == idouble )
>  	        || is( T == ireal ) )
>  		const isAtomicType = true;
> 	else
>  	        const isAtomicType = false;
> }

That misses structs, which are also POD.

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list