signature constraint for generic types
问题 struct S(int a, int b) { } void fun(T)(T t) { } I want fun to work with S only. What would the signature constraint look like? I can't make fun a member of S , and with void fun(T)(T t) if(is(T : S)) { } I get Error: struct t1.S(int a,int b) is used as a type 回答1: S is not a type. It's a template for a type. S!(5, 4) is a type. It's quite possible that different instantiations of S generate completely different code, so the definition of S!(5, 4) could be completely different from S!(2, 5) .