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

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

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 &quo

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 co

Re: mutable array of immutable objects

2016-04-19 Thread Timon Gehr via Digitalmars-d
On 19.04.2016 14:07, Jeff Thompson wrote: On Tuesday, 19 April 2016 at 11:43:22 UTC, Anonymouse wrote: On Tuesday, 19 April 2016 at 10:41:05 UTC, Jeff Thompson wrote: I want to create a mutable array of immutable objects, but the code below gives the error shown below. It seems that &quo

Re: mutable array of immutable objects

2016-04-19 Thread Sönke Ludwig via Digitalmars-d
Am 19.04.2016 um 12:41 schrieb Jeff Thompson: I want to create a mutable array of immutable objects, but the code below gives the error shown below. It seems that "new immutable(C)[1]" makes the entire array immutable, but it seems I should be able to change the elements of an array o

Re: mutable array of immutable objects

2016-04-19 Thread Jeff Thompson via Digitalmars-d
On Tuesday, 19 April 2016 at 11:43:22 UTC, Anonymouse wrote: On Tuesday, 19 April 2016 at 10:41:05 UTC, Jeff Thompson wrote: I want to create a mutable array of immutable objects, but the code below gives the error shown below. It seems that "new immutable(C)[1]" makes the en

Re: mutable array of immutable objects

2016-04-19 Thread Anonymouse via Digitalmars-d
On Tuesday, 19 April 2016 at 10:41:05 UTC, Jeff Thompson wrote: I want to create a mutable array of immutable objects, but the code below gives the error shown below. It seems that "new immutable(C)[1]" makes the entire array immutable, but it seems I should be able to change the e

mutable array of immutable objects

2016-04-19 Thread Jeff Thompson via Digitalmars-d
I want to create a mutable array of immutable objects, but the code below gives the error shown below. It seems that "new immutable(C)[1]" makes the entire array immutable, but it seems I should be able to change the elements of an array of pointers to an object even though the o