I have many strings and I want to use as associative array kay a sorted concat 
of two strings (it's a signature of the two strings):


import std.algorithm;
void main() {
    string a = "red";
    string b = "green";
    int[string] aa;
    //aa[(a ~ b).sort] = 1;
    //aa[(a ~ b).sort.idup] = 1;
    aa[(a.dup ~ b.dup).sort.idup] = 1;
}

I think the first way used to work, the second way was recently forbidden (and 
you can't use char[] as associative array key). The third way now works, but 
array.sort will go away.

So do you know what's a copy-minimizing (and possibly short) way to perform 
this, in future?

Bye and thank you,
bearophile

Reply via email to