swap()
template <class T> void swap ( T& a, T& b ){T c(a); a=b; b=c;}
reverse()
template <class BidirectionalIterator>void reverse (BidirectionalIterator first, BidirectionalIterator last){while ((first!=last)&&(first!=--last)) {std::iter_swap (first,last);++first;}}
sort()
template <class RandomAccessIterator, class Compare>void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp);
bool bigger(student a, student b){return (a.score > b.score);}struct student{string name;char gender;int score;};vector<student> v;sort(v.begin(), v.end(), bigger);
unique()
从输入序列中“删除”所有相邻的重复元素,并将这些元素移到最后,返回一个迭代器指针,指针指向的正是最后那些重复元素的第一个元素
prev_permutation()/next_permutation()
template bool prev_permutation (BidirectionalIterator first, BidirectionalIterator last );parameters:first, last : Bidirectional iterators to the initial and final positions of the sequence. The rangeused is [first, last), which contains all theelements between first and last, includingthe element pointed by first but not the elementpointed by last.return value:true : if the function could rearrangethe object as a lexicographicaly smaller permutation.Otherwise, the function returns false to indicate thatthe arrangement is not less than the previous, but the largest possible (sorted in descending order).
