Mixin template functions are ignored in struct
    tcak via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Tue Oct 14 13:58:18 PDT 2014
    
    
  
I have written a struct and a mixin template, and that mixin 
template is mixed into that struct as follows.
private mixin template TestCommonMethods(){
	public bool apply( int d, int e ){
		return false;
	}
}
public struct Test{
	public mixin TestCommonMethods;
	public bool apply( char c ){
		return true;
	}
}
void main(){
	Test t;
	t.apply( 5, 3 );
}
---
For the line "t.apply( 5, 3 );", error is given saying that 
"function test.apply(char c) is not callable".
---
For better testing, I added another function to template as 
"public bool blah(){}", and called it in main, and it works. So, 
thus this mean overloading is not supported with mixin templates?
    
    
More information about the Digitalmars-d-learn
mailing list