We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unique_copy 只能去除相邻的重复元素,如果在输入流中的序列不是有序的,那么unique_copy并不能完全去掉所有重复元素,所以在使用 unique_copy 之前要先排序
下面是我的代码,先全部拷贝到vector中,进行排序,再用unique_copy 拷贝到输出迭代器中
istream_iterator<int> in_iter(cin), eof; ostream_iterator<int> out_iter(cout, " "); vector<int> v; copy(in_iter, eof, back_inserter(v)); sort(v.begin(), v.end()); unique_copy(v.cbegin(), v.cend(), out_iter); cout << endl;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
unique_copy 只能去除相邻的重复元素,如果在输入流中的序列不是有序的,那么unique_copy并不能完全去掉所有重复元素,所以在使用 unique_copy 之前要先排序
下面是我的代码,先全部拷贝到vector中,进行排序,再用unique_copy 拷贝到输出迭代器中
The text was updated successfully, but these errors were encountered: