自定义比较函数

template<class T>
bool lexicographicallySmaller(vector<T> a,vector<T> b)
{
    int n=a.size();
    int m=b.size();
    int i;
    for(i=0;i<n&&i<m;i++){
        if(a[i]<b[i]) return true;
        else if(b[i]<a[i]) return false;
    }
    return (i==n&&i<m);
}

猜你喜欢

转载自www.cnblogs.com/033000-/p/10184886.html
今日推荐