![]() |
_OI std::copy | ( | _II | __first, | |
_II | __last, | |||
_OI | __result | |||
) | [inline] |
Copies the range [first,last) into result.
memmove
whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling). Result may not be contained within [first,last); the copy_backward function should be used instead.Note that the end of the output range is permitted to be contained within [first,last).
Definition at line 458 of file stl_algobase.h.
_BI2 std::copy_backward | ( | _BI1 | __first, | |
_BI1 | __last, | |||
_BI2 | __result | |||
) | [inline] |
Copies the range [first,last) into result.
first | A bidirectional iterator. | |
last | A bidirectional iterator. | |
result | A bidirectional iterator. |
memmove
whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling).Result may not be in the range [first,last). Use copy instead. Note that the start of the output range may overlap [first,last).
Definition at line 628 of file stl_algobase.h.
Referenced by std::__insertion_sort(), std::__merge_backward(), std::__rotate_adaptive(), and std::deque< _Tp, _Alloc >::_M_reallocate_map().
_OutputIterator std::copy_if | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result, | |||
_Predicate | __pred | |||
) | [inline] |
Copy the elements of a sequence for which a predicate is true.
first | An input iterator. | |
last | An input iterator. | |
result | An output iterator. | |
pred | A predicate. |
[first,last) for which pred
returns true to the range beginning at result
.copy_if() is stable, so the relative order of elements that are copied is unchanged.
Definition at line 965 of file stl_algo.h.
_OutputIterator std::copy_n | ( | _InputIterator | __first, | |
_Size | __n, | |||
_OutputIterator | __result | |||
) | [inline] |
Copies the range [first,first+n) into [result,result+n).
memmove
whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling).
Definition at line 1022 of file stl_algo.h.
References std::__iterator_category().
void std::fill | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
const _Tp & | __value | |||
) | [inline] |
Fills the range [first,last) with copies of value.
first | A forward iterator. | |
last | A forward iterator. | |
value | A reference-to-const of arbitrary type. |
memset
or wmemset
.
Definition at line 730 of file stl_algobase.h.
_OI std::fill_n | ( | _OI | __first, | |
_Size | __n, | |||
const _Tp & | __value | |||
) | [inline] |
Fills the range [first,first+n) with copies of value.
first | An output iterator. | |
n | The count of copies to perform. | |
value | A reference-to-const of arbitrary type. |
memset
or @ wmemset.
Definition at line 785 of file stl_algobase.h.
void std::generate | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Generator | __gen | |||
) | [inline] |
Assign the result of a function object to each value in a sequence.
first | A forward iterator. | |
last | A forward iterator. | |
gen | A function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type |
*i
= gen()
for each i
in the range
[first,last).
Definition at line 4824 of file stl_algo.h.
_OutputIterator std::generate_n | ( | _OutputIterator | __first, | |
_Size | __n, | |||
_Generator | __gen | |||
) | [inline] |
Assign the result of a function object to each value in a sequence.
first | A forward iterator. | |
n | The length of the sequence. | |
gen | A function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type |
first+n
*i
= gen()
for each i
in the range
[first,first+n).
Definition at line 4852 of file stl_algo.h.
bool std::is_partitioned | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_Predicate | __pred | |||
) | [inline] |
Checks whether the sequence is partitioned.
[first,last) is partioned by pred
, i.e. if all elements that satisfy pred
appear before those that do not. Definition at line 817 of file stl_algo.h.
References std::find_if_not(), and std::none_of().
void std::iter_swap | ( | _ForwardIterator1 | __a, | |
_ForwardIterator2 | __b | |||
) | [inline] |
Swaps the contents of two iterators.
Definition at line 117 of file stl_algobase.h.
Referenced by std::__merge_without_buffer(), std::__partition(), std::__reverse(), std::__rotate(), std::__unguarded_partition(), std::next_permutation(), std::prev_permutation(), std::random_shuffle(), and std::swap_ranges().
_OI std::move | ( | _II | __first, | |
_II | __last, | |||
_OI | __result | |||
) | [inline] |
Moves the range [first,last) into result.
memmove
whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling). Result may not be contained within [first,last); the move_backward function should be used instead.Note that the end of the output range is permitted to be contained within [first,last).
Definition at line 491 of file stl_algobase.h.
Referenced by std::vector< _Tp, _Alloc >::insert(), std::vector< _Node *, _Nodeptr_Alloc >::insert(), std::list< _Tp, _Alloc >::insert(), std::deque< _Tp, _Alloc >::insert(), and std::forward_list< _Tp, _Alloc >::insert_after().
_BI2 std::move_backward | ( | _BI1 | __first, | |
_BI1 | __last, | |||
_BI2 | __result | |||
) | [inline] |
Moves the range [first,last) into result.
first | A bidirectional iterator. | |
last | A bidirectional iterator. | |
result | A bidirectional iterator. |
memmove
whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling).Result may not be in the range [first,last). Use move instead. Note that the start of the output range may overlap [first,last).
Definition at line 664 of file stl_algobase.h.
_ForwardIterator std::partition | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Predicate | __pred | |||
) | [inline] |
Move elements for which a predicate is true to the beginning of a sequence.
middle
such that pred(i)
is true for each iterator i
in the range
[first,middle) and false for each i
in the range
[middle,last).pred
must not modify its operand. partition()
does not preserve the relative ordering of elements in each group, use stable_partition()
if this is needed.
Definition at line 5019 of file stl_algo.h.
References std::__iterator_category(), and std::__partition().
pair<_OutputIterator1, _OutputIterator2> std::partition_copy | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator1 | __out_true, | |||
_OutputIterator2 | __out_false, | |||
_Predicate | __pred | |||
) | [inline] |
Copy the elements of a sequence to separate output sequences depending on the truth value of a predicate.
first | An input iterator. | |
last | An input iterator. | |
out_true | An output iterator. | |
out_false | An output iterator. | |
pred | A predicate. |
[first,last) for which pred
returns true to the range beginning at out_true
and each element for which pred
returns false to out_false
.
Definition at line 1051 of file stl_algo.h.
_ForwardIterator std::partition_point | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Predicate | __pred | |||
) | [inline] |
Find the partition point of a partitioned range.
mid
such that all_of(first, mid, pred)
and none_of(mid, last, pred)
are both true. Definition at line 835 of file stl_algo.h.
References std::advance(), and std::distance().
void std::random_shuffle | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __last, | |||
_RandomNumberGenerator & | __rand | |||
) | [inline] |
Shuffle the elements of a sequence using a random number generator.
[first,last) using rand
to provide a random distribution. Calling rand(N)
for a positive integer N
should return a randomly chosen integer from the range [0,N).
Definition at line 4987 of file stl_algo.h.
References std::iter_swap().
void std::random_shuffle | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __last | |||
) | [inline] |
Randomly shuffle the elements of a sequence.
[first,last) using a random distribution, so that every possible ordering of the sequence is equally likely.
Definition at line 4959 of file stl_algo.h.
References std::iter_swap().
_ForwardIterator std::remove | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
const _Tp & | __value | |||
) | [inline] |
Remove elements from a sequence.
value
are removed from the range
[first,last).remove() is stable, so the relative order of elements that are not removed is unchanged.
Elements between the end of the resulting sequence and last
are still present, but their value is unspecified.
Definition at line 1100 of file stl_algo.h.
_OutputIterator std::remove_copy | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result, | |||
const _Tp & | __value | |||
) | [inline] |
Copy a sequence, removing elements of a given value.
first | An input iterator. | |
last | An input iterator. | |
result | An output iterator. | |
value | The value to be removed. |
[first,last) not equal to value
to the range beginning at result
. remove_copy() is stable, so the relative order of elements that are copied is unchanged.
Definition at line 888 of file stl_algo.h.
_OutputIterator std::remove_copy_if | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result, | |||
_Predicate | __pred | |||
) | [inline] |
Copy a sequence, removing elements for which a predicate is true.
first | An input iterator. | |
last | An input iterator. | |
result | An output iterator. | |
pred | A predicate. |
[first,last) for which pred
returns false to the range beginning at result
.remove_copy_if() is stable, so the relative order of elements that are copied is unchanged.
Definition at line 926 of file stl_algo.h.
_ForwardIterator std::remove_if | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Predicate | __pred | |||
) | [inline] |
Remove elements from a sequence using a predicate.
pred
returns true are removed from the range
[first,last).remove_if() is stable, so the relative order of elements that are not removed is unchanged.
Elements between the end of the resulting sequence and last
are still present, but their value is unspecified.
Definition at line 1143 of file stl_algo.h.
void std::replace | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
const _Tp & | __old_value, | |||
const _Tp & | __new_value | |||
) | [inline] |
Replace each occurrence of one value in a sequence with another value.
first | A forward iterator. | |
last | A forward iterator. | |
old_value | The value to be replaced. | |
new_value | The replacement value. |
i
in the range
[first,last) if *i
== old_value
then the assignment *i
= new_value
is performed.
Definition at line 4760 of file stl_algo.h.
_OutputIterator std::replace_copy_if | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result, | |||
_Predicate | __pred, | |||
const _Tp & | __new_value | |||
) | [inline] |
Copy a sequence, replacing each value for which a predicate returns true with another value.
first | An input iterator. | |
last | An input iterator. | |
result | An output iterator. | |
pred | A predicate. | |
new_value | The replacement value. |
result+
(last-first).
[first,last) to the range
[result,result+(last-first)) replacing elements for which pred
returns true with new_value
.
Definition at line 3842 of file stl_algo.h.
void std::replace_if | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Predicate | __pred, | |||
const _Tp & | __new_value | |||
) | [inline] |
Replace each value in a sequence for which a predicate returns true with another value.
first | A forward iterator. | |
last | A forward iterator. | |
pred | A predicate. | |
new_value | The replacement value. |
i
in the range
[first,last) if pred(*i)
is true then the assignment *i
= new_value
is performed.
Definition at line 4792 of file stl_algo.h.
void std::reverse | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __last | |||
) | [inline] |
Reverse a sequence.
[first,last), so that the first element becomes the last etc. For every i
such that 0<=i<=
(last-first)/2), reverse()
swaps *
(first+i) and *
(last-(i+1))
Definition at line 1451 of file stl_algo.h.
References std::__iterator_category(), and std::__reverse().
Referenced by std::next_permutation(), and std::prev_permutation().
_OutputIterator std::reverse_copy | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __last, | |||
_OutputIterator | __result | |||
) | [inline] |
Copy a sequence, reversing its elements.
first | A bidirectional iterator. | |
last | A bidirectional iterator. | |
result | An output iterator. |
[first,last) to the range
[result,result+(last-first)) such that the order of the elements is reversed. For every i
such that 0<=i<=
(last-first), reverse_copy()
performs the assignment *
(result+(last-first)-i) = *(first+i). The ranges
[first,last) and
[result,result+(last-first)) must not overlap.
Definition at line 1478 of file stl_algo.h.
void std::rotate | ( | _ForwardIterator | __first, | |
_ForwardIterator | __middle, | |||
_ForwardIterator | __last | |||
) | [inline] |
Rotate the elements of a sequence.
[first,last) by
(middle-first) positions so that the element at middle
is moved to first
, the element at middle+1
is moved to +1 and so on for each element in the range
[first,last).
This effectively swaps the ranges [first,middle) and
[middle,last).
Performs *
(first+(n+(last-middle))%(last-first))=*(first+n) for each n
in the range [0,last-first).
Definition at line 1671 of file stl_algo.h.
References std::__rotate().
Referenced by std::__inplace_stable_partition(), std::__merge_without_buffer(), std::__rotate_adaptive(), and std::__stable_partition_adaptive().
_OutputIterator std::rotate_copy | ( | _ForwardIterator | __first, | |
_ForwardIterator | __middle, | |||
_ForwardIterator | __last, | |||
_OutputIterator | __result | |||
) | [inline] |
Copy a sequence, rotating its elements.
first | A forward iterator. | |
middle | A forward iterator. | |
last | A forward iterator. | |
result | An output iterator. |
[first,last) to the range beginning at
(middle-first) positions so that the element at middle
is moved to result
, the element at middle+1
is moved to
+1 and so on for each element in the range [first,last).
*
(result+(n+(last-middle))%(last-first))=*(first+n) for each n
in the range
[0,last-first).
Definition at line 1705 of file stl_algo.h.
_ForwardIterator std::stable_partition | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Predicate | __pred | |||
) | [inline] |
Move elements for which a predicate is true to the beginning of a sequence, preserving relative ordering.
middle
such that pred(i)
is true for each iterator i
in the range
[first,middle) and false for each i
in the range
[middle,last).partition()
with the additional guarantee that the relative ordering of elements in each group is preserved, so any two elements x
and y
in the range
[first,last) such that pred(x)==pred
(y) will have the same relative ordering after calling stable_partition()
.
Definition at line 1863 of file stl_algo.h.
References std::__inplace_stable_partition(), std::__stable_partition_adaptive(), std::_Temporary_buffer< _ForwardIterator, _Tp >::begin(), std::_Temporary_buffer< _ForwardIterator, _Tp >::requested_size(), and std::_Temporary_buffer< _ForwardIterator, _Tp >::size().
_ForwardIterator2 std::swap_ranges | ( | _ForwardIterator1 | __first1, | |
_ForwardIterator1 | __last1, | |||
_ForwardIterator2 | __first2 | |||
) | [inline] |
Swap the elements of two sequences.
first2+
(last1-first1).
[first1,last1) with the corresponding element in the range
[first2,(last1-first1)). The ranges must not overlap.
Definition at line 158 of file stl_algobase.h.
References std::iter_swap().
Referenced by std::__rotate(), and __gnu_parallel::parallel_partition().
_OutputIterator std::transform | ( | _InputIterator1 | __first1, | |
_InputIterator1 | __last1, | |||
_InputIterator2 | __first2, | |||
_OutputIterator | __result, | |||
_BinaryOperation | __binary_op | |||
) | [inline] |
Perform an operation on corresponding elements of two sequences.
first1 | An input iterator. | |
last1 | An input iterator. | |
first2 | An input iterator. | |
result | An output iterator. | |
binary_op | A binary operator. |
result+
(last-first).*
(result+N)=binary_op(*(first1+N),*(first2+N)) for each N
in the range
[0,last1-first1).
binary_op
must not alter either of its arguments.
Definition at line 4728 of file stl_algo.h.
_OutputIterator std::transform | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result, | |||
_UnaryOperation | __unary_op | |||
) | [inline] |
Perform an operation on a sequence.
first | An input iterator. | |
last | An input iterator. | |
result | An output iterator. | |
unary_op | A unary operator. |
result+
(last-first).*
(result+N)=unary_op(*(first+N)) for each N
in the range
[0,last-first).
unary_op
must not alter its argument.
Definition at line 4692 of file stl_algo.h.
_ForwardIterator std::unique | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_BinaryPredicate | __binary_pred | |||
) | [inline] |
Remove consecutive values from a sequence using a predicate.
binary_pred
returns true. unique() is stable, so the relative order of elements that are not removed is unchanged. Elements between the end of the resulting sequence and last
are still present, but their value is unspecified.
Definition at line 1223 of file stl_algo.h.
_ForwardIterator std::unique | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last | |||
) | [inline] |
Remove consecutive duplicate values from a sequence.
last
are still present, but their value is unspecified.
Definition at line 1183 of file stl_algo.h.
_OutputIterator std::unique_copy | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result, | |||
_BinaryPredicate | __binary_pred | |||
) | [inline] |
Copy a sequence, removing consecutive values using a predicate.
first | An input iterator. | |
last | An input iterator. | |
result | An output iterator. | |
binary_pred | A binary predicate. |
[first,last) to the range beginning at result
, except that only the first element is copied from groups of consecutive elements for which binary_pred
returns true. unique_copy() is stable, so the relative order of elements that are copied is unchanged._GLIBCXX_RESOLVE_LIB_DEFECTS DR 241. Does unique_copy() require CopyConstructible and Assignable?
Definition at line 4928 of file stl_algo.h.
References std::__iterator_category(), and std::__unique_copy().
_OutputIterator std::unique_copy | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_OutputIterator | __result | |||
) | [inline] |
Copy a sequence, removing consecutive duplicate values.
[first,last) to the range beginning at result
, except that only the first element is copied from groups of consecutive elements that compare equal. unique_copy() is stable, so the relative order of elements that are copied is unchanged._GLIBCXX_RESOLVE_LIB_DEFECTS DR 241. Does unique_copy() require CopyConstructible and Assignable?
_GLIBCXX_RESOLVE_LIB_DEFECTS DR 538. 241 again: Does unique_copy() require CopyConstructible and Assignable?
Definition at line 4888 of file stl_algo.h.
References std::__iterator_category(), and std::__unique_copy().