⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 04-1.cpp

📁 effective stl 源代码 code
💻 CPP
字号:
//
// Example from ESTL Item 4
//

#include <list>
#include <iostream>
#include "ESTLUtil.h"

int main()
{
	using namespace std;
	using namespace ESTLUtils;

	const int vals1[] = { 1, 2, 3, 4, 5};

	const int nvals1 = sizeof vals1 / sizeof(int);

	const int vals2[] = { -3, 2, 5, 6, 9, 102, -15, 10 , 11, 12};
	const int nvals2 = sizeof vals2 / sizeof(int);

	list<int> list1(vals1, vals1 + nvals1);
	list<int> list2(vals2, vals2 + nvals2);
	
	cout << "Before:" << endl;
	printContainers("list1", list1, "list2", list2);

	list1.splice(									// move all nodes in list2
	  list1.end(), list2,							// (from the first occurrence
	  find(list2.begin(), list2.end(), 5),			// of 5 up to 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -