December 14, 2018 2D-all? | ||||
---|---|---|---|---|
| ||||
I've got a lot of code with two-dimensional arrays, where I use stuff like: > assert(matrix.all!(a=>a.all!(b=>b>=0))); Does anyone know if there is a 2D-version of all so I can write something like: > assert(matrix.all2D!(a=>a>=0)); |
December 14, 2018 Re: 2D-all? | ||||
---|---|---|---|---|
| ||||
Posted in reply to berni | On Friday, 14 December 2018 at 12:43:40 UTC, berni wrote:
> I've got a lot of code with two-dimensional arrays, where I use stuff like:
>
>> assert(matrix.all!(a=>a.all!(b=>b>=0)));
>
> Does anyone know if there is a 2D-version of all so I can write something like:
>
>> assert(matrix.all2D!(a=>a>=0));
auto all2d(alias f)(ref Matrix m)
{
return m.all!(a => a.all!(b => f(b)));
}
|
Copyright © 1999-2021 by the D Language Foundation