试试这个:
int main()
{
std::fstream fin_fout("some.txt");
std::istream_iterator<std::string> beg(fin_fout),end;
std::distance(beg,end);//if this line is commented out it works fine but not if is uncommented
while (beg != end)
{
cout << *beg;
++beg;
}
return 0;
}