设置std::array的容量
时间: 2023-08-24 19:05:39 浏览: 141
C++语言中std::array的用法小结(神器用法)
5星 · 资源好评率100%
回答: std::array的容量是固定的,由数组的大小决定。在初始化std::array对象时,需要指定数组的大小。例如,std::array<int, 5> arr; 创建了一个容量为5的std::array对象,其中可以容纳5个int类型的元素。\[1\]
#### 引用[.reference_title]
- *1* [C++11 std::array 用法小结](https://blog.csdn.net/hellokandy/article/details/125880281)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [c++标准模板(STL),std::array用法说明](https://blog.csdn.net/qq_40788199/article/details/119654148)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [std::array](https://blog.csdn.net/TimerSea/article/details/123725653)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文