中易网

c++ 类库中list中的函数有哪些

答案:2  悬赏:0  
解决时间 2021-03-09 14:19
c++ 类库中list中的函数有哪些
最佳答案
常用到的就几个:
假如list a;//创建整型链表 a
list ::iterator it;//迭代器
1.a.push_back(1);//向list尾部插入数据1。
2.a.push_front(2);向list头部插入数据2。
3.a.reverse();//将list倒置
4.a.erase(it);//删除it指向的数据
5.a.insert(it,100);//在it前插入一个数100
6.it=a.begin();//it指向a的开头
7.it=a.end();//it指向a的结束
全部回答
Member functions
(constructor) Construct list (public member function)
(destructor) List destructor (public member function)
operator= Copy container content (public member function )
Iterators:
begin Return iterator to beginning (public member function)
end Return iterator to end (public member function )
rbegin Return reverse iterator to reverse beginning (public member function)
rend Return reverse iterator to reverse end (public member function)
Capacity:
empty Test whether container is empty (public member function)
size Return size (public member function)
max_size Return maximum size (public member function )
resize Change size (public member function)
Element access:
front Access first element (public member function )
back Access last element (public member function)
Modifiers:
assignAssign new content to container (public member function)
push_front Insert element at beginning (public member function)
pop_frontDelete first element (public member function)
push_back Add element at the end (public member function)
pop_backDelete last element (public member function)
insertInsert elements (public member function)
eraseErase elements (public member function)
swapSwap content (public member function )
clearClear content (public member function)
Operations:
splice Move elements from list to list (public member function)
remove Remove elements with specific value (public member function)
remove_if Remove elements fulfilling condition (public member function template )
unique Remove duplicate values (member function )
merge Merge sorted lists (public member function )
sort Sort elements in container (public member function )
reverse Reverse the order of elements (public member function )
Allocator:
get_allocator Get allocator (public member function )
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
请问做婚礼主持都是怎么个工作时间
UG5.0安装
《花降楼》系列出了几部漫画?只有(绮蝶×蜻
神武旗包怎么做?
丰县首羡有联通宽带吗
vs2015怎么装到其他盘呢,我选择了e盘但是大
机械制图材料符号
吉祥馄饨(水墨兰庭店)在哪里啊,我有事要去这
崩坏3这个任务是什么意思可以翻译一吗?谢谢
为什么我用手机qq发表的带图片的说说图片那么
电大有旅游与酒店管理专业吗?这个专业怎么样
什么牌子溶脂针适合打脸
科鲁兹倒车雷达坏了维修要多少钱
小公司注册后长期不年审,可以更换监事吗?公
一有情绪紧张就拉肚子,犯肠炎,比如面试,比
推荐资讯
现在中国年轻人思想是不是很开放了,像西方一
张建民的介绍
我想要一张假的汇款单,有没有知道怎么办理的
中国大姨妈最喜欢什么
关于慧聪网员工住宿
金诚行地址在什么地方,想过去办事
根尖细胞染色体制片技术
哈萨奶咖地址有知道的么?有点事想过去
第一次买股票基金资金冻结是什么意思
将里面的第二个锁转一下用韩语如何讲
风火山,这只巨大的拦路虎一次次低下高傲的头
全江渔具NO.1我想知道这个在什么地方
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?