boost::array is similar to std::array, which was added to the standard library with C++11. With boost::array, an array can be created that exhibits the same properties as a C array. In addition, boost::array conforms to the requirements of C++ containers, which makes handing such an array as easy as handling any other container.

#include <boost/array.hpp>
#include <string>
#include <algorithm>
#include <iostream> int main() {
boost::array<std::string, > a;
a[] = "cat";
a.at() = "shark";
*a.rbegin() = "spider"; std::sort(a.begin(), a.end()); for (const std::string& s: a) {
std::cout << s << std::endl;
} std::cout << a.size() << std::endl;
std::cout << a.max_size() << std::endl;
return ;
}

using boost::array is fairly simple and needs no additional explanation since the member functions called the same meaning as their counterparts from std::vector.

boost array的更多相关文章

  1. boost array使用

    #include <iostream> #include<boost/array.hpp> int main() { boost::array<int, 6> ar ...

  2. #include <boost/array.hpp>

    Boost的array,元素可以是std::string #include <iostream> #include <string> #include <boost/ar ...

  3. Array的简单使用(Boost和STL通用)

    目录 目录 介绍 使用 Boost和STL的区别 介绍 本来这一次是想简单介绍一下Boost里面的协程库的使用的,但是Boost.Coroutine已经被废弃了,而Boost.Coroutine2目前 ...

  4. BOOST.Asio——Tutorial

    =================================版权声明================================= 版权声明:原创文章 谢绝转载  啥说的,鄙视那些无视版权随 ...

  5. boost:进程管理

    概述 Boost.Process提供了一个灵活的C++ 进程管理框架.它允许C++ developer可以像Java和.Net程序developer那样管理进程.它还提供了管理当前执行进程上下文.创建 ...

  6. boost库在工作(36)网络服务端之六

    在上面介绍了管理所有连接的类,这个类主要就是添加新的连接,或者删除不需要的连接.但是管理的类CAllConnect是没有办法知道什么时候添加,什么时候删除的,它需要从接收到连接类里获取得到新的连接,从 ...

  7. boost.ASIO-可能是下一代C++标准的网络库

    曾几何时,Boost中有一个Socket库,但后来没有了下文,C++社区一直在翘首盼望一个标准网络库的出现,网络上开源的网络库也有不少,例如Apache Portable Runtime就是比较著名的 ...

  8. boost库在工作(37)网络UDP服务端之七

    前面介绍的都是网络TCP的服务器和客户端,其实还有UDP的服务器和客户端,同时也有同步和异步之分.UDP与TCP最大的区别,就是TCP是基于连接的,而UDP是无连接的.这里所谓的连接是指对方中断服务时 ...

  9. boost库在工作(32)网络服务端之二

    在这个例子里,服务器对象主要使用boost::asio::io_service对象,这个对象主要用来构造异步接收数据使用,接着定义boost::asio::ip::tcp::acceptor对象,这个 ...

随机推荐

  1. drawArc

    1) 画笔设置 Paint.Style.STROKE 中空模式 paint = new Paint(); //新建一个画笔对象 paint.setAntiAlias(true);//抗锯齿功能 pai ...

  2. 慎用create table as select,一定要注意默认值的问题

    再做一些数据迁移时候,很多人会使用create table  as select * from table where id=-1的方式来年建立一摸一样的表,但是这样做有个很大的弊端,不能将原表中的d ...

  3. jvm 更多链接

    http://www.cnblogs.com/dingyingsi/p/3760447.html    :  讲解 jvm https://blog.csdn.net/Luomingkui1109/a ...

  4. [Python3 填坑] 015 __str__ 与 __repr__ 的区别

    目录 1. print( 坑的信息 ) 2. 开始填坑 2.1 上例子 2.2 关系与区别 Python 3.7.3 的官方文档 网上看到一个例子,运行了一下 简单地说 1. print( 坑的信息 ...

  5. [Python3 填坑] 013 几个类相关函数的举例

    目录 1. print( 坑的信息 ) 2. 开始填坑 2.1 issubclass() 2.2 isinstance() 2.3 hasattr() 2.4 getattr() 2.5 setatt ...

  6. centos下Linux C语言MD5的使用

    在Linux C变成中用到MD5加密会使用到openssl库,下面给出的是一个简单的小Demo: #include <stdio.h> #include <openssl/md5.h ...

  7. 三种分布式锁 简易说说(包含前一篇提到的redis分布式锁)

    大多数互联网系统都是分布式部署的,分布式部署确实能带来性能和效率上的提升,但为此,我们就需要多解决一个分布式环境下,数据一致性的问题. 当某个资源在多系统之间,具有共享性的时候,为了保证大家访问这个资 ...

  8. php上传文件如何保证上传文件不被改变或者乱码

    很多网站上传文件都截取文件后缀,前面用时间错加后缀组成,然而一下下载的网站并不需要这样,需要保持原来的文件名,这里讲述一下 //上传操作 function uploadify(){ //var_dum ...

  9. windows下安装oracle11g

    第一步:一定要先做这一步. Oracle11g 安装过程出现提示:未找到文件 D:\app\Administrator\product\11.2.0\dbhome_2\owb\external\oc4 ...

  10. axios 如何获取下载文件的进度条

    exportFun(){         let _that = this         const instance = this.axios.create({           onDownl ...