Boost Container provides additional advantages:

(1) The interface of the containers resemble those of the containers in the C++11 standard library.

(2) With boost::container::slist or boost::container::stable_vector, Boost container offers containers the standard library doesn't provide.

(3) The implementation is platform independent.

(4) The containers from Boost Container support incomplete types and can be used to define recursive containers.

#include <boost/container/stable_vector.hpp>
#include <iostream> using namespace boost::container; int main() {
stable_vector<int> v(, );
int& i = v[];
v.erase(v.begin());
std::cout << i << std::endl;
return ;
}

输出:1

boost::container::stable_vector behaves similarly to std::vector, except that if boost::container::stable_vector is changed, all iterators and references to existing elements remain valid. This is possible because elements aren't stored contiguously in boost::container::stable_vector. It is still possible to access elements with an index even though elements are not stored next to each other in memory.

Additional containers provided by Boost Container are boost::container::flat_set, boost::container::flat_map, boost::container_slist, boost::container::static_vector.

boost::container::static_vector stores elements like std::array directly in the container. Like std::array, the container has a constant capacity. The capacity is conastant, but can be changed with resize(). push_back() doesn't change the capacity, throws an exception of type std::bad_alloc.

boost container的更多相关文章

  1. boost库使用:vs2013下boost::container::vector编译出错解决

    boost版本:boost_1_55_0 bug报告地址 https://svn.boost.org/trac/boost/ticket/9332 出错信息 has_member_function_c ...

  2. Google C++ Style Guide

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

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

  4. klayge 4.2.0 编译vc9

    CMake Error at CMakeLists.txt:442 (ADD_PRECOMPILED_HEADER): Unknown CMake command "ADD_PRECOMPI ...

  5. Cppcheck 1.54 C/C++静态代码分析工具

    Cppcheck是一个C/C++代码分析工具,只检测那些编译器通常无法检测到的bug类型.   官方上建议让编译器提供尽量多的警告提示:1.使用Visual C++的话,应使用警告等级4 2.使用GC ...

  6. 【精解】EOS标准货币体系与源码实现分析

    EOS智能合约中包含一个exchange合约,它支持用户创建一笔交易,是任何两个基本货币类型之间的交易.这个合约的作用是跨不同币种(都是EOS上的标准货币类型)的,通过各自与EOS主链价值进行锚定,然 ...

  7. Google C++ 代码规范

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

  8. c++开发规范

    目录 1. 头文件 1.1. Self-contained 头文件 1.2. #define 保护 1.3. 前置声明 1.4. 内联函数 1.5. #include 的路径及顺序 2. 作用域 2. ...

  9. EOS 修改文件名称与文件夹名称

    最近有一个需求,需要修改EOS名称,将所有文件里面的EOS改为UOS,文件夹名称也需要修改,然后重新构建项目,于是写了一个小程序进行修改.如果有相同项目类似的修改,可以在下面这个程序稍做修改就可以了. ...

随机推荐

  1. Win32下session和window station以及desktop一些介绍和应用

    会话(session).工作站(WindowStation).桌面(Disktop).窗口(window) https://blog.csdn.net/hlswd/article/details/77 ...

  2. react 中事件参数和一般参数以及this绑定的写法

    import React from 'react'; import PropTypes from 'prop-types'; class Home extends React.Component{ r ...

  3. 史上最全USB HID开发资料

    史上最全USB HID开发资料 史上最全USB HID开发资料,悉心整理一个月,亲自测试. 涉及STM32 C51 8051F例子都有源码,VC上位机例子以及源码,USB协议,HID协议,USB抓包工 ...

  4. Unity3D热更新方案网摘总结

    参考:http://blog.csdn.net/guofeng526/article/details/52662994 http://blog.csdn.net/u010019717/article/ ...

  5. Windows系统命令整理-Win10

    硬件相关 显卡 显卡升级 - 我的电脑->属性->设备管理器->显示适配器->更新驱动程序 服务 telnet 安装:启用或关闭Windows 功能,勾选上“Telnet客户端 ...

  6. mysql 5.1.34

     在make之前,将MAKEFILE中的do abi check注释,不要注释名字... mysql 5.1 编译安装 分类: mysql2012-04-06 13:01 17175人阅读 评论(0) ...

  7. onblur和onkeyup事件

    onblur:事件会在对象失去焦点时发生 提示:onblur 相反事件为onfocus事件 . onkeyup: 事件会在键盘按键被松开时发生. 提示:与onkeyup 事件相关的事件发生次序: on ...

  8. 【小刘的linux学习笔记 】——01认识操作系统

    1.操作系统的地位 计算机系统由硬件和软件两部分组成.通常把未配置软件的计算机称为裸机.直接使用裸机不仅不方便,而且将严重降低工作效率和机器的利用率. 操作系统(OS,Operation System ...

  9. Learning OSG programing---osgShape

    本例示范了osg中Shape ---- 基本几何元素的绘制过程.参照osg官方文档,Shape 类包含以下子类: 在示例程序中,函数createShapes函数用于生成需要绘制的几何形状. osg:: ...

  10. jvm性能监控(4)–JVM的监控工具Jconsole

    下面主要说一下怎么JConsole远程连接springboot 项目 java  \-Djava.rmi.server.hostname=192.131.149.42 \-Dcom.sun.manag ...