2006-06-23から1日間の記事一覧
Enumerableを書いているのですが、いきなりこけてます。 template.d(4): template template.main.mixin Foo!(); .hoge(T) cannot declare template at function scope higeつまりmixinのためのテンプレートFooの中で、関数テンプレートhogeを使ったために、…
評価したい要素を配列に突っ込んで、その後配列操作関数でどうにかしてください! ということになりました。わあい。 寧ろ、opIndexとlengthさえあれば!
mixinせずに普通に書くと、勿論動きます。 eachの引数をなくすと動きます。 ということで引数に関数ポインタを持つ関数をmixinするテンプレートの中から呼び出すとボカン、っぽいです。 テンプレートの引数に関数ポインタ渡してごにょごにょ、とか色々試した…
import std.c.stdio; template Hige(){ void hige(){ hoge(); } } class Hoge{ void hoge(){ printf("hoge\n"); } mixin Hige; } void main(){ Hoge h = new Hoge(); h.hige(); }これは通る。 hogeそしてこっちは駄目。 template Foo(){ int[] map(int deleg…