以下代码无法编译:
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
这种方式时编译器会抱怨呢?