1 //针对类中某一对象比较'<'
2 template
3 struct lt_pred{
4 lt_pred(V T::*_pm){pm=_pm;}
5 V T::*pm;
6 bool operator()(const T& a, const T& b){
7 return a.*pm < b.*pm;
8 }
9 };
10
11 template
12 lt_pred
13 return lt_pred
14 }
15
16 //sort(ha,ha+3, create_lt_pred(&hasintmember::a));
深圳北大青鸟http://www.ruanjsx.com