[Issue 13684] New: std.numeric.isRectangular
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Nov 4 03:04:11 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13684
Issue ID: 13684
Summary: std.numeric.isRectangular
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
I suggest to add to Phobos a simple function of common use, "isRectangular".
Given a nD (2D, 3D, etc) array it verifies that the matrix is a "rectangular"
nD box, with all rows of the same length, etc.
So:
assert(isRectangular([[1, 2], [3, 4]]) == true);
assert(isRectangular([[1, 2], [3]]) == false);
assert(isRectangular([[[1, 2], [3, 4]]]) == true);
assert(isRectangular([[[1, 2], [3, 4]], []]) == false);
--
More information about the Digitalmars-d-bugs
mailing list