import std.stdio; template eval(A...) { alias A eval; } char[] trimfirst(char[] s) { int x = 0; foreach (char each; s) { if (each != ' ') //{ return s[x .. $]; //} //Without the parenthesis, the compile-time version doesn't work ! x++; } return s; } void main() { writefln(eval!(trimfirst(" test"))); //Output: " test" writefln(trimfirst(" test")); //Output: "test" }
Fixed DMD 1.007
Added to DStress as http://dstress.kuehne.cn/run/i/interpret_01_A.d http://dstress.kuehne.cn/run/i/interpret_01_B.d
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル