libstdc++
Mutating
Collaboration diagram for Mutating:

Functions

template<typename _II , typename _OI >
constexpr _OI std::copy (_II __first, _II __last, _OI __result)
 
template<typename _BI1 , typename _BI2 >
constexpr _BI2 std::copy_backward (_BI1 __first, _BI1 __last, _BI2 __result)
 
template<typename _InputIterator , typename _OutputIterator , typename _Predicate >
constexpr _OutputIterator std::copy_if (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred)
 
template<typename _InputIterator , typename _Size , typename _OutputIterator >
constexpr _OutputIterator std::copy_n (_InputIterator __first, _Size __n, _OutputIterator __result)
 
template<typename _ForwardIterator , typename _Tp >
constexpr void std::fill (_ForwardIterator __first, _ForwardIterator __last, const _Tp &__value)
 
template<typename _OI , typename _Size , typename _Tp >
constexpr _OI std::fill_n (_OI __first, _Size __n, const _Tp &__value)
 
template<typename _ForwardIterator , typename _Generator >
constexpr void std::generate (_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
 
template<typename _OutputIterator , typename _Size , typename _Generator >
constexpr _OutputIterator std::generate_n (_OutputIterator __first, _Size __n, _Generator __gen)
 
template<typename _InputIterator , typename _Predicate >
constexpr bool std::is_partitioned (_InputIterator __first, _InputIterator __last, _Predicate __pred)
 
template<typename _ForwardIterator1 , typename _ForwardIterator2 >
constexpr void std::iter_swap (_ForwardIterator1 __a, _ForwardIterator2 __b)
 
template<typename _II , typename _OI >
constexpr _OI std::move (_II __first, _II __last, _OI __result)
 
template<typename _BI1 , typename _BI2 >
constexpr _BI2 std::move_backward (_BI1 __first, _BI1 __last, _BI2 __result)
 
template<typename _ForwardIterator , typename _Predicate >
constexpr _ForwardIterator std::partition (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 
template<typename _InputIterator , typename _OutputIterator1 , typename _OutputIterator2 , typename _Predicate >
constexpr pair< _OutputIterator1, _OutputIterator2 > std::partition_copy (_InputIterator __first, _InputIterator __last, _OutputIterator1 __out_true, _OutputIterator2 __out_false, _Predicate __pred)
 
template<typename _ForwardIterator , typename _Predicate >
constexpr _ForwardIterator std::partition_point (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 
template<typename _RandomAccessIterator >
void std::random_shuffle (_RandomAccessIterator __first, _RandomAccessIterator __last)
 
template<typename _RandomAccessIterator , typename _RandomNumberGenerator >
void std::random_shuffle (_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomNumberGenerator &&__rand)
 
template<typename _ForwardIterator , typename _Tp >
constexpr _ForwardIterator std::remove (_ForwardIterator __first, _ForwardIterator __last, const _Tp &__value)
 
template<typename _InputIterator , typename _OutputIterator , typename _Tp >
constexpr _OutputIterator std::remove_copy (_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp &__value)
 
template<typename _InputIterator , typename _OutputIterator , typename _Predicate >
constexpr _OutputIterator std::remove_copy_if (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred)
 
template<typename _ForwardIterator , typename _Predicate >
constexpr _ForwardIterator std::remove_if (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 
template<typename _ForwardIterator , typename _Tp >
constexpr void std::replace (_ForwardIterator __first, _ForwardIterator __last, const _Tp &__old_value, const _Tp &__new_value)
 
template<typename _InputIterator , typename _OutputIterator , typename _Predicate , typename _Tp >
constexpr _OutputIterator std::replace_copy_if (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred, const _Tp &__new_value)
 
template<typename _ForwardIterator , typename _Predicate , typename _Tp >
constexpr void std::replace_if (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp &__new_value)
 
template<typename _BidirectionalIterator >
constexpr void std::reverse (_BidirectionalIterator __first, _BidirectionalIterator __last)
 
template<typename _BidirectionalIterator , typename _OutputIterator >
constexpr _OutputIterator std::reverse_copy (_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
 
template<typename _ForwardIterator >
constexpr _ForwardIterator std::rotate (_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
 
template<typename _ForwardIterator , typename _OutputIterator >
constexpr _OutputIterator std::rotate_copy (_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result)
 
template<typename _RandomAccessIterator , typename _UniformRandomNumberGenerator >
void std::shuffle (_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRandomNumberGenerator &&__g)
 
template<typename _ForwardIterator , typename _Predicate >
_ForwardIterator std::stable_partition (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 
template<typename _ForwardIterator1 , typename _ForwardIterator2 >
constexpr _ForwardIterator2 std::swap_ranges (_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
 
template<typename _InputIterator , typename _OutputIterator , typename _UnaryOperation >
constexpr _OutputIterator std::transform (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __unary_op)
 
template<typename _InputIterator1 , typename _InputIterator2 , typename _OutputIterator , typename _BinaryOperation >
constexpr _OutputIterator std::transform (_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _OutputIterator __result, _BinaryOperation __binary_op)
 
template<typename _ForwardIterator >
constexpr _ForwardIterator std::unique (_ForwardIterator __first, _ForwardIterator __last)
 
template<typename _ForwardIterator , typename _BinaryPredicate >
constexpr _ForwardIterator std::unique (_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __binary_pred)
 
template<typename _InputIterator , typename _OutputIterator >
constexpr _OutputIterator std::unique_copy (_InputIterator __first, _InputIterator __last, _OutputIterator __result)
 
template<typename _InputIterator , typename _OutputIterator , typename _BinaryPredicate >
constexpr _OutputIterator std::unique_copy (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __binary_pred)
 

Detailed Description

Function Documentation

◆ copy()

template<typename _II , typename _OI >
constexpr _OI std::copy ( _II  __first,
_II  __last,
_OI  __result 
)
inlineconstexpr

Copies the range [first,last) into result.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
result + (last - first)

This inline function will boil down to a call to 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 611 of file stl_algobase.h.

◆ copy_backward()

template<typename _BI1 , typename _BI2 >
constexpr _BI2 std::copy_backward ( _BI1  __first,
_BI1  __last,
_BI2  __result 
)
inlineconstexpr

Copies the range [first,last) into result.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultA bidirectional iterator.
Returns
result - (last - first)

The function has the same effect as copy, but starts at the end of the range and works its way to the start, returning the start of the result. This inline function will boil down to a call to 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 848 of file stl_algobase.h.

◆ copy_if()

template<typename _InputIterator , typename _OutputIterator , typename _Predicate >
constexpr _OutputIterator std::copy_if ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_Predicate  __pred 
)
constexpr

Copy the elements of a sequence for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__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 691 of file stl_algo.h.

◆ copy_n()

template<typename _InputIterator , typename _Size , typename _OutputIterator >
constexpr _OutputIterator std::copy_n ( _InputIterator  __first,
_Size  __n,
_OutputIterator  __result 
)
inlineconstexpr

Copies the range [first,first+n) into [result,result+n).

Parameters
__firstAn input iterator.
__nThe number of elements to copy.
__resultAn output iterator.
Returns
result+n.

This inline function will boil down to a call to 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 746 of file stl_algo.h.

◆ fill()

template<typename _ForwardIterator , typename _Tp >
constexpr void std::fill ( _ForwardIterator  __first,
_ForwardIterator  __last,
const _Tp &  __value 
)
inlineconstexpr

Fills the range [first,last) with copies of value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__valueA reference-to-const of arbitrary type.
Returns
Nothing.

This function fills a range with copies of the same value. For char types filling contiguous areas of memory, this becomes an inline call to memset or wmemset.

Definition at line 991 of file stl_algobase.h.

◆ fill_n()

template<typename _OI , typename _Size , typename _Tp >
constexpr _OI std::fill_n ( _OI  __first,
_Size  __n,
const _Tp &  __value 
)
inlineconstexpr

Fills the range [first,first+n) with copies of value.

Parameters
__firstAn output iterator.
__nThe count of copies to perform.
__valueA reference-to-const of arbitrary type.
Returns
The iterator at first+n.

This function fills a range with copies of the same value. For char types filling contiguous areas of memory, this becomes an inline call to memset or wmemset.

If __n is negative, the function does nothing.

Definition at line 1143 of file stl_algobase.h.

◆ generate()

template<typename _ForwardIterator , typename _Generator >
constexpr void std::generate ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Generator  __gen 
)
constexpr

Assign the result of a function object to each value in a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__genA function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type
Returns
generate() returns no value.

Performs the assignment *i = __gen() for each i in the range [__first,__last).

Definition at line 4389 of file stl_algo.h.

◆ generate_n()

template<typename _OutputIterator , typename _Size , typename _Generator >
constexpr _OutputIterator std::generate_n ( _OutputIterator  __first,
_Size  __n,
_Generator  __gen 
)
constexpr

Assign the result of a function object to each value in a sequence.

Parameters
__firstA forward iterator.
__nThe length of the sequence.
__genA function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type
Returns
The end of the sequence, __first+__n

Performs the assignment *i = __gen() for each i in the range [__first,__first+__n).

If __n is negative, the function does nothing and returns __first.

Definition at line 4423 of file stl_algo.h.

◆ is_partitioned()

template<typename _InputIterator , typename _Predicate >
constexpr bool std::is_partitioned ( _InputIterator  __first,
_InputIterator  __last,
_Predicate  __pred 
)
inlineconstexpr

Checks whether the sequence is partitioned.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__predA predicate.
Returns
True if the range [__first,__last) is partioned by __pred, i.e. if all elements that satisfy __pred appear before those that do not.

Definition at line 533 of file stl_algo.h.

◆ iter_swap()

template<typename _ForwardIterator1 , typename _ForwardIterator2 >
constexpr void std::iter_swap ( _ForwardIterator1  __a,
_ForwardIterator2  __b 
)
inlineconstexpr

Swaps the contents of two iterators.

Parameters
__aAn iterator.
__bAnother iterator.
Returns
Nothing.

This function swaps the values pointed to by two iterators, not the iterators themselves.

Definition at line 152 of file stl_algobase.h.

◆ move()

template<typename _II , typename _OI >
constexpr _OI std::move ( _II  __first,
_II  __last,
_OI  __result 
)
inlineconstexpr

Moves the range [first,last) into result.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
result + (last - first)

This inline function will boil down to a call to 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 644 of file stl_algobase.h.

◆ move_backward()

template<typename _BI1 , typename _BI2 >
constexpr _BI2 std::move_backward ( _BI1  __first,
_BI1  __last,
_BI2  __result 
)
inlineconstexpr

Moves the range [first,last) into result.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultA bidirectional iterator.
Returns
result - (last - first)

The function has the same effect as move, but starts at the end of the range and works its way to the start, returning the start of the result. This inline function will boil down to a call to 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 883 of file stl_algobase.h.

◆ partition()

template<typename _ForwardIterator , typename _Predicate >
constexpr _ForwardIterator std::partition ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Predicate  __pred 
)
inlineconstexpr

Move elements for which a predicate is true to the beginning of a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate functor.
Returns
An iterator 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 4622 of file stl_algo.h.

◆ partition_copy()

template<typename _InputIterator , typename _OutputIterator1 , typename _OutputIterator2 , typename _Predicate >
constexpr pair<_OutputIterator1, _OutputIterator2> std::partition_copy ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator1  __out_true,
_OutputIterator2  __out_false,
_Predicate  __pred 
)
constexpr

Copy the elements of a sequence to separate output sequences depending on the truth value of a predicate.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__out_trueAn output iterator.
__out_falseAn output iterator.
__predA predicate.
Returns
A pair designating the ends of the resulting sequences.

Copies each element in the range [__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 783 of file stl_algo.h.

◆ partition_point()

template<typename _ForwardIterator , typename _Predicate >
constexpr _ForwardIterator std::partition_point ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Predicate  __pred 
)
constexpr

Find the partition point of a partitioned range.

Parameters
__firstAn iterator.
__lastAnother iterator.
__predA predicate.
Returns
An iterator mid such that all_of(__first, mid, __pred) and none_of(mid, __last, __pred) are both true.

Definition at line 555 of file stl_algo.h.

◆ random_shuffle() [1/2]

template<typename _RandomAccessIterator >
void std::random_shuffle ( _RandomAccessIterator  __first,
_RandomAccessIterator  __last 
)
inline

Randomly shuffle the elements of a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
Nothing.

Reorder the elements in the range [__first,__last) using a random distribution, so that every possible ordering of the sequence is equally likely.

Deprecated:
Since C++14 std::random_shuffle is not part of the C++ standard. Use std::shuffle instead, which was introduced in C++11.

Definition at line 4541 of file stl_algo.h.

◆ random_shuffle() [2/2]

template<typename _RandomAccessIterator , typename _RandomNumberGenerator >
void std::random_shuffle ( _RandomAccessIterator  __first,
_RandomAccessIterator  __last,
_RandomNumberGenerator &&  __rand 
)

Shuffle the elements of a sequence using a random number generator.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__randThe RNG functor or function.
Returns
Nothing.

Reorders the elements in the range [__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).

Deprecated:
Since C++14 std::random_shuffle is not part of the C++ standard. Use std::shuffle instead, which was introduced in C++11.

Definition at line 4581 of file stl_algo.h.

◆ remove()

template<typename _ForwardIterator , typename _Tp >
constexpr _ForwardIterator std::remove ( _ForwardIterator  __first,
_ForwardIterator  __last,
const _Tp &  __value 
)
inlineconstexpr

Remove elements from a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valueThe value to be removed.
Returns
An iterator designating the end of the resulting sequence.

All elements equal to __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 833 of file stl_algo.h.

◆ remove_copy()

template<typename _InputIterator , typename _OutputIterator , typename _Tp >
constexpr _OutputIterator std::remove_copy ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
const _Tp &  __value 
)
inlineconstexpr

Copy a sequence, removing elements of a given value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__valueThe value to be removed.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__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 622 of file stl_algo.h.

◆ remove_copy_if()

template<typename _InputIterator , typename _OutputIterator , typename _Predicate >
constexpr _OutputIterator std::remove_copy_if ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_Predicate  __pred 
)
inlineconstexpr

Copy a sequence, removing elements for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__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 656 of file stl_algo.h.

◆ remove_if()

template<typename _ForwardIterator , typename _Predicate >
constexpr _ForwardIterator std::remove_if ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Predicate  __pred 
)
inlineconstexpr

Remove elements from a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

All elements for which __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 867 of file stl_algo.h.

◆ replace()

template<typename _ForwardIterator , typename _Tp >
constexpr void std::replace ( _ForwardIterator  __first,
_ForwardIterator  __last,
const _Tp &  __old_value,
const _Tp &  __new_value 
)
constexpr

Replace each occurrence of one value in a sequence with another value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__old_valueThe value to be replaced.
__new_valueThe replacement value.
Returns
replace() returns no value.

For each iterator i in the range [__first,__last) if *i == __old_value then the assignment *i = __new_value is performed.

Definition at line 4323 of file stl_algo.h.

◆ replace_copy_if()

template<typename _InputIterator , typename _OutputIterator , typename _Predicate , typename _Tp >
constexpr _OutputIterator std::replace_copy_if ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_Predicate  __pred,
const _Tp &  __new_value 
)
inlineconstexpr

