私はC++ STLの機能をテストすると奇妙な問題があります。 if(eee)の行のコメントを外すと、whileループは決して終了しません。
私は64ビットWindowsでvs2015を使用しています。このstl演算子>>関数はマジックを起こしますか?
int i = 0;
istream& mystream = data.getline(mycharstr,128);
size_t mycount = data.gcount();
string str(mycharstr,mycharstr+mycount);
istringstream myinput(str);
WORD myfunclist[9] = {0};
for_each(myfunclist,myfunclist+9, [](WORD& i){ i = UINT_MAX;});
CALLEESET callee_set;
callee_set.clear();
bool failbit = myinput.fail();
bool eof = myinput.eof();
while (!failbit && !eof)
{
int eee = myinput.peek();
if (EOF == eee) break;
//if (eee) // if i uncomment this line ,the failbit and eof will always be false,so the loop will never exit.
{
myinput >> myfunclist[i++];
}
//else break;
failbit = myinput.fail();
eof = myinput.eof();
cout << myinput.rdstate() << endl;
}
@Christophe - これはどのように正確に複製することができますか? 'peek'と' fail'の両方が使われているので、それは非常に異なっているようです。さらに、問題はEOFに関連しないif文についてです。 – 4386427
@ 4386427あなたは正しく、それは正確な複製ではありません。私は – Christophe
デニスを再開しました。これが標準テンプレートライブラリ(STL)とどのように関連しているのかを教えてください。 – Christophe