1 interface IFace 2 { 3 void func1( int ); 4 size_t func2( string ); 5 } 6 7 struct Afunc1 { void opCall( int ){} } 8 struct Afunc2 { size_t opCall( string ){ return 0; } } 9 10 class A 11 { 12 Afunc1 func1; 13 Afunc2 func2; 14 } 15 16 struct B 17 { 18 void func1( int ) { } 19 size_t func2( string str ) { return 0; } 20 } 21 22 class C 23 { 24 void func1( int ) { } 25 size_t func2( string str ) { return 0; } 26 } 27 28 class D: A 29 { 30 void func1( int ) { } 31 size_t func2( string str ) { return 0; } 32 } 33 34 class E 35 { 36 int func1; 37 size_t func2( string str ){ return 0; } 38 } 39 40 class F 41 { 42 void func1() { } 43 size_t func2( string str ){ return 0; } 44 } 45 46 class G 47 { 48 void func1( in int ){} 49 size_t func2( string str ){ return 0; } 50 } 51 52 static assert( isPseudoInterface!( IFace,A,false ) ); 53 static assert( isPseudoInterface!( IFace,B,false ) ); 54 static assert( isPseudoInterface!( IFace,C,false ) ); 55 static assert( isPseudoInterface!( IFace,D,false ) ); 56 57 static assert( isPseudoInterface!(A,C,false) ); 58 59 static assert( !isPseudoInterface!( IFace,E,false ) ); 60 static assert( !isPseudoInterface!( IFace,F,false ) ); 61 static assert( !isPseudoInterface!( IFace,G,false ) );
using:
void func(T)( T v ) if( isPseudoInterface(Interface,T) ) { }