sorting failed error

monarch_dodra monarchdodra at gmail.com
Mon Jul 30 13:26:24 PDT 2012


On Monday, 30 July 2012 at 19:17:30 UTC, bearophile wrote:
> monarch_dodra:
>
>> struct S
>> {
>>    int opCmp(S b)
>>    {
>>      if(v[0] < b.v[0]) return -1;
>>      if(v[0] > b.v[0]) return  1;
>>      return 0;
>>    }
>>    int[] v;
>> }
>> ...
>> Or did you mean something else?
>
> I meant without a definend opCmp. So this is not your problem.
>
> Bye,
> bearophile

I don't get it? If you don't define an opCmp, then you can't 
compare the elements. At that point, sort won't "fail", it just 
won't compile...?


More information about the Digitalmars-d-learn mailing list