1.静态数组array,boost对静态数组进行了封装,使用和普通数组一样的初始化式进行初始化。

#include <iostream>
#include <boost/array.hpp>
using namespace std;
using namespace boost; int main()
{
array<int,10> ar;
ar.back() = 10;
array<string,3> ar1 = {"tiger","dog","cat"};
return 0;
}

2.dynamic_bitset可以自由扩充二进制位的位数,可以自由进行位操作,还有一堆方便操作判断的函数。

#include <iostream>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using namespace boost; int main()
{
dynamic_bitset<> db1;
dynamic_bitset<> db2(10);
cout << db2 <<endl;
db2.resize(6,true);
cout << db2 <<endl;
dynamic_bitset<> db3(string("100010"));
cout << db3<<endl;
cout << (db2 ^ db3) <<endl;
cout << (db2 & db3) <<endl;
if (db2.none())
{
cout << "have no 1"<<endl;
}
return 0;
}

3.unordered和hash_set,hash_map一样底层使用哈希表代替二叉树,实现关联容器。

4.bimap双向map

#include <iostream>
#include <string>
#include <boost/bimap.hpp>
using namespace std;
using namespace boost; int main()
{
bimap<int,string> bm;
bm.left.insert(make_pair(1,"111"));
bm.left.insert(make_pair(2,"222"));
bm.right.insert(make_pair("string",3));
bm.right.insert(make_pair("bimap",4));
for (bimap<int,string>::right_iterator it = bm.right.begin();it != bm.right.end();++it)
{
cout << it->second <<endl;
} return 0;
}

5.any可以被初始化或者赋值任意类型的数据

#include <iostream>
#include <string>
#include <boost/any.hpp>
using namespace std;
using namespace boost; int main()
{
any a(100);
a =string("char *");
//a = vector<vector<>int >(); return 0;
}

boost之数据结构和容器的更多相关文章

  1. boost::multi_index 多索引容器

    #include "stdafx.h" #include <string> #include <boost/multi_index_container.hpp&g ...

  2. Boost C++: 数据结构---tuple

    #include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple_io.hpp> #include <boost/ ...

  3. C++ STL常见数据结构(容器)分类

    vector:(连续的空间存储,可以使用[]操作符)快速的访问随机的元素,快速的在末尾插入元素,但是在序列中间的插入,删除元素要慢,而且如果一开始分配的空间不够的话,可能重新分配更大空间,拷贝的性能开 ...

  4. 自制数据结构(容器)-java开发用的最多的ArrayList和HashMap

    public class MyArrayList<E> { private int capacity = 10; private int size = 0; private E[] val ...

  5. 【Python】【容器 | 迭代对象 | 迭代器 | 生成器 | 生成器表达式 | 协程 | 期物 | 任务】

    Python 的 asyncio 类似于 C++ 的 Boost.Asio. 所谓「异步 IO」,就是你发起一个 IO 操作,却不用等它结束,你可以继续做其他事情,当它结束时,你会得到通知. Asyn ...

  6. kubernetes容器编排系统介绍

    版权声明:本文由turboxu原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/152 来源:腾云阁 https://www. ...

  7. boost 无锁队列

    一哥们翻译的boost的无锁队列的官方文档 原文地址:http://blog.csdn.net/great3779/article/details/8765103 Boost_1_53_0终于迎来了久 ...

  8. 一文带你看透kubernetes 容器编排系统

    本文由云+社区发表 作者:turboxu Kubernetes作为容器编排生态圈中重要一员,是Google大规模容器管理系统borg的开源版本实现,吸收借鉴了google过去十年间在生产环境上所学到的 ...

  9. Pandas三个数据结构

    系列(Series) 数据帧(DataFrame) 面板(Panel) 这些数据结构构建在Numpy数组之上,这意味着它们很快. 考虑这些数据结构的最好方法是,较高维数据结构是其较低维数据结构的容器. ...

随机推荐

  1. Html添加百度地图

    方法/步骤 1.打开“百度地图生成器”的网址:http://api.map.baidu.com/lbsapi/creatmap/index.html 如下图: 2.在“1.定位中心点”中,切换城市,并 ...

  2. java - day12 - ShapeTest

    抽象类的定义及使用 抽象类不能实例化,但抽象类名的数组类型可以,见案例 package com.example; public class ShapeTest { public static void ...

  3. [精]Oracle 11G数据库VMware虚拟机下载

    虚拟机文件下载地址: http://pan.baidu.com/s/1pJL5Tub 备份一个防止失效 https://pan.baidu.com/s/1nvbZQad Readme文件: 数据库版本 ...

  4. Say goodbye to 重复代码---Eclipse代码模板的使用

    我们在开发过程中,有些代码是经常重复编写的,而且是必要的,如单例模式,观察者模式. 每次都是重复重复再重复. 那么如何提高我们的效率呢? 要记住,我们使用的是IDE,不是文本编辑器.善用工具,事半功倍 ...

  5. Struts2框架拦截器:

    Struts 2框架提供了良好的预配置,并准备使用的盒拦截.下面列出了几个重要的拦截器: SN Interceptor & 描述 1 aliasAllows parameters to hav ...

  6. goldengate原理与简单配置

    goldengate的原理:http://www.ipresst.com/works/52bc44c42954a7d73b0003f2 简单单向配置: 在oracle官网下载下载 GoldenGate ...

  7. 嵌入式开发之davinci--- 8148/8168/8127 中的alsa音频pcm g711 和aac 音频格式

    (1)alsa pcm (2)g711 (3)aac (4) --------------author:pkf -------------------time:2-4 ---------------- ...

  8. C#调用python脚本

    因项目需要,需要使用C#控制台程序执行python脚本,查询各种资料后可以成功调用了,记录一下,以备后面遗忘. 只尝试了两种调用方式,第一种只适用于python脚本中不包含第三方模块的情况,第二种针对 ...

  9. Gallery学习————检测手机中是否存在外部存储设备

    在缓存数据的时,有时候会出现没有外部存储设备的情况,所以需要检测是否存在外部存储设备 /** * 检测外部存储设备 * * @param requireWriteAccess * @return */ ...

  10. Python_selenium之执行JavaScript

    Python_selenium之执行JavaScript 一.简略的介绍selenium执行JavaScript 1. Example 1进入浏览器之后,弹出一个alert弹框 #coding:utf ...