What's missing from Phobos for Orbit (package manager)

Jacob Carlborg doob at me.com
Thu Feb 14 00:12:34 PST 2013


On 2013-02-13 21:19, Walter Bright wrote:

> The any in std.algorithm is defined:
>
> --------------
> bool any(alias pred, Range)(Range range);
>
> Returns true if and only if a value v satisfying the predicate pred can
> be found in the forward range range. Performs Ο(r.length) evaluations of
> pred.
> --------------
>
> I see that as very different from !empty.

But if you use a predicate that always returns true that would be 
basically the same. At least for arrays.

int[] a = [];
assert(a.any!(e => true) == false);

int[] b = [3, 4, 5];
assert(b.any!(e => true) == true);

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list