Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 14, 2012 [Issue 8821] New: countUntil chokes on reference ranges | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8821 Summary: countUntil chokes on reference ranges Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: monarchdodra@gmail.com --- Comment #0 from monarchdodra@gmail.com 2012-10-14 13:43:47 PDT --- Example: //--- import std.algorithm; import std.stdio; import std.array; struct Forward { static struct P { string s; } P* _p; this(string si) { _p = new P(); _p.s = si; } @property dchar front() { return _p.s.front; } void popFront() { _p.s.popFront(); } bool empty() { return _p.s.empty; } } void main() { auto s = Forward("abc"); auto s1 = Forward("ac"); s.countUntil(s1).writeln(); } //--- Produces "1". ROOT CAUSE ANALYSIS: The "problem" is "startsWith", which will consume both its input (both haystack and needle). Here, the first call to start with will consume the "a" of both "abc" and "ac". countUntil will the pop the b off of "bc", and finally, call startsWith on "c" and "c". Recommend saving ranges before calling startsWith (if both are ranges), but a more efficient solution could be found. Assigning to self. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 14, 2012 [Issue 8821] countUntil chokes on reference ranges | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=8821 monarchdodra@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|nobody@puremagic.com |monarchdodra@gmail.com --- Comment #1 from monarchdodra@gmail.com 2012-10-14 13:45:39 PDT --- (In reply to comment #0) > Assigning to self. Assigning to self. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 17, 2012 [Issue 8821] countUntil chokes on reference ranges | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=8821 monarchdodra@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P5 Severity|normal |trivial --- Comment #2 from monarchdodra@gmail.com 2012-12-16 23:13:49 PST --- https://github.com/D-Programming-Language/phobos/pull/951 Fixed and verified by monarchdodra on 17 dec 2012. Still requires writing some unit tests, which I will do after findSplit is itself also fixed for reference ranges. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 25, 2013 [Issue 8821] countUntil chokes on reference ranges | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=8821 monarchdodra@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED -- 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