我正在创建一个双精度向量,然后尝试将其添加到我定义的对象中。问题是我vector<double>
正在以vector<double, allocator<double>>
某种方式转换为。谁能明白为什么?
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
double stringToDouble( const std::string& s )
{
std::istringstream i(s);
double x;
if (!(i >> x))
return 0;
return x;
}
int main() {
ifstream userDefine("userDefine.csv");
string token, line;
stringstream iss;
int count = 0;
vector<double> prices;
while ( getline(userDefine, line) )
{
iss << line;
while ( getline(iss, token, ',') )
{
double temp = stringToDouble(token);
prices.push_back(temp);
}
}
return 0;
}
然后,当添加到我的对象时,我收到以下错误:
没有匹配的调用函数
generatorTemplate::generatorTemplate(std::string&, std::vector<double, std::allocator<double> >&......