Bug 24382 – std.range.only should have assignable elements

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-02-10T05:37:46Z
Last change time
2024-02-14T22:15:27Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2024-02-10T05:37:46Z
Currently, the range returned by std.range.only does not have assignable elements, which means that it cannot be used with certain algorithms (e.g., transposed). Since OnlyResult stores its elements with their original, possibly-heterogeneous types, rather than with the common element type, this may not always be possible. However, when it is possible (e.g., when all elements have the same original type), assignment of elements should be supported.
Comment #1 by dlang-bot — 2024-02-10T06:53:10Z
@pbackus created dlang/phobos pull request #8910 "Allow assignment of std.range.only elements" fixing this issue: - Allow assignment of std.range.only elements This allows the ranges returned by only to be used in algorithms that require assignable elements, such as reverse, sort, and transposed. Fixes bugzilla issue 24382. https://github.com/dlang/phobos/pull/8910
Comment #2 by dlang-bot — 2024-02-14T22:15:27Z
dlang/phobos pull request #8910 "Allow assignment of std.range.only elements" was merged into master: - a923073f57ad90fa33cdd699fe3077002b1c0edf by Paul Backus: Allow assignment of std.range.only elements This allows the ranges returned by only to be used in algorithms that require assignable elements, such as reverse, sort, and transposed. Fixes bugzilla issue 24382. https://github.com/dlang/phobos/pull/8910