1 #include
2 #include
3 #include
4 #include
5 #define Random() (rand()%100)
6 using namespacestd;7 #define MAXNUM 10
8
9 //定义加权排序的结构
10 template
11 struct_sortStru12 {13 T _data1;14 T _data2;15 T _data3;16 T _data4;17 int nWeight[4];18 _sortStru()19 {20 memset(this, 0, sizeof(_sortStru));21 }22 };23
24
25 bool _sort_sample(const _sortStru &l, const _sortStru &r)26 {27 return l._data1
30
31 class_sort32 {33 public:34 _sort() : pos(0){}35 _sort(intnPos) : pos(nPos){}36 bool operator()(const _sortStru &l, const _sortStru &r)37 {38 switch(pos)39 {40 case 0:41 return l._data1
53 private:54 intpos;55 };56
57 template
58 classAdd_Weight59 {60 public:61 Add_Weight(int type, intstart)62 : ntype(type), nstart(start), nLastValue(0), nLastWeight(0)63 {64 }65
66 void operator()(_sortStru &