November 13 [Issue 24858] New: maxIndex but not minIndex sometimes returns the index as an array with a single element | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24858 Issue ID: 24858 Summary: maxIndex but not minIndex sometimes returns the index as an array with a single element Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: pabuond@gmail.com `maxIndex` returns an array with a single element when run on an array modified by UFCS (e.g. for absolute value). `minIndex` doesn't, so I guess this is a bug. Tested with dmd v2.109.1 ``` import std.math: fabs; import std.algorithm: minIndex, maxIndex; double[] u = [-9, 3, 2, 8, 4]; writeln(u.maxIndex); // => 3, OK writeln(u.map!fabs.minIndex); // => 2, OK writeln(u.map!fabs.maxIndex); // => [0] ??? Expected: 0 ``` Thanks! -- |
Copyright © 1999-2021 by the D Language Foundation