Most Used C++ STL Algorithms
Here is a list of most used C++ STL algorithms by myself. All of them have reference links to www.cplusplus.com
- count (InputIterator first, InputIterator last, const T& val)
- count_if (InputIterator first, InputIterator last, UnaryPredicate pred)
- bool all_of (InputIterator first, InputIterator last, UnaryPredicate pred)
- bool none_of (InputIterator first, InputIterator last, UnaryPredicate pred)
- bool any_of (InputIterator first, InputIterator last, UnaryPredicate pred)
- InputIterator find (InputIterator first, InputIterator last, const T& val)
- InputIterator find_if (InputIterator first, InputIterator last, UnaryPredicate pred)
- InputIterator find_if_not (InputIterator first, InputIterator last, UnaryPredicate pred)
- InputIterator find_first_of (InputIterator first1, InputIterator last1, ForwardIterator first2, ForwardIterator last2, BinaryPredicate pred)
- ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred)
- ForwardIterator1 find_end (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred)
- ForwardIterator search_n ( ForwardIterator first, ForwardIterator last, Size count, const T& val, BinaryPredicate pred )
- ForwardIterator adjacent_find (ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
- void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
- void stable_sort ( RandomAccessIterator first, RandomAccessIterator last, Compare comp )
- bool is_sorted (ForwardIterator first, ForwardIterator last, Compare comp)
- ForwardIterator max_element (ForwardIterator first, ForwardIterator last, Compare comp)
- ForwardIterator min_element (ForwardIterator first, ForwardIterator last, Compare comp)
- ForwardIterator upper_bound (ForwardIterator first, ForwardIterator last, const T& val, Compare comp)
- ForwardIterator lower_bound (ForwardIterator first, ForwardIterator last, const T& val, Compare comp)
- void shuffle (RandomAccessIterator first, RandomAccessIterator last, URNG&& g) random_device rd; mt19937 g(rd());
- void partial_sort (RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp)
- ForwardIterator is_sorted_until (ForwardIterator first, ForwardIterator last, Compare comp)
- partial_sort_copy (InputIterator first,InputIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp)
- void nth_element (RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp)
- bool equal (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred)
- mismatch (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred)
- T accumulate (InputIterator first, InputIterator last, T init, BinaryOperation binary_op)
- Function for_each (InputIterator first, InputIterator last, Function fn)
- OutputIterator copy (InputIterator first, InputIterator last, OutputIterator result)
- OutputIterator copy_if (InputIterator first, InputIterator last, OutputIterator result, UnaryPredicate pred)
- OutputIterator copy_n (InputIterator first, Size n, OutputIterator result)
- BidirectionalIterator2 copy_backward (BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result)
- BidirectionalIterator2 move_backward (BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result)
- ForwardIterator remove (ForwardIterator first, ForwardIterator last, const T& val)
- ForwardIterator remove_if (ForwardIterator first, ForwardIterator last, UnaryPredicate pred)
- void fill (ForwardIterator first, ForwardIterator last, const T& val)
- OutputIterator fill_n (OutputIterator first, Size n, const T& val)
- void iota (ForwardIterator first, ForwardIterator last, T val)
- void generate (ForwardIterator first, ForwardIterator last, Generator gen)
- OutputIterator generate_n (OutputIterator first, Size n, Generator gen)
- void replace (ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value)
- void replace_if (ForwardIterator first, ForwardIterator last, UnaryPredicate pred, const T& new_value )
- OutputIterator replace_copy_if (InputIterator first, InputIterator last, OutputIterator result, UnaryPredicate pred, const T& new_value)
- OutputIterator transform (InputIterator first1, InputIterator last1, OutputIterator result, UnaryOperation op)
- ForwardIterator unique (ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
- OutputIterator unique_copy (InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred)
- void reverse (BidirectionalIterator first, BidirectionalIterator last)
- void iter_swap (ForwardIterator1 a, ForwardIterator2 b)
- OutputIterator reverse_copy (BidirectionalIterator first, BidirectionalIterator last, OutputIterator result)
- back_insert_iterator
back_inserter (Container& x) - front_insert_iterator
front_inserter (Container& x) - void swap (T& a, T& b)
- ForwardIterator2 swap_ranges (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2)
- ForwardIterator rotate (ForwardIterator first, ForwardIterator middle, ForwardIterator last)
- ForwardIterator partition (ForwardIterator first, ForwardIterator last, UnaryPredicate pred)
- BidirectionalIterator stable_partition (BidirectionalIterator first, BidirectionalIterator last, UnaryPredicate pred)
- OutputIterator merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
- void inplace_merge (BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp)
- bool binary_search (ForwardIterator first, ForwardIterator last, const T& val, Compare comp)