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

#include<list>lista;请问通过a可以调用的函数有哪些,具体功能是什么?求教求教... #include<list>list a;请问通过a可以调用的函数有哪些,具体功能是什么?求教求教 展开
 我来答
weiyinwu
2012-02-13 · TA获得超过1540个赞
知道小有建树答主
回答量:1057
采纳率:50%
帮助的人:1132万
展开全部
常用到的就几个:
假如list <int> a;//创建整型链表 a
list <int>::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的结束
andy6355
2012-02-13 · TA获得超过117个赞
知道小有建树答主
回答量:77
采纳率:0%
帮助的人:76.4万
展开全部
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:
assign Assign new content to container (public member function)
push_front Insert element at beginning (public member function)
pop_front Delete first element (public member function)
push_back Add element at the end (public member function)
pop_back Delete last element (public member function)
insert Insert elements (public member function)
erase Erase elements (public member function)
swap Swap content (public member function )
clear Clear 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 )
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式