博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
boost array
阅读量:5342 次
发布时间:2019-06-15

本文共 972 字,大约阅读时间需要 3 分钟。

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 
#include
#include
#include
int main() { boost::array
a; a[0] = "cat"; a.at(1) = "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 0;}

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.

转载于:https://www.cnblogs.com/sssblog/p/11017048.html

你可能感兴趣的文章
Python: 对于DataFrame.loc传入列表和传入元组输出区别的理解
查看>>
USACO / Sorting a Three-Valued Sequence (简单题,方法正确性待证)
查看>>
Android开发中 .9.png格式图形设计:
查看>>
Linux常见命令
查看>>
ASP.NET Page执行顺序如:OnPreInit()、OnInit()
查看>>
linux下编译安装nginx
查看>>
adb命令
查看>>
SQL自定义排序 ORDER BY
查看>>
Modal模态框scrolltop保留上次位移的解决方案
查看>>
python 函数(一)
查看>>
我说我在总结谁会信。。
查看>>
数据库索引的作用和长处缺点
查看>>
Laravel 安装代码智能提示扩展「laravel-ide-helper」
查看>>
java开发配套版本
查看>>
MySQL的 Grant命令权限分配
查看>>
非阻塞的c/s,epoll服务器模型
查看>>
YII框架安装过程总结
查看>>
HDOJ(HDU) 1862 EXCEL排序(类对象的快排)
查看>>
Codeforces Round #381 (Div. 2) 复习倍增//
查看>>
Money类型转化为String去除小数点后0解决方法
查看>>