[Issue 24858] New: maxIndex but not minIndex sometimes returns the index as an array with a single element
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 13 19:28:18 UTC 2024
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 at puremagic.com
Reporter: pabuond at 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!
--
More information about the Digitalmars-d-bugs
mailing list