Copy a sequence, replacing each value for which a predicate returns true with another value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
__new_valueThe replacement value.
Returns
The end of the output sequence, __result+(__last-__first).

Copies each element in the range [__first,__last) to the range [__result,__result+(__last-__first)) replacing elements for which __pred returns true with __new_value.

Definition at line 3159 of file stl_algo.h.

◆ replace_if()

template<typename _ForwardIterator , typename _Predicate , typename _Tp >
constexpr void std::replace_if ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Predicate  __pred,
const _Tp &  __new_value 
)
constexpr

Replace each value in a sequence for which a predicate returns true with another value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate.
__new_valueThe replacement value.
Returns
replace_if() returns no value.

For each iterator i in the range [__first,__last) if __pred(*i) is true then the assignment *i = __new_value is performed.

Definition at line 4356 of file stl_algo.h.

◆ reverse()

template<typename _BidirectionalIterator >
constexpr void std::reverse ( _BidirectionalIterator  __first,
_BidirectionalIterator  __last 
)
inlineconstexpr

Reverse a sequence.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
Returns
reverse() returns no value.

Reverses the order of the elements in the range [__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 1128 of file stl_algo.h.

◆ reverse_copy()

template<typename _BidirectionalIterator , typename _OutputIterator >
constexpr _OutputIterator std::reverse_copy ( _BidirectionalIterator  __first,
_BidirectionalIterator  __last,
_OutputIterator  __result 
)
constexpr

Copy a sequence, reversing its elements.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies the elements in the range [__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)-1-i) = *(__first+i). The ranges [__first,__last) and [__result,__result+(__last-__first)) must not overlap.

