boost container
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的更多相关文章
- boost库使用:vs2013下boost::container::vector编译出错解决
boost版本:boost_1_55_0 bug报告地址 https://svn.boost.org/trac/boost/ticket/9332 出错信息 has_member_function_c ...
- Google C++ Style Guide
Background C++ is one of the main development languages used by many of Google's open-source project ...
- 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 ...
- klayge 4.2.0 编译vc9
CMake Error at CMakeLists.txt:442 (ADD_PRECOMPILED_HEADER): Unknown CMake command "ADD_PRECOMPI ...
- Cppcheck 1.54 C/C++静态代码分析工具
Cppcheck是一个C/C++代码分析工具,只检测那些编译器通常无法检测到的bug类型. 官方上建议让编译器提供尽量多的警告提示:1.使用Visual C++的话,应使用警告等级4 2.使用GC ...
- 【精解】EOS标准货币体系与源码实现分析
EOS智能合约中包含一个exchange合约,它支持用户创建一笔交易,是任何两个基本货币类型之间的交易.这个合约的作用是跨不同币种(都是EOS上的标准货币类型)的,通过各自与EOS主链价值进行锚定,然 ...
- Google C++ 代码规范
Google C++ Style Guide Table of Contents Header Files Self-contained Headers The #define Guard For ...
- c++开发规范
目录 1. 头文件 1.1. Self-contained 头文件 1.2. #define 保护 1.3. 前置声明 1.4. 内联函数 1.5. #include 的路径及顺序 2. 作用域 2. ...
- EOS 修改文件名称与文件夹名称
最近有一个需求,需要修改EOS名称,将所有文件里面的EOS改为UOS,文件夹名称也需要修改,然后重新构建项目,于是写了一个小程序进行修改.如果有相同项目类似的修改,可以在下面这个程序稍做修改就可以了. ...
随机推荐
- php函数名前添加& 函数的引用返回
function &test(){ static $b=0; $b= $b+1; return $b; } $a= test(); echo $a,"\n"; $a = 3 ...
- windowns环境下mysql 安装教程
windowns环境下mysql 安装教程 一:这里以绿色版安装为例(解压就可以使用) 下载地址: 下载页面:https://dev.mysql.com/downloads/mysql/ 2:点击 ...
- indy idhttpserver有关下载的两个问题
http://aawwmate.blog.163.com/blog/static/77528256201092733950315/ indy idhttpserver有关下载的两个问题 2010-10 ...
- HTML中margin与padding的区别!(转)
我们以DIV为一个盒子为例,既然和现实生活中的盒子一样,那我们想一下,生活中的盒子内部是不是空的好用来存放东西,而里面存放东西的区域我们给他起个名字叫“content(内容)”,而盒子的纸壁给他起个名 ...
- 关于狗书《Flask web开发 基于python的Web开发应用实战》中加入用户隐私功能
目前是第二次撸狗书,在用户页面这一块我个人觉得有些问题(基于交互设计).按理来说,我作为一个权限只有User的个人用户来说,肯定不喜欢让别人看到我的真实姓名,地址之类的敏感信息.所以我应该是可以设置成 ...
- C#的一般处理程序中Cookie的写入、读取、清除
1.写入Cookie值 string userName = context.Request.Form["u_Name"].ToString().Trim(); string pwd ...
- c#处理json格式类型的字符串
string channelGroup=[{"SpType":"1","BaseInfoId":["xxx"," ...
- python 可变类型和不可变类型
1. 什么是不可变类型变量对应的值中的数据是不能被修改,如果修改就会生成一个新的值从而分配新的内存空间.不可变类型: 数字(int,long,float) 布尔(bool) 字符串(string) 元 ...
- U盘修复教程--使用量产工具和芯片检测工具
U盘修复教程(金士顿DT101) 本教程使用量产工具(量产可理解为强制恢复出厂设置),量产有风险(U盘彻底报废),根据教程所造成所有损失均与本文作者无关. ·第一步:下载ChipGenius_v4_0 ...
- [Python3 填坑] 015 __str__ 与 __repr__ 的区别
目录 1. print( 坑的信息 ) 2. 开始填坑 2.1 上例子 2.2 关系与区别 Python 3.7.3 的官方文档 网上看到一个例子,运行了一下 简单地说 1. print( 坑的信息 ...