CPP facilitates a number of functions that can be applied on a range of elements. Some of these are:
Binary search
| FUNCTION | USES |
| binary_search | To test if the values in the range exists in a sorted sequence or not. |
| equal_range | To get the subrange for the equal elements. |
| lower_bound | To get the lower bound element of the range. |
| upper_bound | To get the upper bound element of the range. |
Heap
| FUNCTION | USES |
| is_heap | To check whether the range is a heap. |
| is_heap_until | To check the position till which a range is a heap. |
| make_heap | To create a heap. |
| pop_heap | To pop new elements in the heap. |
| push_heap | To push new elements in the heap. |
| sort_heap | To sort the heap. |
Merge
| FUNCTION | USES |
| includes | To check whether the sorted range includes another range or not. |
| inplace_merge | To merge two consecutive ranges that are sorted. |
| merge | To merge two ranges that are in a sorted order. |
| set_union | To get the union of two ranges that is sorted. |
| set_intersection | To get the intersection of two ranges that is sorted. |
| set_difference | To get the difference of two ranges that is sorted. |
| set_symmetric_difference | To get the symmetric difference of two ranges that is sorted. |
Min/Max
| FUNCTION | USES |
| min | To get the smallest element of the range. |
| max | To get the largest element of the range. |
| minmax | To get the smallest and largest element of the range. |
| min_element | To get the smallest element of the range. |
| max_element | To get the largest element of the range. |
| minmax_element | To get the smallest and largest element of the range. |
Modifying sequence operations:
| FUNCTION | USES |
| copy | To copy the range of elements. |
| copy_n | To copy n elements of the range. |
| copy_if | To copy the elements of the range if a certain condition is fulfilled. |
| copy_backward | To copy the elements in a backward order. |
| fill | To fill the values in the range with a value. |
| fill_n | To fill the values in the sequence. |
| generate | To generate the values of the range. |
| generate_n | To generate the values of the sequence. |
| iter_swap | To swap the values of two iterators under reference. |
| move | To move the ranges of elements. |
| move_backward | To move the range of elements in the backward order. |
| replace | To replace the values in the range with a specific value. |
| replace_if | To replace the value of the range if a certain condition is fulfilled. |
| replace_copy | To copy the range of values by replacing with an element. |
| replace_copy_if | To copy the range of values by replacing with an element if a certain condition is fulfilled. |
| remove_copy | To copy the values of the range by removing them. |
| remove_copy_if | To copy the values of the range by removing them if a condition is fulfilled. |
| reverse | To reverse the range. |
| reverse_copy | To copy the range by reversing values. |
| rotate | To rotate the elements of the range in left direction. |
| rotate_copy | To copy the elements of the range which is rotated left. |
| random_shuffle | To shuffle the range randomly. |
| remove_if | To remove the values of the range if a condition is fulfilled. |
| remove | To remove the values from the range. |
| shuffle | To shuffle the range randomly with the help of a generator. |
| swap | To swap the value of two objects. |
| swap_ranges | To swap the value of two ranges. |
| transform | To transform all the values in a range. |
| unique_copy | To copy the unique elements of the range. |
| unique | To identify the unique element of the range. |
Non-modifying sequence operations:
| FUNCTION | USES |
| all_of | To test a condition to all the elements of the range. |
| any_of | To test a condition to some or any of the elements of the range. |
| adjacent_find | To make a search for finding the equal and adjacent elements in a range. |
| count | To get the count of a value in the range. |
| count_if | To get the count of values that satisfies a condition. |
| equal | To check if the two ranges have all elements equal. |
| find_if | To find an element in the range. |
| find_if_not | To find an element in the range but in the opposite way as the above one. |
| find_end | To get the last element of the range. |
| find_first_of | The find for the element that satisfies a condition and occurs at the first. |
| for_each | To apply an operation to all the elements of the range. |
| find | To find a value in the range. |
| is_permutation | To check whether the range in reference is a permutation of some other range. |
| mismatch
|
To get the value in sequence which is the first mismatch. |
| none_of | To check if none of the elements follow the condition or not. |
| search | To search for the subsequence in a range. |
| search_n | To search the range for the occurrence of an element. |
Partitions
| FUNCTION | USES |
| is_partitioned | To deduce whether the range is partitioned or not. |
| partition | To partition the range. |
| partition_copy | To copy the range after partition. |
| partition_point | To return the partition point for a range. |
| stable_partition | To partition the range in two stable halves. |
Sorting
| FUNCTION | USES |
| is_sorted | To check whether the range is sorted or not. |
| is_sorted_until | To check till which element a range is sorted. |
| nth_element | To sort the elements in the range. |
| partial_sort_copy | To copy the elements of the range after sorting it. |
| partial_sort | To partially sort the elements of the range. |
| stable_sort | To sort the elements in the range maintaining the relative equivalent order. |
| sort | To sort all the elements in a range. |