Definition at line 1156 of file stl_algo.h.

◆ rotate()

template<typename _ForwardIterator >
constexpr _ForwardIterator std::_V2::rotate ( _ForwardIterator  __first,
_ForwardIterator  __middle,
_ForwardIterator  __last 
)
inlineconstexpr

Rotate the elements of a sequence.

Parameters
__firstA forward iterator.
__middleA forward iterator.
__lastA forward iterator.
Returns
first + (last - middle).

Rotates the elements of the range [__first,__last) by (__middle - __first) positions so that the element at __middle is moved to __first, the element at __middle+1 is moved to __first+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 1388 of file stl_algo.h.

◆ rotate_copy()

template<typename _ForwardIterator , typename _OutputIterator >
constexpr _OutputIterator std::rotate_copy ( _ForwardIterator  __first,
_ForwardIterator  __middle,
_ForwardIterator  __last,
_OutputIterator  __result 
)
inlineconstexpr

Copy a sequence, rotating its elements.

Parameters
__firstA forward iterator.
__middleA forward iterator.
__lastA forward iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies the elements of the range [__first,__last) to the range beginning at

Returns
, rotating the copied elements by (__middle-__first) positions so that the element at __middle is moved to __result, the element at __middle+1 is moved to __result+1 and so on for each element in the range [__first,__last).

