c++ - 为什么这里会报”没有与参数列表匹配的 重载函数 "getline" 实例“ 的错误?
PHP中文网
PHP中文网 2017-04-17 14:50:17
0
1
1591

我在把C++primer中的433页代码照着敲到vs2015后,出现以下问题。

#include<vector>
#include<string>
#include<map>
#include<memory>
#include<set>

class QueryResult;
class TextQuery {
public:
    using line_no = std::vector<std::string>::size_type;
    TextQuery(std::ifstream&);
    QueryResult query(const std::string&) const;
private:
    std::shared_ptr<std::vector<std::string>> file;
    std::map <std::string, std::shared_ptr<std::set<line_no>>> wm;
};

TextQuery::TextQuery(std::ifstream &is) :file(new std::vector<std::string>)
{
    std::string text;
    while (getline(is, text)) {//这里getline会标红,出现前面所述的错误
        file->push_back(text);
        int n = file->size() - 1;
        istringstream line(text);//这里line会标红,报错:不允许使用不完整的类型
        std::string word;
        while (line >> word) {//这里>>会标红:禁止显示状态
没有与这些操作数匹配的 ">>" 运算符    


        }
    }
}
PHP中文网
PHP中文网

认证0级讲师

全部回覆(1)
刘奇

雷雷

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!