1 Star 0 Fork 0

Gfox/C_plus_puls

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test.cpp 647 Bytes
一键复制 编辑 原始数据 按行查看 历史
Gfox 提交于 2024-05-25 17:22 +08:00 . add List实现/test.cpp.
#include <iostream>
#include <cstring>
#include <algorithm>
#include <list>
using namespace std;
#include "list.h"
void list_splice()
{
list<int>mylist1, mylist2;
for (int i = 1; i <= 4; i++) mylist1.push_back(i);
for (int i = 1; i <= 4; i++) mylist2.push_back(i * 10);
std::list<int>::iterator it1 = mylist1.begin();
it1++;
mylist1.splice(it1, mylist2); // 转移mylist2到it1位置之前
// 注意:此时链表2就为空链表了 所以splice名字叫做转移
for (auto& e : mylist1)
{
cout << e << " ";
}
}
int main()
{
// list_splice();
bit::test1();
bit::test_list2();
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zfox-f/c_plus_puls.git
git@gitee.com:zfox-f/c_plus_puls.git
zfox-f
c_plus_puls
C_plus_puls
master

搜索帮助