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

我在把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级讲师

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!