c 11是什么型号的电子产品?
- 内容介绍
- 文章标签
- 相关推荐
本文共计842个文字,预计阅读时间需要4分钟。
在C++中,不可或缺的标准库是STL。STL包含许多实用的数据结构,如vector、list、map、set等,都是我们常用的。C++11对STL也做了一些补充,使得STL的内容更加丰富,可选性也更多。
在c++里面不得不提的一个标准库,就是STL,STL包含很多实用的数据结构,如vector,list,map,set等都是我们常用的,而c++11也对STL做了一些补充,使得STL的内容越来越丰富,可选择的也越来越多了。
1. std::array
先看一段代码:
#include <array> #include <iostream> int main() { std::array<int, 4> arrayDemo = { 1,2,3,4 }; std::cout << "arrayDemo:" << std::endl; for (auto itor : arrayDemo) { std::cout << itor << std::endl; } int arrayDemoSize = sizeof(arrayDemo); std::cout << "arrayDemo size:" << arrayDemoSize << std::endl; return 0; }
从上面代码可以看到,其实std::array跟数组没什么区别,只是增加了迭代器的功能。
本文共计842个文字,预计阅读时间需要4分钟。
在C++中,不可或缺的标准库是STL。STL包含许多实用的数据结构,如vector、list、map、set等,都是我们常用的。C++11对STL也做了一些补充,使得STL的内容更加丰富,可选性也更多。
在c++里面不得不提的一个标准库,就是STL,STL包含很多实用的数据结构,如vector,list,map,set等都是我们常用的,而c++11也对STL做了一些补充,使得STL的内容越来越丰富,可选择的也越来越多了。
1. std::array
先看一段代码:
#include <array> #include <iostream> int main() { std::array<int, 4> arrayDemo = { 1,2,3,4 }; std::cout << "arrayDemo:" << std::endl; for (auto itor : arrayDemo) { std::cout << itor << std::endl; } int arrayDemoSize = sizeof(arrayDemo); std::cout << "arrayDemo size:" << arrayDemoSize << std::endl; return 0; }
从上面代码可以看到,其实std::array跟数组没什么区别,只是增加了迭代器的功能。

