- 87 名前:デフォルトの名無しさん mailto:sage [2007/07/23(月) 18:47:15 ]
- >>66
// Otsu.new!!(argAlloc)(argCtor) class Otsu{ template New_(aA...){ static typeof(this) New_(TaC...)(TaC aC){ return new(aA) typeof(this)(aC); } } template New(aA...){ alias New_!(aA) New; } int n; this(int n){ this.n = n; } } //任意のクラスに対応できる版 template niw_(T,aA...){ T niw_(TaC...)(TaC aC){ return new(aA) T(aC); } } template niw(T, aA...){ alias niw_!(T,aA) niw; } void main(){ printf("%d\n", Otsu.New!()(3).n); printf("%d\n", niw!(Otsu)(5).n); } とかどうだろう
|

|