Modifying
Overview
Modifying Algorithms change the value of elements. They may modify the elements of a range directly or modify them while they are being copied into another range.Section Pages
copy
Copies a range starting with the first element
copy n
Copies a specified number of elements
copy backward
Copies a range starting with the last element
swap
Exchanges the values of the elements between two types of objects
iter swap
Swap values of objects pointed by two iterators
swap ranges
Swaps elements of two ranges
transform
Modifies (and copies) elements; combines elements of two ranges
replace
Replaces elements that have a special value with another value
replace if
Replaces elements that match a criterion with another value
replace copy
Replaces elements that have a special value while copying the whole range
replace copy if
Replaces elements that match a criterion while copying the whole range
fill
Replaces each element with a given value
fill n
Replaces n elements with a given value
generate
Replaces each element with the result of an operation
generate n
Replaces n elements with the result of an operation
remove
Removes elements with a given value
remove if
Removes elements that match a given criterion
remove copy
Copies elements that do not match a given value
remove copy if
Copies elements that do not match a given criterion
unique
Removes adjacent duplicates (elements that are equal to their predecessor)
unique copy
Copies elements while removing adjacent duplicates
reverse
Reverses the order of the elements
reverse copy
Copies the elements while reversing their order
rotate
Rotates the order of the elements
rotate copy
Copies the elements while rotating their order
random shuffle
Brings the elements into a random order
partition
Changes the order of the elements so that elements that match a criterion are at the front
stable partition
Same as partition(), but preserves the relative order of matching and nonmatching elements