[Issue 5442] std.algorithm.sort problem with struct with char[10]

2014-02-16 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=5442


Peter Alexander peter.alexander...@gmail.com changed:

   What|Removed |Added

 CC||peter.alexander...@gmail.co
   ||m


--- Comment #4 from Peter Alexander peter.alexander...@gmail.com 2014-02-16 
12:17:31 PST ---
Are you happy this is fixed bearophile?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5442] std.algorithm.sort problem with struct with char[10]

2014-02-16 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=5442


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #5 from bearophile_h...@eml.cc 2014-02-16 12:42:05 PST ---
(In reply to comment #4)
 Are you happy this is fixed bearophile?

Yes, closed. The error message is clear:

...\dmd2\src\phobos\std\functional.d-mixin-102(102,1): Error: need member
function opCmp() for struct Foo to compare

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5442] std.algorithm.sort problem with struct with char[10]

2014-02-16 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=5442


Peter Alexander peter.alexander...@gmail.com changed:

   What|Removed |Added

 Resolution|FIXED   |WORKSFORME


--- Comment #6 from Peter Alexander peter.alexander...@gmail.com 2014-02-16 
14:26:12 PST ---
Changed to WORKSFORME so that it doesn't appear in the changelog for next
update.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5442] std.algorithm.sort problem with struct with char[10]

2013-12-27 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=5442


Xinok xi...@live.com changed:

   What|Removed |Added

 CC||xi...@live.com


--- Comment #3 from Xinok xi...@live.com 2013-12-27 11:07:29 PST ---
(In reply to comment #0)
 This D2 program tries to sort in-place a dynamic array of Foo according to 
 just
 the first int x field (the third sort works on the whole structs), but when T
 is a char the program doesn't compile:
 
 
 import std.algorithm: sort, schwartzSort;
 alias char T; // doesn't work
 //alias int T; // works
 struct Foo {
 int x;
 T[10] a;
 }
 void main() {
 auto array = new Foo[10];
 sort!(a.x  b.x)(array);
 static bool myComp(Foo f1, Foo f2) { return f1.x  f2.x; }
 sort!(myComp)(array);
 sort(array);
 }
 

Tested in DMD 2.064.2 and I'm unable to reproduce the bug. The final line fails
to compile because Foo doesn't define opCmp, but everything else is fine. The
default predicate for sort is a  b and comparing two structs using less-than
requires defining opCmp.

Unless somebody else can reproduce this issue, I think we can close this bug
report.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5442] std.algorithm.sort problem with struct with char[10]

2012-04-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5442



--- Comment #2 from SomeDude lovelyd...@mailmetrash.com 2012-04-22 14:59:01 
PDT ---
(In reply to comment #1)
 (but doesn't run as I
 expected, though), due to this :
 import std.stdio;
 
 struct Foo {
 int x;
 this(int x){this.x = x;}
 }
 void main() {
 auto array = new Foo[10];
 //for(int i = array.length; i  1; i--) { array[i].x = i; }
 auto i = array.length;
 foreach(Foo f; array) { f.x = --i; write(f.x);}
 writeln();
 foreach(Foo f; array) { write(f.x);}
 }
 
 giving that:
 PS E:\DigitalMars\dmd2\samples rdmd -O bug.d
 9876543210
 00

Never mind this part of the message, it's wrong code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---