我正在尝试按如下方式分配矢量bool:
var nfi = (NumberFormatInfo)CultureInfo.CurrentCulture.NumberFormat.Clone();
nfi.NumberGroupSeparator = " ";
string value = amount.ToString("n2", nfi);
它编译好,但得到以下运行时错误:
#include <iostream>
#include <vector>
using namespace std;
struct item {
int value;
vector<bool> pb;
vector<bool> *path = &pb;
};
int main(int argc, char* argv[]) {
vector<item> dp(10);
for (int n = 0; n < 10; n++)
dp[n].pb = vector<bool>(10);
}
An invalid parameter was passed to a function that considers invalid parameters fatal.
和dp
的值为
如何将矢量bool分配给现有变量?