关于Stream Iterators(流迭代器)。
TheC++StandardLibrary中第5章5.5.2节(P107)有这样一个程序:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
vector<string> coll;
copy(istream_iterator<string>(cin),
istream_iterator<string>(), //end of source
back_inserter(coll));
sort(coll.begin(), coll.end());
unique_copy(coll.begin(), coll.end(),
ostream_iterator<string>(cout, "\n"));
}
怎么才能结束输入?