boost pointer container
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
boost pointer container的更多相关文章
- zz A list of open source C++ libraries
A list of open source C++ libraries < cpp | links http://en.cppreference.com/w/cpp/links/libs Th ...
- Boost简介
原文链接: 吴豆豆http://www.cnblogs.com/gdutbean/archive/2012/03/30/2425201.html Boost库 Boost库是为C++语言标准库提供扩 ...
- Boost 1.61.0 Library Documentation
http://www.boost.org/doc/libs/1_61_0/ Boost 1.61.0 Library Documentation Accumulators Framework for ...
- boost库的安装,使用,介绍,库分类
1)首先去官网下载boost源码安装包:http://www.boost.org/ 选择下载对应的boost源码包.本次下载使用的是 boost_1_60_0.tar.gz (2)解压文件:tar - ...
- C++ Boost库分类总结
c# 程序员写c++,各种不适应.尤其是被内存操作和几十种字符串类型的转换,简直疯了,大小写转换竟然要手动写代码实现. Boost看介绍不错,也不知道能不能跨平台.过几天要上linux写c++, 也不 ...
- boost开发指南
C++确实很复杂,神一样的0x不知道能否使C++变得纯粹和干爽? boost很复杂,感觉某些地方有过度设计和太过于就事论事的嫌疑,对实际开发工作的考虑太过于理想化.学习boost本身就是一个复杂度,有 ...
- boost 介绍
简介: Boost库是一个可移植.提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一. Boost库由C++标准委员会库工作组成员发起,其中有些内容有望成为下一代C++标准库内容 ...
- Google C++ Style Guide
Background C++ is one of the main development languages used by many of Google's open-source project ...
- Google C++ 代码规范
Google C++ Style Guide Table of Contents Header Files Self-contained Headers The #define Guard For ...
随机推荐
- SecureCRT 多窗口 批量操作Linux
1.打开多个窗口 2.Window --> Tile Verically将窗口并列展开 3.右击空白部分选择弹出下方的命令窗口 4.右击命令行窗口,选择发送命令至所有窗口 5.完成
- CF 778D Parquet Re-laying——构造
题目:http://codeforces.com/problemset/problem/778/D 完全没思路……就看了题解. 很好地思路是考虑操作可逆,所以起始状态和最终状态都变到一个中转状态,即都 ...
- [CSP-S模拟测试]:marshland(最大费用可行流)
题目描述 前方有一片沼泽地.方便地,我们用一个$n\times n$的网格图来描述它,每一个格子代表着沼泽地的一小片区域.其中$(1,1)$代表网格图的左上角,$(n,n)$代表网格图的右下角.若用$ ...
- Hibernate:More than one row with the given identifier was found解决办法
今天写一个Action 通过 HQL 查询一个表 出现异常 “More than one row with the given identifier was found” 问题原因: 数据库出现数据异 ...
- Unzip 解压报错
$ jar xvf pcre-8.10.zip 如果出现 jar:Command not found 要用yum下载 $ yum -y install java-1.6.0-openjdk-d ...
- oo_project_2java数据类型范围及测试
数据类型范围测试 一.数字常数的编译问题 java中的常量数字默认以int型编译 如: long a = 1234567890; //十位 long b = 12345678900; //默认数据为i ...
- build temu error about SDL
1. 安装sdl2 sudo apt-get install libsdl2-dev 2. 将configure文件中与SDL有关的地方改成SDL2 if test -z "$sdl&quo ...
- 在Emacs中使用plantuml画UML图
在Emacs中使用plantuml画UML图 */--> code {color: #FF0000} pre.src {background-color: #002b36; color: #83 ...
- Flask-Scrip
介绍及安装 Flask-Script是一个让你的命令行支持自定义命令的工具,它为Flask程序添加一个命令行解释器.可以让我们的程序从命令行直接执行相应的程序. 安装 pip install Flas ...
- 图推荐-基于随机游走的personrank算法
转自http://blog.csdn.net/sinat_33741547/article/details/53002524 一 基本概念 基于图的模型是推荐系统中相当重要的一种方法,以下内容的基本思 ...