#include <algorithm>
#include <numeric>
只读:
find
写:
fill fill_n
vector<int> vec; // empty vector // ok: back_inserter creates an insert iterator that adds elements to vec
fill_n (back_inserter(vec), 10, 0); // appends 10 elements to vec
copy (ilst.begin(), ilst.end(), back_inserter(ivec));
排序:
// sort words alphabetically so we can find the duplicates
sort(words.begin(), words.end());
vector<string>::iterator end_unique = unique(words.begin(), words.end());
words.erase(end_unique, words.end());