C++ list::insert
来源:互联网 发布:淘宝客的软件 编辑:程序博客网 时间:2024/06/06 20:10
原文
mylist.insert (it,10)
会在mylist的it迭代器之前插入10
可选参数n
mylist.insert (it,n,20);
则会在it前插入n个20
// inserting into a list#include <iostream>#include <list>#include <vector>using namespace std;int main (){ list<int> mylist; list<int>::iterator it; // set some initial values: for (int i=1; i<=5; ++i) mylist.push_back(i); // 1 2 3 4 5 it = mylist.begin(); ++it; // it points now to number 2 ^ mylist.insert (it,10); // 1 10 2 3 4 5 // "it" still points to number 2 ^ mylist.insert (it,2,20); // 1 10 20 20 2 3 4 5 --it; // it points now to the second 20 ^ vector<int> myvector (2,30); mylist.insert (it,myvector.begin(),myvector.end()); // 1 10 20 30 30 20 2 3 4 5 // ^ cout << "mylist contains:"; for (it=mylist.begin(); it!=mylist.end(); ++it) cout << ' ' << *it; cout << '\n'; return 0;}
0 0
- list.insert()
- list .insert() & rbegin()
- leetcode:Insert Sort List
- List::insert remove
- [leetcode] Insert sort list
- C++ list::insert
- Python List insert()方法
- Python List insert() Method
- mybatis insert list
- Insert in a sorted list
- 【Python】Python3 List insert()方法
- Insert into a Cyclic Sorted List
- ServiceStack.Redis里List的Insert操作
- 代码面试题:Insert Sorted Linked List
- Insert & delte elements in doublely linked list
- Python pandas insert list into a cell
- Sorted insert for circular linked list
- C++ list——push_back()与insert()
- POJ 2699 The Maximum Number of Strong Kings 最大流 枚举
- java.awt.headless 详解
- SharedPreference.Editor的apply和commit方法异同
- MySQL之DDL,DQL,DML,DCL
- 用友U8数据库修复用友t3数据库修复用友/823错误824错误/检测到基于一致性的逻辑 I O 错误/ tempdb 空间用尽或某一系统表不一致
- C++ list::insert
- NKOI 2419 集合的第N元素
- android adb push apk /system/app
- Android网络编程(四)从源码解析Volley
- git忽略已被跟踪的文件
- Bengio大神的《Deep Learning》全书已完稿可获取全书电子版
- 史上最强Android 开启照相或者是从本地相册选中一张图片以后先裁剪在保存并显示的讲解附源码i
- 动态创建Dom元素,并设置属性和类----JS&JQ
- jqm里的ajax的一些问题