boost pointer container
2024-10-07 16:33:40
1. boost::ptr_vector
#include <boost/ptr_container/ptr_vector.hpp>
#include <iostream> int main() {
boost::ptr_vector<int> v;
v.push_back(new int());
v.push_back(new int());
std::cout << v.back() << std::endl;
return ;
}
boost::ptr_vector knows that it stores dynamically allocated objects, member functions like back() return a reference to a dynamically allocated object and not a pointer. Thus, the example writes 2 to standard output.
2. boost:ptr_set 有顺序的容器
#include <boost/ptr_container/ptr_set.hpp>
#include <iostream> int main() {
boost::ptr_set<int> s;
s.insert(new int());
s.insert(new int());
std::cout << *s.begin() << std::endl;
return ;
}
输出: 1
3. additional containers include boost::ptr_deque, boost::ptr_list, boost::ptr_map, boost::ptr_unordered_set, boost::ptr_unordered_map
最新文章
- OC self = [super init] , 点语法 , @property
- 2分钟 windows下sublime text 3安装git插件:
- linux 强大的编辑器之vi
- powerdesigner 15 如何导出sql schema
- Java循环语句之 for
- 18、GPS技术
- Poj 2586 / OpenJudge 2586 Y2K Accounting Bug
- Cassandra1.2文档学习(17)—— CQL数据模型(上)
- SQLServer 在Visual Studio的连接方法
- 登录超时,给出提示跳到登录页面(ajax、导入、导出)
- gcc 编译的4个过程简单识记
- 通过rpm 安装MYSQL
- 新版TP-Link无线路由器怎么设置
- 下一个计划 : .NET/.NET Core应用性能管理系统
- case 函数的简单使用记录下
- qq截图存放在电脑的哪个文件夹
- pygame-KidsCanCode系列jumpy-part6-主角挂掉重新开始
- php+mysql 解决emoji问题
- MT【233】染色正方形
- Maven中的-D(Properties属性)和-P(Profiles配置文件)
热门文章
- 【leetcode】1023. Camelcase Matching
- 如何隐藏一个让人很难发现的bug?
- Linux配置postfix
- [CSP-S模拟测试]:v(hash表+期望DP)
- 如果遇到找不到元素如何处理? Exception in thread ";main"; org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {";method";:";id";,";selector";:";investmentframe";}
- jmeter添加自定义扩展函数之DoubleSum
- 用 Flask 来写个轻博客 (25) — 使用 Flask-Principal 实现角色权限功能
- delphi vlc 安装bug 处理编译错误"0" is an invalid value for the "DebugInformation" parameter of the "DCC"
- Java + selenium 元素定位(2)之By LinkText/PartialLinkText
- git使用记录三:查看日志