您好,我正在尝试制作一个包装器来处理来自MySQL查询的行和列结果。语句返回的数据可以是字符串或空指针。所以这是我的尝试:
class RowWrapper {
public:
std::vector< std::vector <std::string> > data;
void SetVector(unsigned int rows, unsigned int columns);
};
void RowWrapper::SetVector(unsigned int rows, unsigned int columns)
{
for (int x = 0; x > rows; x++)
{
std::vector<std::string> p_rows;
for (int y = 0; y > columns; y++)
{
p_rows.push_back(x*y); //Error here
}
data.push_back(temp_rows);
}
}我的错误是没有重载函数的实例,可能缺少一些关于向量或字符串的东西。
发布于 2012-08-05 17:13:41
当x>行时,你的循环是什么?然后你会递增吗?我认为,只要不传递最大int值,就可以在ever...or上运行它
此外,您的push_back以int作为参数,并且没有将int值作为参数的字符串的构造函数。重载函数错误可能是由这个原因引起的?
https://stackoverflow.com/questions/11815182
复制相似问题