Re: Proxy sorting

2011-02-18 Thread bearophile
> Thank you for your answers. Second try, it doesn't work yet, I'm looking for > the problem: Third try, this seems to work: import std.stdio, std.array, std.algorithm, std.range; struct IndirectArray(Tdata, Tindexes) { Tdata[] data; Tindexes[] indexes; bool empty() { return indexe

Re: Proxy sorting

2011-02-18 Thread bearophile
Steven Schveighoffer: > I think opAssign is incorrect. Silly me :-) > My suggestion would be to create a bidirectional proxy range that uses a > supplemental array to determine where the "next/previous" element is (i.e. > the index array). Should be pretty simple. Then just pass this to so

Re: Proxy sorting

2011-02-18 Thread Steven Schveighoffer
On Fri, 18 Feb 2011 08:08:22 -0500, bearophile wrote: This is a RosettaCode simple task: http://rosettacode.org/wiki/Sort_disjoint_sublist#D Given a list of values and a set of integer indices into that value list, sort the values at the given indices, but preserving the values at indice

Proxy sorting

2011-02-18 Thread bearophile
This is a RosettaCode simple task: http://rosettacode.org/wiki/Sort_disjoint_sublist#D Given a list of values and a set of integer indices into that value list, sort the values at the given indices, but preserving the values at indices outside the set of those to be sorted. Example input: val