Bug 10774 – std.range.indexed RangeError when indexing string with std.range.recurrence!"n"(0)

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-07T13:51:29Z
Last change time
2024-12-01T16:18:35Z
Assigned to
No Owner
Creator
Meta
Moved to GitHub: phobos#9998 →

Comments

Comment #0 by monkeyworks12 — 2013-08-07T13:51:29Z
import std.stdio; import std.range; void main() { auto str = "石室詩士施氏,嗜獅,誓食十獅。"d; auto indStr = str.indexed(recurrence!"n"(0)); //[email protected](6177): Range violation writeln(indStr); } This code prints the string correctly, but it seems that it doesn't stop when the end of the string is reached. 石室詩士施氏,嗜獅,誓食十獅。
Comment #1 by monkeyworks12 — 2013-08-07T14:05:20Z
Also, a workaround: import std.utf; import std.stdio; import std.range; void main() { auto str = "石室詩士施氏,嗜獅,誓食十獅。"d; auto indStr = str.indexed(iota(str.count)); writeln(indStr); readln(); }
Comment #2 by robert.schadek — 2024-12-01T16:18:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9998 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB