1 static assert( !hasBasicMathOp!int ); 2 static assert( hasBasicMathOp!float ); 3 static assert( hasBasicMathOp!double ); 4 static assert( hasBasicMathOp!real ); 5 static assert( hasBasicMathOp!cfloat ); 6 static assert( !hasBasicMathOp!char ); 7 static assert( !hasBasicMathOp!string ); 8 9 struct TTest 10 { 11 float x,y; 12 auto opBinary(string op)( in TTest v ) const 13 if( op=="+" || op=="-" ) 14 { return TTest(x+v.x,y+v.y); } 15 auto opBinary(string op)( double v ) const 16 if( op=="*" || op=="/" ) 17 { return TTest(x*v,y*v); } 18 } 19 20 static assert( hasBasicMathOp!TTest ); 21 22 struct FTest 23 { 24 float x,y; 25 auto opAdd( in TTest v ) const { return TTest(x+v.x,y+v.y); } 26 } 27 28 static assert( !hasBasicMathOp!FTest );