C++ STL 算法:删除算法(3)unique、unique_copy
来源:互联网 发布:javahome的作用 知乎 编辑:程序博客网 时间:2024/06/05 08:45
1、unique(b,e)//把重复的元素删掉,只保留一个
unique(ilist.begin(),ilist.end());
2、unique(b,e,p)//符合p条件的删掉
pos = unique(ilist.begin(), ilist.end(), greater<int>());//删掉比前一个数小的元素
3、unique_copy(b1,e1,b2)
unique_copy(ilist.begin(),ilist.end(),ostream_iterator<int>(cout, " "));
4、unique_copy(b1,e1,b2,p)
bool differenceOne(int elem1, int elem2)
{
return elem1 + 1 == elem2 || elem1 - 1 == elem2;
}
{
return elem1 + 1 == elem2 || elem1 - 1 == elem2;
}
unique_copy(ilist.begin(), ilist.end(),ostream_iterator<int>(cout, " "),differenceOne);//相邻的删掉
0 0
- C++ STL 算法:删除算法(3)unique、unique_copy
- STL algorithm算法unique,unique_copy(58)
- STL算法之unique和unique_copy
- C++ :STL 算法unique , unique_copy函数
- C++ STL算法---unique , unique_copy函数
- STL_算法_删除(unique、unique_copy)
- C++ STL算法系列4---unique , unique_copy函数
- C++ STL算法系列4---unique , unique_copy函数
- C++ STL算法系列4---unique , unique_copy函数
- C++ STL算法系列4---unique , unique_copy函数
- C++ STL算法系列4---unique , unique_copy函数
- C++ STL算法系列4---unique , unique_copy函数
- C++ STL算法系列4---unique , unique_copy函数
- STL_算法(24)_删除_(3)uinique() unique_copy()
- 泛型算法系列29:unique()&&unique_copy()
- 变异算法之唯一(unique, unique_copy)
- 九、STL算法-删除算法(unique、remove)
- unique_copy算法
- HDU 1028 Ignatius and the Princess III(母函数)
- slf4j教程
- 离梦想很近的地方..
- 你好CSDN
- decompress gzip data from object in memory
- C++ STL 算法:删除算法(3)unique、unique_copy
- EXTJS使用XType来定义组件及使用方法
- Leetcode_128_Longest Consecutive Sequence
- 动态模板道指令
- 【树上乱搞】[Hnoi2014] bzoj3573 米特运输 meat
- 5 读取单个联系人 Intent 的action和type 属性
- 【组合数学】 ZOJ 3841 Cards
- 枚举法判断2015年某天是否为节假日或周末
- Spark安装与学习