2013-03-17 155 views
0

我创建了一个双向向量,然后尝试将其添加到我定义的对象中。问题是我的vector<double>以某种方式转换为vector<double, allocator<double>>。任何人都能看到为什么vector <double>正被转换为向量<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; 
} 

然后添加到我的对象时,我得到了以下错误:

no matching function for call to generatorTemplate::generatorTemplate(std::string&, std::vector<double, std::allocator<double> >&......

+0

在问题的正文中修正描述,似乎是不完整的wrt/subject。 – wilx 2013-03-17 10:56:42

+1

你应该发布一些实际上重现问题的代码。 – juanchopanza 2013-03-17 11:05:10

回答

相关问题