向量向量字符串固定大小
vector vector string fixed size
我如何声明这样一个向量,像vector<vector<string>>vec(1)(2)
使用vec[0][0]
和vec[0][1]
而不使用push_back
的动态大小。
using namespace std;
array< array< string, 2 >, 1 > vec;
std::vector
用于动态大小的数组。std::array
(c++ 11,或使用Boost库)用于固定大小的数组。
std::vector<std::vector<string>> vec(1, std::vector<string>(2));
则可以访问vec[0][0]
和vec[0][1]
。(你可以改变矢量的大小)
相关文章:
- 在for循环中使用auto vs decltype(vec.size())来处理字符串的向量
- 构造<int>具有 2 个字符串文字的向量
- 如何将元素添加到向量的字符串位置
- 将向量解析<string>为字符串
- C ++中的StringStream有助于使用向量从字符串中提取逗号分隔的整数,而不是空格分隔的整数,为什么?
- 在 C++11 中,如何查找并返回以给定字符串开头的字符串向量中的所有项?
- 如何使用向量字符串令牌构建表达树
- 将 argv 复制到新的全局向量字符串
- 如何读取控制台输入并将其存储到向量字符串中
- 向量字符串push_back在C 中不起作用
- C char数组和向量字符串
- 可以直接初始化向量<字符串 *> 而不使用 new 吗?
- 迭代向量字符串的字符(C++禁止指针和整数之间的比较)
- 比较两个向量字符串的相似性C++
- 我有麻烦将字符串放入向量字符串
- 如何从一个向量字符串得到一个字符串的联合集
- 函数返回向量/字符串,但不返回数组
- 向量向量字符串固定大小
- c++向量字符串排序不工作
- C++将字符串数组[]复制到向量<字符串>