次のコードはコンパイルに失敗します。
assert("(((())))()()()()))".count!(c => c.among!('(', ')')) > 0);
エラーメッセージで:
"Error: template std.algorithm.searching.count cannot deduce function from argument types !((c) => c.among!('(', ')'))(string), candidates are..."
しかし、[標準ライブラリ ( http://dlang.org/phobos/std_algorithm_searching.html#.count ) は、述語を取り、述語が true を返すcount
すべての要素をカウントするオーバーロードがあることを明確に示しています。では、この方法R
を使用しようとすると、コンパイラが文句を言うのはなぜですか?count