Performs *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) for each n in the range [0,__last-__first).

Definition at line 1426 of file stl_algo.h.

◆ shuffle()

template<typename _RandomAccessIterator , typename _UniformRandomNumberGenerator >
void std::shuffle ( _RandomAccessIterator  __first,
_RandomAccessIterator  __last,
_UniformRandomNumberGenerator &&  __g 
)

Shuffle the elements of a sequence using a uniform random number generator.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__gA UniformRandomNumberGenerator (26.5.1.3).
Returns
Nothing.

Reorders the elements in the range [__first,__last) using __g to provide random numbers.

Definition at line 3696 of file stl_algo.h.

◆ stable_partition()

template<typename _ForwardIterator , typename _Predicate >
_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.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate functor.
Returns
An iterator 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).

Performs the same function as 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 1607 of file stl_algo.h.

◆ swap_ranges()

template<typename _ForwardIterator1 , typename _ForwardIterator2 >
constexpr _ForwardIterator2 std::swap_ranges ( _ForwardIterator1  __first1,
_ForwardIterator1  __last1,
_ForwardIterator2  __first2 
)
constexpr

Swap the elements of two sequences.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
Returns
An iterator equal to first2+(last1-first1).

Swaps each element in the range [first1,last1) with the corresponding element in the range [first2,(last1-first1)). The ranges must not overlap.

