次のコードをコンパイルしようとします:
import std.algorithm;
void main()
{
string[] x = ["ab", "cd", "ef"]; // 'string' is same as 'immutable(char)[]'
string space = " ";
char z = joiner( x, space ).front(); // error
}
dmd
エラーで終了するコンパイル:
test.d(8): Error: cannot implicitly convert expression (joiner(x,space).front()) of type dchar to char
に変更char z
するdchar z
とエラーメッセージは修正されますが、そもそもなぜ表示されるのか興味があります。
joiner(string[],string).front()
の結果がchar ではなく dcharであるのはなぜですか?
(ドキュメントhttp://dlang.org/phobos/std_algorithm.html#joinerには何もありません)