[Issue 1861] (D1 only) .sort fails if opCmp takes a ref param

2018-10-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1861

Mathias LANG  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #6 from Mathias LANG  ---
D2 builtin sort is gone, closing.

--


[Issue 1861] (D1 only) .sort fails if opCmp takes a ref param

2013-11-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=1861


Walter Bright  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|WONTFIX |


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


[Issue 1861] (D1 only) .sort fails if opCmp takes a ref param

2013-11-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=1861


Kenji Hara  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||WONTFIX


--- Comment #5 from Kenji Hara  2013-11-24 19:32:09 PST ---
D1 is not supported anymore, and in D2 built-in sort property will be
deprecated.

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


[Issue 1861] (D1 only) .sort fails if opCmp takes a ref param

2012-02-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1861


Yao Gomez  changed:

   What|Removed |Added

 CC||yao.go...@gmail.com
Version|1.027   |D1
Summary|.sort fails if opCmp takes  |(D1 only) .sort fails if
   |a ref param |opCmp takes a ref param


--- Comment #4 from Yao Gomez  2012-02-05 01:01:46 PST ---
Marking this as D1 only, as the built-in, AA.sort method is going to be
deprecated.

With a slight modification, your test example passes and prints the correct
result with the std.algorithm.sort function (D2 only).

--
module opcmpref;

import std.stdio, std.algorithm;

struct Pair
{
int a, b;
// Sort by b first then a
//  Sorting fails if rhs is a 'ref' param.  Ok if ref removed.
int opCmp(ref Pair rhs) {
if (b!=rhs.b) return b-rhs.b;
return a-rhs.a;
}
@property string toString()
{
return std.string.format("(%s,%s)",a,b);
}
}
void main()
{
// Single comparisons are all fine
assert( !(Pair(0,0)http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---