Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
November 16, 2010 [Issue 5224] New: std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5224 Summary: std.algorithm.remove!(SwapStrategy.unstable) doesn't work Product: D Version: D2 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: ruzicic.aleksandar@gmail.com --- Comment #0 from Aleksandar Ruzicic <ruzicic.aleksandar@gmail.com> 2010-11-16 20:52:45 CET --- Example code below shows that there is a bug in remove() using unstable SwapStrategy - it removes wrong element from an array. Using default swap strategy works as expected. ----------------------------------------------------------- module test; import std.algorithm; import std.stdio, std.algorithm; void main(string[] args) { auto a = [1, 2, 3, 4]; print("initial", a); auto i = a.indexOf(3); writefln("indexOf(3) = %s", i); if (i > -1) { print("remove!(SwapStrategy.unstable)", remove!(SwapStrategy.unstable)(a, i)); } /* Tested with DMD v2.049 under Windows 7: > dmd -run test.d initial: 1 2 3 4 (length = 4) indexOf(3) = 2 remove!(SwapStrategy.unstable): 4 2 3 (length = 3) it removed element at index 0 rather than element at index 2 */ } void print(string name, int[] array) { writef("%s: ", name); foreach (elem; array) { writef("%s ", elem); } writefln("(length = %s)", array.length); } ----------------------------------------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 16, 2010 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 --- Comment #1 from Aleksandar Ruzicic <ruzicic.aleksandar@gmail.com> 2010-11-16 21:02:22 CET --- tested now also under DMD 2.050, same results. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 09, 2011 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei@metalanguage.com AssignedTo|nobody@puremagic.com |andrei@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 06, 2011 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Platform|x86_64 |x86 --- Comment #2 from Brad Roberts <braddr@puremagic.com> 2011-02-06 15:39:36 PST --- Mass migration of bugs marked as x86-64 to just x86. The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 22, 2012 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear@mailmetrash.com Platform|x86 |All OS/Version|Windows |All --- Comment #3 from SomeDude <lovelydear@mailmetrash.com> 2012-04-22 03:05:59 PDT --- Although the unit tests pass, they seem insufficient. This example actually comes from a comment in algorithm.d and yet it fails on 2.059: int[] a = [ 0, 1, 2, 3 ]; assert(remove!(SwapStrategy.unstable)(a, 1) == [ 0, 3, 2 ]); (returns [3, 1, 2]) Idem for SwapStrategy.semistable Also, in one comment of algorithm.d, there is a typo. According to the explanation under the example, line 5914 of algorithm.d should be: int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove(a, 1, tuple(3, 5), 9) == [ 0, 2, 5, 6, 7, 8, 10 ]); ^-- forgotten "The tuple passes in a range closed to the left and open to the right" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 22, 2012 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #4 from SomeDude <lovelydear@mailmetrash.com> 2012-04-22 03:10:47 PDT --- *** Issue 6956 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 26, 2013 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 --- Comment #5 from Andrei Alexandrescu <andrei@erdani.com> 2013-02-26 08:27:35 PST --- https://github.com/D-Programming-Language/phobos/pull/1162 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 30, 2013 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 --- Comment #6 from github-bugzilla@puremagic.com 2013-07-30 05:50:34 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/98b47ad5dd882e593b630dc345087914f88fa570 issue 5224 https://github.com/D-Programming-Language/phobos/commit/dcd065e2e56fc769e5a5b209910674229c6a0e17 Merge pull request #1162 from andralex/5224 Fix Issue 5224 - std.algorithm.remove!(SwapStrategy.unstable) doesn't work -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 30, 2013 [Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aleksandar Ruzicic | http://d.puremagic.com/issues/show_bug.cgi?id=5224 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |andrej.mitrovich@gmail.com 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