[Issue 18631] std.random.choice does not work with const arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 4 20:58:00 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=18631
Steven Schveighoffer <schveiguy at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |schveiguy at gmail.com
Resolution|DUPLICATE |---
--- Comment #4 from Steven Schveighoffer <schveiguy at gmail.com> ---
This is not a duplicate of the general foreach problem. It's specific to
choice.
Other range-accepting functions work with const arrays just fine. This is a
problem with choice.
The fix is to remove the `auto ref` modifier on the range, which is
nonsensical, since it doesn't actually modify the range at all. It probably was
a premature optimization (verified it has been there from the start).
--
More information about the Digitalmars-d-bugs
mailing list