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的更多相关文章

  1. 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 ...

  2. Boost简介

    原文链接:  吴豆豆http://www.cnblogs.com/gdutbean/archive/2012/03/30/2425201.html Boost库 Boost库是为C++语言标准库提供扩 ...

  3. Boost 1.61.0 Library Documentation

    http://www.boost.org/doc/libs/1_61_0/ Boost 1.61.0 Library Documentation Accumulators Framework for ...

  4. boost库的安装,使用,介绍,库分类

    1)首先去官网下载boost源码安装包:http://www.boost.org/ 选择下载对应的boost源码包.本次下载使用的是 boost_1_60_0.tar.gz (2)解压文件:tar - ...

  5. C++ Boost库分类总结

    c# 程序员写c++,各种不适应.尤其是被内存操作和几十种字符串类型的转换,简直疯了,大小写转换竟然要手动写代码实现. Boost看介绍不错,也不知道能不能跨平台.过几天要上linux写c++, 也不 ...

  6. boost开发指南

    C++确实很复杂,神一样的0x不知道能否使C++变得纯粹和干爽? boost很复杂,感觉某些地方有过度设计和太过于就事论事的嫌疑,对实际开发工作的考虑太过于理想化.学习boost本身就是一个复杂度,有 ...

  7. boost 介绍

    简介: Boost库是一个可移植.提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一. Boost库由C++标准委员会库工作组成员发起,其中有些内容有望成为下一代C++标准库内容 ...

  8. Google C++ Style Guide

    Background C++ is one of the main development languages used by many of Google's open-source project ...

  9. Google C++ 代码规范

    Google C++ Style Guide   Table of Contents Header Files Self-contained Headers The #define Guard For ...

随机推荐

  1. MongoDB笔记【1】——安装MongoDB

    SQL - 结构化查询语言 - 关系数据库全都同SQL来操作 1.安装MongoDB - 安装 - 配置环境变量 C:\Program Files\MongoDB\Server\3.2\bin - 在 ...

  2. boost array

    boost::array is similar to std::array, which was added to the standard library with C++11. With boos ...

  3. MYSQL索引优化之单表示例

    1. 创建表 CREATE TABLE IF NOT EXISTS `article` ( `id` BIGINT(10) NOT NULL AUTO_INCREMENT, `author_id` I ...

  4. MAX3232 每次只有在上电后,再连接串口线正常——保护电阻。RS232防雷保护

    转载:http://m.newsmth.net/article/Circuit/298517?p=1 转载:http://www.360doc.com/content/18/0719/13/57938 ...

  5. socket | tcp客户端 tcp服务器 udp客户端 udp 服务器 创建方法

    tcp服务器 #coding=utf-8 ''' 这里是tcp服务器端,要先启动 ''' import socket import threading bind_ip = "0.0.0.0& ...

  6. Bootstrap Date Range Picker

    var optionSet1 = { startDate: moment().subtract(29, 'days'), endDate: moment(), minDate: '12/21/2012 ...

  7. idea中以maven工程的方式运行tomcat源码

    0. 准备环境 idea+jdk8+tomcat源码 1.下载tomcat源码: http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/ ...

  8. 详解Linux运维工具:运维流程管理、运维发布变更、运维监控告警

     概述 应用上线后,运维工作才刚开始,具体工作可能包括:升级版本上线工作.服务监控.应用状态统计.日常服务状态巡检.突发故障处理.服务日常变更调整.集群管理.服务性能评估优化.数据库管理优化.随着应用 ...

  9. appium常见问题05_修改Android手机运行环境(adb指令修改hosts)

    自动化测试过程中,手机有时会跳网,怎样保持手机测试的环境稳定性,可以通过adb指令修改android手机hosts,保持手机运行在hosts中配置的环境中: 修改方法如下: 前提条件:已安装andro ...

  10. 【awk】 处理多个文件

    处理多个文件: 1. 可以在代码中指定读取某个文件, 其他的用命令行输入           while ( geline < "file.txt" > 0 ) {   ...