[Issue 7944] New: popFront() cycles when the range is empty
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Apr 19 05:37:29 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7944
Summary: popFront() cycles when the range is empty
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: lovelydear at mailmetrash.com
--- Comment #0 from SomeDude <lovelydear at mailmetrash.com> 2012-04-19 05:38:23 PDT ---
Original discussion:
http://forum.dlang.org/post/itrsidszogvnobzvlbwg@forum.dlang.org
import std.range, std.stdio;
void main()
{
auto r = iota(3);
writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
r.popFront();
writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
r.popFront();
writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
r.popFront();
writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
r.popFront();
writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
r.popFront();
}
Returns:
0, length: 3 empty ? false
1, length: 2 empty ? false
2, length: 1 empty ? false
3, length: 0 empty ? true
4, length: 4294967295 empty ? false
Shouldn't popFront() assert when r.empty == true ?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list