boost array
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的更多相关文章
- boost array使用
#include <iostream> #include<boost/array.hpp> int main() { boost::array<int, 6> ar ...
- #include <boost/array.hpp>
Boost的array,元素可以是std::string #include <iostream> #include <string> #include <boost/ar ...
- Array的简单使用(Boost和STL通用)
目录 目录 介绍 使用 Boost和STL的区别 介绍 本来这一次是想简单介绍一下Boost里面的协程库的使用的,但是Boost.Coroutine已经被废弃了,而Boost.Coroutine2目前 ...
- BOOST.Asio——Tutorial
=================================版权声明================================= 版权声明:原创文章 谢绝转载 啥说的,鄙视那些无视版权随 ...
- boost:进程管理
概述 Boost.Process提供了一个灵活的C++ 进程管理框架.它允许C++ developer可以像Java和.Net程序developer那样管理进程.它还提供了管理当前执行进程上下文.创建 ...
- boost库在工作(36)网络服务端之六
在上面介绍了管理所有连接的类,这个类主要就是添加新的连接,或者删除不需要的连接.但是管理的类CAllConnect是没有办法知道什么时候添加,什么时候删除的,它需要从接收到连接类里获取得到新的连接,从 ...
- boost.ASIO-可能是下一代C++标准的网络库
曾几何时,Boost中有一个Socket库,但后来没有了下文,C++社区一直在翘首盼望一个标准网络库的出现,网络上开源的网络库也有不少,例如Apache Portable Runtime就是比较著名的 ...
- boost库在工作(37)网络UDP服务端之七
前面介绍的都是网络TCP的服务器和客户端,其实还有UDP的服务器和客户端,同时也有同步和异步之分.UDP与TCP最大的区别,就是TCP是基于连接的,而UDP是无连接的.这里所谓的连接是指对方中断服务时 ...
- boost库在工作(32)网络服务端之二
在这个例子里,服务器对象主要使用boost::asio::io_service对象,这个对象主要用来构造异步接收数据使用,接着定义boost::asio::ip::tcp::acceptor对象,这个 ...
随机推荐
- vue双向数据绑定v-model
1.双向数据绑定 <input v-model="msg" /> <template> <div id="app"> < ...
- Centos6.5在线配置安装Java环境与Tomcat环境
书写此文一来记录环境,以便后期查看使用,Linux环境下配置centos与Java开发环境 本文环境:虚拟机系统centos6.5 链接工具:xshell脚本链接工具 一.安装Java开发 ...
- 搞死人不偿命的 Bank系统
每一个成功者都有一个开始.勇于开始,才能够找到通往成功的路. 最近C#进行到第三章:升级Mybank,发现这是一个我个人觉得比较难搞的一个东西,一下是我对Bank系统难点的叙述,请大神笔下留情~ 1. ...
- Nginx 官网文档翻译汇总
Nginx 官网文档,各个模块的手册在这里. Nginx 中文文档 - 淘宝翻译 改版后的新 Nginx 官网文档 概述 新手指南 控制 Nginx 管理员指南 Admin Guide 安装 基本功能 ...
- 16/7/14-MySQL-修改mysql5.6以上版本root密码
版本更新,原来user里的password字段已经变更为authentication_string 版本更新 缘故,好多网上的教程都不适用了,甚至连官网的文档也不是能够顺利操作的. 如果 MySQL ...
- 交换机vlan配置
vlan:virtual LAN 虚拟局域网 作用:通过VLAN技术,可以对局域网进行隔离,互相隔离开的局域网相互之间不能进行通信,一个VLAN为一个广播域 Vlan配置 GNS3(使用路由器来模拟 ...
- springboot启动脚本
#!/bin/sh JAVA_HOME="/ulic1/jdk/jdk1.8.0_201/bin" export JAVA_HOME lsof -i:9010 |awk '{pri ...
- python之字符串的切片
切片操作(slice)可以从一个字符串中获取子字符串(字符串的一部分).我们使用一对方括号.起始偏移量start.终止偏移量end 以及可选的步长step 来定义一个分片. 格式: [start:en ...
- Interface-接口的实现与注意事项
package cn.learn.Interface; public interface MyInterfaceA { public abstract void methodA(); public a ...
- JavaScript Sort
function ArrayList() { var array = []; this.swap = function(index1, index2) { var aux = array[index1 ...