Bug 17360 – std.range.only doesn't allow ref access

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-04-30T07:13:42Z
Last change time
2024-12-01T16:30:13Z
Assigned to
No Owner
Creator
John Colvin
Moved to GitHub: phobos#9715 →

Comments

Comment #0 by john.loughran.colvin — 2017-04-30T07:13:42Z
This a pain because it means things like this don't work: int[] a = [1,2,3]; only(a).front.popFront(); Error: template std.range.primitives.popFront cannot deduce function from argument types !()(int[]), candidates are: std/range/primitives.d(2084): std.range.primitives.popFront(T)(ref T[] a) if (!isNarrowString!(T[]) && !is(T[] == void[])) std/range/primitives.d(2107): std.range.primitives.popFront(C)(ref C[] str) if (isNarrowString!(C[]))
Comment #1 by john.loughran.colvin — 2018-03-22T21:07:13Z
Adding `auto ref` to `front`, `back` and `opIndex` is an obvious fix but falls foul of https://issues.dlang.org/show_bug.cgi?id=17512
Comment #2 by robert.schadek — 2024-12-01T16:30:13Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9715 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB