comparison operators

Kevin Bealer kevinbealer at gmail.com
Wed Apr 16 10:49:39 PDT 2008


Kevin Bealer Wrote:

>     int opCmp(Object other)
>     {
>         return schwartzKey() < other.schwartzKey();
>     }

Oops -- this is obviously too simple, maybe:

  if (schwartzKey() < other.schwartzKey())
     return -1;
  if (schwartzKey() > other.schwartzKey())
     return 1;
   return 0;

Kevin





More information about the Digitalmars-d mailing list