August 07, 2013 [Issue 10774] New: std.range.indexed RangeError when indexing string with std.range.recurrence!"n"(0) | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10774 Summary: std.range.indexed RangeError when indexing string with std.range.recurrence!"n"(0) Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: monkeyworks12@hotmail.com --- Comment #0 from monkeyworks12@hotmail.com 2013-08-07 13:51:29 PDT --- import std.stdio; import std.range; void main() { auto str = "石室詩士施氏,嗜獅,誓食十獅。"d; auto indStr = str.indexed(recurrence!"n"(0)); //core.exception.RangeError@std.range(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. 石室詩士施氏,嗜獅,誓食十獅。 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 07, 2013 [Issue 10774] std.range.indexed RangeError when indexing string with std.range.recurrence!"n"(0) | ||||
---|---|---|---|---|
| ||||
Posted in reply to monkeyworks12@hotmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=10774 --- Comment #1 from monkeyworks12@hotmail.com 2013-08-07 14:05:20 PDT --- 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(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation