Make struct transparent to std.algorithm.sort

cal callumenator at gmail.com
Tue Feb 19 12:01:37 PST 2013


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...
}


More information about the Digitalmars-d-learn mailing list