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 数字系列-无穷大与NaN
无穷大与NaN 问题 你想创建或测试正无穷.负无穷或NaN(非数字)的浮点数. 解决方案 Python并没有特殊的语法来表示这些特殊的浮点值,但是可以使用 float() 来创建它们.比如: > ...
- 126、TensorFlow Session的执行
# tf.Session.run 方法是一个执行tf.Operation或者计算tf.Tensor的一个主要的机制 # 你可以传递一个或者多个tf.Operation或者tf.Tensor对象来给tf ...
- php中数组的指针
利用PHP内置的函数 key() 获得键. current()获得值, next(); prev();移动到上一个 reset();//重置,移动到第一个元素 end();//移动到最后一个元素上 注 ...
- eclipse调试debug时出现source not found
eclipse调试debug时出现source not found 在代码中设置了断点,程序调试过程中可以继续运行使用断点,但是看不见程序走到哪了,debug页面出现source not found, ...
- 多个springboot项目部署到tomcat,Error deploying web application archive
每个springboot单独部署到tomcat下可以正常启动,多个一个就发生异常 Error deploying web application archive 解决:配置文件加上配置区分 sprin ...
- vm虚拟机用批处理启动和关闭
title vmware 虚拟机开启中 cls&&echo 正在开启VMware虚拟机,请稍候... "D:\vmware\vmware.exe" -x " ...
- Python 图片格式的转换和尺寸修改
import cv2 import os import numpy as np from PIL import Image import shutil import sys image_size=14 ...
- [LeetCode] 287. Find the Duplicate Number(Floyd判圈算法)
传送门 Description Given an array nums containing n + 1 integers where each integer is between 1 and n ...
- DS-哈希表浅析
1.哈希表 2.哈希函数 3.哈希冲突 哈希表 哈希表是一种按key-value存储的数据结构,也称散列表. 之前的数组.树和图等等查找一个值时都要与结构中的值相比较,查找的效率取决于比较的次数. 而 ...
- 基于dvwa环境下级别为low的SQL手工注入教程
基于dvwa环境下级别为low的SQL手工注入教程: 首先是进入已搭建好的dvwa环境中去(一定要搭建好dvwa环境才能进行下面的操作),这可能会是一些初学者所面临的的第一个问题,比如我,曾为了寻找这 ...