On Thursday, 6 June 2019 at 21:32:11 UTC, Jonathan M Davis wrote:
If any is not given a predicate, it defaults to just checking whether the element itself is true (requiring that the element be bool), which is why Marco's suggestion works, but it's a rather odd way to write the code and will be less efficient unless the optimizer manages to optimize away the extra work involved with having map.

However, in general, with D, you're not going to find that there is only one way to do things. There are going to tend to be many different approaches to solve the same problem. D code is often simple because of the powerful language constructs and standard library, but it makes no attempt to make it so that there's only one way to do things - especially when you start combining stuff to do whatever it is you're trying to do.

- Jonathan M Davis

Maybe one of these methods can be made 'official' or 'idiomatic':

any!pred(ss);
ss.any!pred();
ss.any!pred;

This will reduce learning burden on beginners.

Reply via email to