Benjamin Thaut:

> import std.stdio;
> 
> struct Type2Type(T){
>       typedef T OriginalType;
> }
> 
> class foo(T,R...) : foo!(R) {
>       public void print(){
>               super.print();
>               writefln(T.stringof);
>       }
>       
>       alias foo!(R).echo echo;
>       public void echo(Type2Type!(T)) {
>               writefln(T.stringof);
>       }
> }
> 
> class foo(T){
>       public void print(){
>               writefln("end " ~ T.stringof);
>       }
>       
>       public void echo(Type2Type!(T)) {
>               writefln(T.stringof);
>       }
> }
> 
> void main(string[] args){
>       auto test = new foo!(int,float,double,short,byte)();
>       test.print();
>       
>       test.echo(Type2Type!(double)());
>       test.echo(Type2Type!(short)());
> }

Try to compile that code with "-w" (warnings).

Bye,
bearophile

Reply via email to