list的构造函数
来源:互联网 发布:路灯照明计算软件 编辑:程序博客网 时间:2024/05/20 05:11
- explicit list(
- const Allocator& _Al
- );
- explicit list(
- size_type _Count
- );
- list(
- size_type _Count,
- const Type& _Val
- );
- list(
- size_type _Count,
- const Type& _Val,
- const Allocator& _Al
- );
- list(
- const list& _Right
- );
- template<class InputIterator>
- list(
- InputIterator _First,
- InputIterator _Last
- );
- template<class InputIterator >
- list(
- InputIterator _First,
- InputIterator _Last,
- const Allocator& _Al
- );
- list(
- list&& _Right
- );
- // list的构造函数
- void test_list_constructor()
- {
- std::list<int>::iterator c4_Iter, c5_Iter;
- // 0. Create an empty list c0
- std::list<int> c0;
- // 1. Create a list c1 with 3 elements of default value 0
- std::list<int> c1(3);
- // 2. Create a list c2 with 5 elements of value 2
- std::list<int> c2(5, 2);
- // 3. Create a list c3 with 3 elements of value 1 and with the
- // allocator of list c2
- std::list<int> c3(3, 1, c2.get_allocator());
- // 4. Create a copy, list c4, of list c2
- std::list<int> c4(c2);
- // 5. Create a list c5 by copying the range c4[_First, _Last)
- c4_Iter = c4.begin();
- c4_Iter++;
- c4_Iter++;
- std::list<int> c5(c4.begin(), c4_Iter);
- // 6. Create a list c6 by copying the range c4[_First, _Last) and with
- // the allocator of list c2
- c4_Iter = c4.begin();
- c4_Iter++;
- c4_Iter++;
- c4_Iter++;
- std::list<int> c6(c4.begin(), c4_Iter, c2.get_allocator());
- std::cout << "c1 = ";
- std::copy(c1.begin(), c1.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- std::cout << "c2 = ";
- std::copy(c2.begin(), c2.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- std::cout << "c3 = ";
- std::copy(c3.begin(), c3.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- std::cout << "c4 = ";
- std::copy(c4.begin(), c4.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- std::cout << "c5 = ";
- std::copy(c5.begin(), c5.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- std::cout << "c6 = ";
- std::copy(c6.begin(), c6.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- }
0 0
- list的构造函数
- 【STL】list的构造函数
- C++类继承构造函数的语法 & initialization list初始化
- 构造函数的构造顺序
- 构造函数中显式的调基类构造函数
- 构造函数、拷贝构造函数的运用
- 类的构造函数、拷贝构造函数
- String的构造函数拷贝构造函数
- 【构造函数】解析构造函数的作用
- < C++ > initializer list 初始化列表(构造函数后面加个冒号的解释)
- WebService的构造函数
- 类的构造函数
- private的构造函数
- C#的构造函数
- 类的构造函数
- 构造函数 的protected
- 构造函数的理解
- 类的构造函数
- Laravel 4 Tutorial / Add_Twitter-Bootstrap
- C++ 容器及选用总结
- Android Design Support Library使用详解
- 传智播客Android7.16日入驻大广州
- Hibernate 的关系映射总结
- list的构造函数
- 仿凤凰时时彩代购平台源码[ASP+MSSQL]完整下载
- js Date对象的使用
- UCGUI自定义字库及显示汉字的程序
- 关于serialPort控件的使用跟INI文件的创建,读取,写入方法
- brenda写的sql增删改查模板代码
- Hive总结(七)Hive四种数据导入方式
- nc md5加密
- vector常用函数的例子