www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Make struct transparent to std.algorithm.sort

Is there a way to make this sort of thing work?

import std.algorithm;

struct S
{
     int[] arr;
     alias arr this;
}

void main()
{
     auto s = S([1,2,3]);
     sort(s);  // error: template std.algorithm.sort does not 
match any function
               // template declaration. Candidates are...
}
Feb 19 2013