深入理解並徹底掌握使用unique函數去重

宏觀來看,使用unique函數去重主要分爲以下幾步: 以vector爲例: 聲明部分: #include<vector> #include<algorithm> vector<int>v; vector<int>::iterator new_end; 三個主要步驟: sort(v.begin(),v.end());//第一步:排序(從小到大),從大到小也可以 new_end=unique(v.be
相關文章
相關標籤/搜索