2013-03-17 153 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

回答

相關問題