these several tens generic functions is very important in generic programming.
so we should understand and be familiar with them,and use them as possible as you can.
non-modifying sequence operations:
<for_each>:apply function fo range.
<find>:find value in range.if find the value,stop and return the item's inputeriterator,else return last.
<find_if>:find element in range,but not means the condition is equal,you decide.
<find_end>:find last subsequence in range,two overload,if you dont write the condition ,means equal.
<find_first_of>:find element from set in range.as above find_end,just here is first_of.
<adjacent_find>:find equal adjacent elements in range,and return the first item's iterator.
<count>:count appearances of value in range.
<count_if>:return number of elements in range satisfying condition.
<mismatch>:return first position where two ranges differ.also you can decide the condition by youself.
<equal>:test whether the elements in two ranges are equal.dont consider the elements if second is long
so judge two range is complete the same,you should judge first.size()==second.size().
<search>:find subsequence in range,and return the first,also you can write the condition function.
<search_n>:find succession of equal values in range.like search,but here the subsequence should appearant
n times,and return the first values' iterator.
these functions always return the last iterator when search or find a value failure.
modifying sequence operations:
<copy>:copy range of elements.copy input to output iterator,and return the next of output's last iterator.
<copy_backward>:copy range of elements backwards.such as copy,but first copy last,copy first at last.
<swap>:exchange values of two objects.the arguments are passed by reference.
<swap_ranges>:exchange values of two ranges.it needs three forwarditerators,first,last,begin.
return the second iterator's last exchanged value's next value.
<iter_swap>:exchange values of objects pointed by two iterators.
<transform>:apply function to range.two kinds of overloads,first we can use a unaryoperation,so just need
first,last,result,and unaryoperation.else we use a binaryoperation,just add second first argument.
<replace>:replace value in range.replace old value by new value between first and last forwarditerator,return void.
<replace_if>:replace all the values that fill the predicate with new value.
<replace_copy>:copy range replacing value.it doesnt change the value original,but copy the new sequence value
to another outputiterator,and return the next of the outputiterator' last.
<replace_copy_if>:oh,you can guess the meaning...
<unique>:remove consecutive duplicates in range.if the value is same,just keep the first one,but after this,the end
of the sequence will reserve the old value.it returns forwarditerator the next of the end of new sequence.
<unique_copy>:copy range removing duplicates.also can use binaryoperation decide the condition.
<reverse>:reverse range.the arguments is two bidirectionaliterators.
<reverse_copy>:copy range reversed.
<rotate>:rotate elements in range.arguments,first,middle,last,the middle become first position.
[first,middle) at the end.
<rotate_copy>:
<random_shuffle>:rearrange elements in range randomly.arguments is randomaccessiterator.
<partition>:partition range in two.
<stable_partition>:devide range in two groups - stable ordering.
sorting:
<sort>:sort elements in range.it must be randomaccessable iterator,you can decide the compare function.
<stable_sort>:just stable compare to above.
<partial_sort>:partial sort elements in range.[first,middle) is sorted,others not.
<partial_sort_copy>:in the condition partial sort,and copy the whole or a part of elements to another iterators
binary search:
<lower_bound>:return iterator to lower bound.return first iterator greater or equal to value
<upper_bound>:return iterator to upper bound.return first iterator greater to value.
<equal_range>:get subrange of equal elements.return a pair of iterator first is lower_bound,sec is upper_bound
<binary_search>:test if value exists in sorted array.return true or false.
to be continued......