list
文章平均质量分 72
master_feng2009
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
如何在list中查找
如果list存储的是能够比较大小的数值型数据,如int,double等,可以直接采用find进行查找,例子:#include #include #include using namespace std;int_tmain(int argc, _TCHAR* argv[]){ listint> listTemp; listint>::ite原创 2013-07-24 10:50:27 · 2217 阅读 · 0 评论 -
在list中查找find
如果list存储的是能够比较大小的数值型数据,如int,double等,可以直接采用find进行查找,例子:#include #include #include using namespace std;int_tmain(int argc, _TCHAR* argv[]){ listint> listTemp; listint>::ite原创 2013-07-24 10:56:29 · 1482 阅读 · 0 评论 -
list排序成员函数对string对象与char*对象排序的差别
对list容器中的对象排序,不能使用sort()算法,只能采用其自身的排序函数sort()。因为,算法sort()只支持随机存取的容器的排序,如vector等。对基本数据对象list排序:成员函数sort()情况1:对string排序#include "stdafx.h"#include #include #include using namespa原创 2013-09-20 23:02:24 · 1710 阅读 · 0 评论 -
将两个list链表通过merge合并时注意的三个问题
注意:1)merge()是将两个有序的链表合并成另一个有序的链表,如果有一个链表不是有序的那么在执行代码时会报错:说链表不是有序的。2)还有,两个链表中的内容排序顺序与合并时采用的排序顺序必须一致,如果不一致,也会报错,说链表不是有序的。如想要降序合并两个链表,那么合并前的两个链表也必须是按降序排列的。3)另外,当执行完merge()后,右边的链表将变为空。 例子:list v原创 2013-09-24 10:53:33 · 8964 阅读 · 5 评论 -
如何保证list容器中任意连续对象元素都不相同:unique()
成员函数unique()可以保证链表容器中连续两个对象具有唯一性,即要求链表容器中的任意连续对象元素值是不同的,但不能保证链表容器中所有对象的唯一性。例子:#include "stdafx.h"#include #include #include using namespace std;int_tmain(int argc, _TCHAR* argv[])原创 2013-09-24 22:04:52 · 2113 阅读 · 0 评论 -
链表list容器中通过splice合并链表与merge的不同,及需要注意的问题
#include "stdafx.h"#include #include #include using namespace std;int_tmain(int argc, _TCHAR* argv[]){ listint> c1,c2,c3,c4; c1.push_back(3); c1.push_back(6); c原创 2013-09-24 21:01:37 · 3621 阅读 · 0 评论
分享