ReadingLab/Discussion-for-Cpp

关于12.20 打印限制条件

z974890869 opened this issue · 0 comments

我看到答案里用了
bool operator!=(const StrBlobPtr& p) { return p.curr != curr; } 使用 !=
请问如果不用!= ,那么限制条件还可以是什么?
‘’‘
{
StrBlob vs;
//我把代码粘贴到dev中后发现,是在文件路径之前多了一个“?”号。
//解决:用键盘一个个敲进去
ifstream inf("C:/Users/z9748/Desktop/exp_read_ANSI.txt");
string line;
while (getline(inf, line))
{
istringstream stream(line);
string word;
while (stream >> word)
{
vs.push_back(word);
}
}
inf.close();
//打印
for(StrBlobPtr i = vs.begin(); i != vs.end(); i.incr())
{
cout << i.dered() << " ";
}
cout << endl;
}
’‘’