Detecting value parameter of template instance in "is" expression

anonymous anonymous at example.com
Thu Dec 5 12:17:12 PST 2013


On Thursday, 5 December 2013 at 20:07:51 UTC, Uranuz wrote:
> //-------------------
> import std.stdio, std.typecons;
>
> template isStdNullable(N)
> {
> 	static if(
> 		is( N == Nullable!(T), T )
> 		|| is( N == NullableRef!(T), T )
> 		|| is( N == Nullable!(T, nV), T, T nV ) //There is an error
> 	)
> 		enum bool isNullable = true;
> 	else
> 		enum bool isNullable = false;
> 	
> }
>
>
> void main()
> {
> 	writeln(isStdNullable!(Nullable!(int, 10)));
> }
> //-----------------
> Compilation output:
> /d966/f969.d(8): Error: undefined identifier T, did you mean 
> alias N?
> /d966/f969.d(19): Error: template instance 
> f969.isStdNullable!(Nullable!(int, 10)) error instantiating
>
> How should I define value parameters inside "is" expression to 
> make code like this working?

is( N == Nullable!(T), T ... )


More information about the Digitalmars-d-learn mailing list