优艾设计网

为什么这里会报”没有与参数列表匹配的 重载函数 "getline" 实例“的错 财富值97?

我在把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 st优艾设计网_Photoshop交流d::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) {//这里>>会标红:禁止显示状态 没有与这些操作数匹配的 ">>" 运算符 } } }


0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