DMD 0.174 release
nazo
lovesyao at gmail.com
Wed Nov 15 02:18:03 PST 2006
Great!! I wrote bind. it works fine!
//License: Public Domain
import std.traits,std.typetuple,std.stdio;
template RemoveAt(int i,T,UL...){
static if(i==0)
alias UL RemoveAt;
else
alias TypeTuple!(T,RemoveAt!(i-1,UL)) RemoveAt;
}
static assert(is(RemoveAt!(1,int,bool,short)==TypeTuple!(int,short)));
template bind(alias func,int i){
ReturnType!(func) _bind(ParameterTypeTuple!(func)[i] val,TL...)(TL tl){
return func(tl[0..i],val,tl[i..$]);
}
template bind(ParameterTypeTuple!(func)[i] val){
alias _bind!(val,RemoveAt!(i,ParameterTypeTuple!(func))) bind;
}
}
void main(){
writefln(bind!(test,0).bind!("test")("test2","test3"));
//I want to write like this
//writefln(bind!(test,0)!("test")("test2","test3"));
}
More information about the Digitalmars-d-announce
mailing list