【发布时间】:2021-03-04 10:01:34
【问题描述】:
如果我想使用
编辑:
例如,我正在尝试制作一个 NxN 矩阵:
int n = 5;
std::vector<std::vector<bool>> (n, std::vector<bool>(n, false))
这给了我以下错误
error: no match for call to ‘(std::vector<std::vector<bool> >) (int&, std::vector<bool>)’
作为参考,如果我这样做,我会得到同样的错误:
int n = 5;
std::vector<bool> row(n, false);
std::vector<std::vector<bool>> (n, row)
【问题讨论】:
-
你考虑过
std::bitset吗? -
请使用您尝试过的编码示例编辑您的文本;没有图片。
标签: c++ matrix vector initialization boolean