0001 template <typename T> struct CheckOrder { //函数对象:判断一个T类对象是否局部有序 0002 T pred; int& u; 0003 CheckOrder ( int& unsorted, T& first ) : pred ( first ), u ( unsorted ) { } 0004 virtual void operator() ( T& e ) { if ( pred > e ) u++; pred = e; } 0005 };