Definition at line 201 of file stl_algobase.h.

◆ transform() [1/2]

template<typename _InputIterator , typename _OutputIterator , typename _UnaryOperation >
constexpr _OutputIterator std::transform ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_UnaryOperation  __unary_op 
)
constexpr

Perform an operation on a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__unary_opA unary operator.
Returns
An output iterator equal to __result+(__last-__first).

Applies the operator to each element in the input range and assigns the results to successive elements of the output sequence. Evaluates *(__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 4252 of file stl_algo.h.

◆ transform() [2/2]

template<typename _InputIterator1 , typename _InputIterator2 , typename _OutputIterator , typename _BinaryOperation >
constexpr _OutputIterator std::transform ( _InputIterator1  __first1,
_InputIterator1  __last1,
_InputIterator2  __first2,
_OutputIterator  __result,
_BinaryOperation  __binary_op 
)
constexpr

Perform an operation on corresponding elements of two sequences.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__resultAn output iterator.
__binary_opA binary operator.
Returns
An output iterator equal to result+(last-first).

Applies the operator to the corresponding elements in the two input ranges and assigns the results to successive elements of the output sequence. Evaluates *(__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 4290 of file stl_algo.h.

◆ unique() [1/2]

template<typename _ForwardIterator >
constexpr _ForwardIterator std::unique ( _ForwardIterator  __first,
_ForwardIterator  __last 
)
inlineconstexpr

Remove consecutive duplicate values from a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
An iterator designating the end of the resulting sequence.

Removes all but the first element from each group of consecutive values that compare equal. 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 936 of file stl_algo.h.

◆ unique() [2/2]

template<typename _ForwardIterator , typename _BinaryPredicate >
constexpr _ForwardIterator std::unique ( _ForwardIterator  __first,
_ForwardIterator  __last,
_BinaryPredicate  __binary_pred 
)
inlineconstexpr

Remove consecutive values from a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__binary_predA binary predicate.
Returns
An iterator designating the end of the resulting sequence.

Removes all but the first element from each group of consecutive values for which __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 967 of file stl_algo.h.

◆ unique_copy() [1/2]

template<typename _InputIterator , typename _OutputIterator >
constexpr _OutputIterator std::unique_copy ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result 
)
inlineconstexpr

Copy a sequence, removing consecutive duplicate values.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__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 4461 of file stl_algo.h.

◆ unique_copy() [2/2]

template<typename _InputIterator , typename _OutputIterator , typename _BinaryPredicate >
constexpr _OutputIterator std::unique_copy ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_BinaryPredicate  __binary_pred 
)
inlineconstexpr

Copy a sequence, removing consecutive values using a predicate.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__binary_predA binary predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__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 4503 of file stl_algo.h.