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,文件夹名称也需要修改,然后重新构建项目,于是写了一个小程序进行修改.如果有相同项目类似的修改,可以在下面这个程序稍做修改就可以了. ...
随机推荐
- python 数值系列-进制转换
进制转换 前语: 如果您不通二进制,八进制,十六进制,请移步:http://www.360doc.com/content/17/0211/21/40101294_628326994.shtml 问题 ...
- EZOJ #389点分治好题
分析 一层一层把叶子去掉 看最多能去掉多少层即可 代码 #include<bits/stdc++.h> using namespace std; ],du[],fa[],n,m,ans; ...
- ruby+selenium-webdriver测试
参考这里的博客https://www.cnblogs.com/smiling007/p/5116662.html
- 测开之路六十一:接口测试平台之interface蓝图
create的js //添加header的函数function add_header() { // 这里是动态拼接html语句,带着样式,拼凑成页面的 "key [] value []&qu ...
- LinkedList 源码解读
LinkedList 源码解读 基于jdk1.7.0_80 public class LinkedList<E> extends AbstractSequentialList<E&g ...
- Kakuro Extension【最大流】
HDU-3338 这道题真的处理起来好复杂啊,题意就是个简单的方格填数问题,但是每个白点至少放1,那么最后的可能解是怎样的呢?我们是不是要把x轴上的和y轴上的统一起来,然后就是每个点都被对应的x和y匹 ...
- hdu6228Tree
Problem Description Consider a un-rooted tree T which is not the biological significance of tree or ...
- Git002--安装
Git--安装 本文来自于:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00 ...
- Mac006--swithchosts安装
Mac006--swithchosts安装 使用brew命令安装:brew cask install switchhosts 因为mac上,网络下载无法进行安装,所以应用brew命令安装. switc ...
- 排序算法四:快速排序(Quicksort)
快速排序(Quicksort),因其排序之快而得名,虽然Ta的平均时间复杂度也是O(nlgn),但是从后续仿真结果看,TA要比归并排序和堆排序都要快. 快速排序也用到了分治思想. (一)算法实现 pr ...