jjzjj

go - 排序比较

我正在将C++代码转换为Go,但我很难理解这个比较函数:#include#include#include#includeusingnamespacestd;typedefstructSensorIndex{doublevalue;intindex;}SensorIndex;intcomp(constvoid*a,constvoid*b){SensorIndex*x=(SensorIndex*)a;SensorIndex*y=(SensorIndex*)b;returnabs(y->value)-abs(x->value);}intmain(intargc,char*argv[]){Se