[GeekBand]STLと汎型プログラミング-3
9866 ワード
このノートは主に各アルゴリズムの関数テンプレートを一覧表示します.変異アルゴリズム
for_each
copy発泡体並べ替え 挿入順序:直接挿入順序、ヒル順序 は、並べ替え(const)を選択します.並べ替え、積み上げ は直接選択されます.快速並べ替え 正規並べ替え(const) バレルの並べ替え 基数並べ替え(const) カウント順序 メモリ分配器
メモリ分配器はインターフェースを満たす必要があります.グループtypedef: allocator:rebind:allocatorの埋め込みテンプレートは、otherメンバー を定義する必要があります. allocator:allocator():構造関数
for_each
template
Function for_each (InputIterator first, InputIterator last, Function fn);
findtemplate
InputIterator find (InputIterator first, InputIterator last, const T& val);
find_iftemplate
InputIterator find_if (InputIterator first,
InputIterator last,
UnaryPredicate pred);
adjacent_find// equality version
template
ForwardIterator adjacent_find (ForwardIterator first, ForwardIterator last);
// predicate version
template
ForwardIterator adjacent_find (ForwardIterator first, ForwardIterator last,
BinaryPredicate pred);
find_first_保存先// equality version
template
ForwardIterator1 find_first_of (ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2);
// predicate version
template
ForwardIterator1 find_first_of (ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred);
counttemplate
typename iterator_traits::difference_type
count (InputIterator first, InputIterator last, const T& val);
count_iftemplate
typename iterator_traits::difference_type
count_if (InputIterator first, InputIterator last, UnaryPredicate pred);
mismatch// equality version
template
pair
mismatch (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2);
// predicate version
template
pair
mismatch (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred);
equal// equality version
template
bool equal (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2);
// predicate version
template
bool equal (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred);
search// equality version
template
ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2);
// predicate version
template
ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred);
変異アルゴリズムcopy
// copy
template
OutputIterator copy (InputIterator first, InputIterator last,
OutputIterator result);
// copy_n
template
OutputIterator copy_n (InputIterator first, Size n,
OutputIterator result);
// copy_backward
template
BidirectionalIterator2 copy_backward (BidirectionalIterator1 first,
BidirectionalIterator1 last,
BidirectionalIterator2 result);
// copy_if
template
OutputIterator copy_if (InputIterator first, InputIterator last,
OutputIterator result, UnaryPredicate pred);
swap// swap
template void swap (T& a, T& b);
// swap_ranges
template
ForwardIterator2 swap_ranges (ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2);
トランスフォーム// unary operation
template
OutputIterator transform (InputIterator first1, InputIterator last1,
OutputIterator result, UnaryOperation op);
// binary operation
template
OutputIterator transform (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, OutputIterator result,
BinaryOperation binary_op);
replace// replace
template
void replace (ForwardIterator first, ForwardIterator last,
const T& old_value, const T& new_value);
// replace_if
template
void replace_if (ForwardIterator first, ForwardIterator last,
UnaryPredicate pred, const T& new_value );
// replace_copy
template
OutputIterator replace_copy (InputIterator first, InputIterator last,
OutputIterator result,
const T& old_value, const T& new_value);
// replace_copy_if
template
OutputIterator replace_copy_if (InputIterator first, InputIterator last,
OutputIterator result, UnaryPredicate pred,
const T& new_value);
filltemplate
void fill (ForwardIterator first, ForwardIterator last, const T& val);
ゲナートtemplate
void generate (ForwardIterator first, ForwardIterator last, Generator gen);
remove// remove
template
ForwardIterator remove (ForwardIterator first, ForwardIterator last,
const T& val);
// remove_if
template
ForwardIterator remove_if (ForwardIterator first, ForwardIterator last,
UnaryPredicate pred);
// remove_copy
template
OutputIterator remove_copy (InputIterator first, InputIterator last,
OutputIterator result, const T& val);
unique// equality
template
ForwardIterator unique (ForwardIterator first, ForwardIterator last);
// predicate
template
ForwardIterator unique (ForwardIterator first, ForwardIterator last,
BinaryPredicate pred);
逆転セtemplate
void reverse (BidirectionalIterator first, BidirectionalIterator last);
rotatetemplate
ForwardIterator rotate (ForwardIterator first, ForwardIterator middle,
ForwardIterator last);
ランドムshuffle// generator by default
template
void random_shuffle (RandomAccessIterator first, RandomAccessIterator last);
// specific generator
template
void random_shuffle (RandomAccessIterator first, RandomAccessIterator last,
RandomNumberGenerator&& gen);
パーティーtemplate
ForwardIterator partition (ForwardIterator first,
ForwardIterator last, UnaryPredicate pred);
並べ替えメモリ分配器はインターフェースを満たす必要があります.
allocator::value_type
allocator::pointer
allocator::const_pointer
allocator::reference
allocator::const_reference
allocator::size_type
allocator::difference_type