Re: sorting a mutable array of immutable objects

2016-04-20 Thread Jeff Thompson via Digitalmars-d
On Wednesday, 20 April 2016 at 12:34:28 UTC, Anonymouse wrote: On Wednesday, 20 April 2016 at 10:32:42 UTC, Jeff Thompson wrote: On Wednesday, 20 April 2016 at 09:54:13 UTC, Jeff Thompson wrote: I can create a mutable array of immutable objects, thanks to the answers to my other question https

Re: sorting a mutable array of immutable objects

2016-04-20 Thread Anonymouse via Digitalmars-d
On Wednesday, 20 April 2016 at 12:34:28 UTC, Anonymouse wrote: On Wednesday, 20 April 2016 at 10:32:42 UTC, Jeff Thompson [...] Also note that sort (std.algorithm.sorting : sort) returns a range and doesn't sort in place. (Lastly this is probably more at home in the Learn forum.) It does sor

Re: sorting a mutable array of immutable objects

2016-04-20 Thread Anonymouse via Digitalmars-d
On Wednesday, 20 April 2016 at 10:32:42 UTC, Jeff Thompson wrote: On Wednesday, 20 April 2016 at 09:54:13 UTC, Jeff Thompson wrote: I can create a mutable array of immutable objects, thanks to the answers to my other question https://forum.dlang.org/post/[email protected] . Now

Re: sorting a mutable array of immutable objects

2016-04-20 Thread Jeff Thompson via Digitalmars-d
On Wednesday, 20 April 2016 at 09:54:13 UTC, Jeff Thompson wrote: I can create a mutable array of immutable objects, thanks to the answers to my other question https://forum.dlang.org/post/[email protected] . Now I want to sort the array. I found a solution, but I'm not sure it

Re: sorting a mutable array of immutable objects

2016-04-20 Thread Jeff Thompson via Digitalmars-d
On Wednesday, 20 April 2016 at 09:54:13 UTC, Jeff Thompson wrote: I can create a mutable array of immutable objects, thanks to the answers to my other question https://forum.dlang.org/post/[email protected] . Now I want to sort the array, but the sort function doesn't "see" the

sorting a mutable array of immutable objects

2016-04-20 Thread Jeff Thompson via Digitalmars-d
I can create a mutable array of immutable objects, thanks to the answers to my other question https://forum.dlang.org/post/[email protected] . Now I want to sort the array, but the sort function doesn't "see" the opCmp in class C. Do I need to define a custom compare function fo