好了,对于使用Visual Studio中用于连接到MySQL数据库的mysqlpp库,我还是个新手,在尝试将mysqlpp::String类型的向量转换为int类型的向量时遇到了麻烦。有没有人有使用mysqlpp的经验,介意帮我一点忙?我已经在下面发布了一个示例,它显示在我的代码中。假设向量futureItemsets已经被填充,我只想将内容复制到一个整数向量中。感谢您能提供的任何帮助!
vector<int> timeFrameItemsets;
vector<mysqlpp::String> futureItemsets;
for(int j = 0; j < static_cast<int>(futureItemsets.size()); j++) {
timeFrameItemsets.push_back(futureItemsets[j]);
}发布于 2010-01-24 16:36:00
String具有operator int(),因此您的代码片段应该可以工作。你对它有什么问题?
如果你想更明确,你可以使用mysqlpp::String的conv函数:
int i = futureItemsets[j].conv<int>(0);
timeFrameItemsets.push_back(i);https://stackoverflow.com/questions/2126380
复制相似问题