www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Function "any" doesn't work

reply Andrey <saasecondbox yandex.ru> writes:
Hello.
Example from documentation doesn't work:
 import std;
 void main()
 {
     assert( all!(any!isWhite)(["a a", "b b"]));
 }
Got: onlineapp.d(4): Error: template std.algorithm.searching.any!(all).any cannot deduce function from argument types !()(string[]), candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/searching.d(170): any(Range)(Range range) with Range = string[] must satisfy the following constraint: is(typeof(unaryFun!pred(range.front)))
Dec 29 2019
next sibling parent Eugene Wissner <belka caraus.de> writes:
On Sunday, 29 December 2019 at 19:46:59 UTC, Andrey wrote:
 Hello.
 Example from documentation doesn't work:
 import std;
 void main()
 {
     assert( all!(any!isWhite)(["a a", "b b"]));
 }
Got: onlineapp.d(4): Error: template std.algorithm.searching.any!(all).any cannot deduce function from argument types !()(string[]), candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/searching.d(170): any(Range)(Range range) with Range = string[] must satisfy the following constraint: is(typeof(unaryFun!pred(range.front)))
std breaks something. import std.algorithm.searching; import std.ascii; void main() { assert( all!(any!isWhite)(["a a", "b b"])); } works with v2.089.0
Dec 29 2019
prev sibling parent Eugene Wissner <belka caraus.de> writes:
On Sunday, 29 December 2019 at 19:46:59 UTC, Andrey wrote:
 Hello.
 Example from documentation doesn't work:
 import std;
 void main()
 {
     assert( all!(any!isWhite)(["a a", "b b"]));
 }
Got: onlineapp.d(4): Error: template std.algorithm.searching.any!(all).any cannot deduce function from argument types !()(string[]), candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/searching.d(170): any(Range)(Range range) with Range = string[] must satisfy the following constraint: is(typeof(unaryFun!pred(range.front)))
std.ascii doesn't get along well with std.uni, both define isWhite.
Dec 29 2019