1 //針對類中某一對象比較'<'
2 template<class V, class T>
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<class V, class T>
12 lt_pred<V,T> create_lt_pred(V T::*pm){//自動推倒參數用
13 return lt_pred<V,T>(pm);
14 }
15
16 //sort(ha,ha+3, create_lt_pred(&hasintmember::a));
*