strange _sort_ of bug
Walter Bright
newshound at digitalmars.com
Sat Sep 23 21:22:03 PDT 2006
David Medlock wrote:
> I am getting an Access Violation using the array built-in sort.
>
> My structure looks quite harmless:
>
> class EdgeInfo
> {
> int from, to;
> float cost = 0;
>
> public int opCmp( Object o )
> {
> EdgeInfo e = cast(EdgeInfo)o;
> float other = e.cost;
> if ( cost < other ) return -1;
> if ( equal( other , cost ) ) return 0; else return 1;
> }
> }
Try checking that o is not null.
More information about the Digitalmars-d-bugs
mailing list