Sorting routines

Jascha Wetzel firstname at mainia.de
Fri Mar 7 00:32:19 PST 2008


Bill Baxter wrote:
> Anyone have a sort routine that can operate simultaneously on multiple 
> arrays of data?
> 
> It's basically a lexical sort kind of thing, but all the keys and values 
> are in different arrays:
> int[] key1;
> int[] key2;
> ValueT1[] values;
> ValueT2[] other_values;
> 
> Datum i is made up of (key1[i],key2[i],values[i],other_values[i]).
> 
> But they're all stored in separate arrays rather than interleaved in a 
> struct.
> 
> The goal is to avoid copying the whole mess to an interleaved array in 
> order to sort it, and then copying it back to separate arrays.
> 
> --bb

i thought that should be easy with tuple parameters, but something that 
i think is a bug stopped my litte test. see the attachment.
in line 11 the type of b is char[][] (as expected), but using it as such 
gives an error. bummer...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sorttest.d
Type: text/x-dsrc
Size: 1627 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20080307/ab513f85/attachment.d 


More information about the Digitalmars-d-learn mailing list