| 1 |
// -*- c++ -*- |
| 2 |
// From CD2, Dec 96 |
| 3 |
|
| 4 |
Header <algorithm> synopsis |
| 5 |
|
| 6 |
// Fwd: forward iterator |
| 7 |
// Inp: input iterator |
| 8 |
|
| 9 |
// subclause _lib.alg.nonmodifying_, non-modifying sequence operations: |
| 10 |
template<class InputIterator, class Function, class T, class Predicate> |
| 11 |
|
| 12 |
Function for_each(Inp first, Inp last, Function f); |
| 13 |
Inp find(Inp first, Inp last, const T& value); |
| 14 |
Inp find_if(Inp first, Inp last, Predicate pred); |
| 15 |
Fwd1 find_end(Fwd1 first1, Fwd1 last1, Fwd2 first2, Fwd2 last2); |
| 16 |
Fwd1 find_end(Fwd1 first1, Fwd1 last1, Fwd2 first2, Fwd2 last2, BinaryPredicate pred); |
| 17 |
Fwd1 find_first_of(Fwd1 first1, Fwd1 last1, Fwd2 first2, Fwd2 last2); |
| 18 |
Fwd1 find_first_of(Fwd1 first1, Fwd1 last1, Fwd2 first2, Fwd2 last2, BinaryPredicate pred); |
| 19 |
Fwd adjacent_find(Fwd first, Fwd last); |
| 20 |
Fwd adjacent_find(Fwd first, Fwd last, BinaryPredicate pred); |
| 21 |
|
| 22 |
difference_type count(Inp first, Inp last, const T& value); |
| 23 |
difference_type count_if(Inp first, Inp last, Predicate pred); |
| 24 |
pair<Inp1, Inp2> mismatch(Inp1 first1, Inp1 last1, Inp2 first2); |
| 25 |
pair<Inp1, Inp2> mismatch(Inp1 first1, Inp1 last1, Inp2 first2, BinaryPredicate pred); |
| 26 |
bool equal(Inp1 first1, Inp1 last1, Inp2 first2); |
| 27 |
bool equal(Inp1 first1, Inp1 last1, Inp2 first2, BinaryPredicate pred); |
| 28 |
|
| 29 |
Fwd1 search(Fwd1 first1, Fwd1 last1, Fwd2 first2, Fwd2 last2); |
| 30 |
Fwd1 search(Fwd1 first1, Fwd1 last1, Fwd2 first2, Fwd2 last2, BinaryPredicate pred); |
| 31 |
Fwd search_n(Fwd first, Fwd last, Size count, const T& value); |
| 32 |
Fwd1 search_n(Fwd first, Fwd last, Size count, const T& value, BinaryPredicate pred); |
| 33 |
|
| 34 |
// subclause _lib.alg.modifying.operations_, modifying sequence operations: |
| 35 |
// _lib.alg.copy_, copy: |
| 36 |
template<class Inp, class OutputIterator> |
| 37 |
OutputIterator copy(Inp first, Inp last, OutputIterator result); |
| 38 |
template<class BidirectionalIterator1, class BidirectionalIterator2> |
| 39 |
BidirectionalIterator2 |
| 40 |
copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result); |
| 41 |
// _lib.alg.swap_, swap: |
| 42 |
template<class T> void swap(T& a, T& b); |
| 43 |
template<class Fwd1, class Fwd2> |
| 44 |
Fwd2 swap_ranges(Fwd1 first1, Fwd1 last1, Fwd2 first2); |
| 45 |
template<class Fwd1, class Fwd2> |
| 46 |
void iter_swap(Fwd1 a, Fwd2 b); |
| 47 |
template<class Inp, class OutputIterator, class UnaryOperation> |
| 48 |
OutputIterator transform(Inp first, Inp last, OutputIterator result, UnaryOperation op); |
| 49 |
template<class Inp1, class Inp2, class OutputIterator, class BinaryOperation> |
| 50 |
OutputIterator transform(Inp1 first1, Inp1 last1, Inp2 first2, OutputIterator result, BinaryOperation binary_op); |
| 51 |
template<class Fwd, class T> |
| 52 |
void replace(Fwd first, Fwd last, const T& old_value, const T& new_value); |
| 53 |
template<class Fwd, class Predicate, class T> |
| 54 |
void replace_if(Fwd first, Fwd last, Predicate pred, const T& new_value); |
| 55 |
template<class Inp, class OutputIterator, class T> |
| 56 |
OutputIterator replace_copy(Inp first, Inp last, OutputIterator result, const T& old_value, const T& new_value); |
| 57 |
template<class Iterator, class OutputIterator, class Predicate, class T> |
| 58 |
OutputIterator replace_copy_if(Iterator first, Iterator last, OutputIterator result, Predicate pred, const T& new_value); |
| 59 |
|
| 60 |
template<class Fwd, class T> |
| 61 |
void fill(Fwd first, Fwd last, const T& value); |
| 62 |
template<class OutputIterator, class Size, class T> |
| 63 |
void fill_n(OutputIterator first, Size n, const T& value); |
| 64 |
template<class Fwd, class Generator> |
| 65 |
void generate(Fwd first, Fwd last, Generator gen); |
| 66 |
template<class OutputIterator, class Size, class Generator> |
| 67 |
void generate_n(OutputIterator first, Size n, Generator gen); |
| 68 |
template<class Fwd, class T> |
| 69 |
Fwd remove(Fwd first, Fwd last, const T& value); |
| 70 |
template<class Fwd, class Predicate> |
| 71 |
Fwd remove_if(Fwd first, Fwd last, Predicate pred); |
| 72 |
template<class Inp, class OutputIterator, class T> |
| 73 |
OutputIterator remove_copy(Inp first, Inp last, OutputIterator result, const T& value); |
| 74 |
template<class Inp, class OutputIterator, class Predicate> |
| 75 |
OutputIterator remove_copy_if(Inp first, Inp last, OutputIterator result, Predicate pred); |
| 76 |
template<class Fwd> |
| 77 |
Fwd unique(Fwd first, Fwd last); |
| 78 |
template<class Fwd, class BinaryPredicate> |
| 79 |
Fwd unique(Fwd first, Fwd last, BinaryPredicate pred); |
| 80 |
template<class Inp, class OutputIterator> |
| 81 |
OutputIterator unique_copy(Inp first, Inp last, OutputIterator result); |
| 82 |
template<class Inp, class OutputIterator, class BinaryPredicate> |
| 83 |
OutputIterator unique_copy(Inp first, Inp last, OutputIterator result, BinaryPredicate pred); |
| 84 |
template<class BidirectionalIterator> |
| 85 |
void reverse(BidirectionalIterator first, BidirectionalIterator last); |
| 86 |
template<class BidirectionalIterator, class OutputIterator> |
| 87 |
OutputIterator reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); |
| 88 |
template<class Fwd> |
| 89 |
void rotate(Fwd first, Fwd middle, Fwd last); |
| 90 |
template<class Fwd, class OutputIterator> |
| 91 |
OutputIterator rotate_copy(Fwd first, Fwd middle, Fwd last, OutputIterator result); |
| 92 |
template<class RandomAccessIterator> |
| 93 |
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last); |
| 94 |
template<class RandomAccessIterator, class RandomNumberGenerator> |
| 95 |
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator& rand); |
| 96 |
|
| 97 |
// _lib.alg.partitions_, partitions: |
| 98 |
template<class BidirectionalIterator, class Predicate> |
| 99 |
BidirectionalIterator partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred); |
| 100 |
template<class BidirectionalIterator, class Predicate> |
| 101 |
BidirectionalIterator stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred); |
| 102 |
// subclause _lib.alg.sorting_, sorting and related operations: |
| 103 |
// _lib.alg.sort_, sorting: |
| 104 |
template<class RandomAccessIterator> |
| 105 |
void sort(RandomAccessIterator first, RandomAccessIterator last); |
| 106 |
template<class RandomAccessIterator, class Compare> |
| 107 |
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 108 |
template<class RandomAccessIterator> |
| 109 |
void stable_sort(RandomAccessIterator first, RandomAccessIterator last); |
| 110 |
template<class RandomAccessIterator, class Compare> |
| 111 |
void stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 112 |
template<class RandomAccessIterator> |
| 113 |
void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); |
| 114 |
template<class RandomAccessIterator, class Compare> |
| 115 |
void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); |
| 116 |
template<class Inp, class RandomAccessIterator> |
| 117 |
RandomAccessIterator |
| 118 |
partial_sort_copy(Inp first, Inp last, RandomAccessIterator result_first, RandomAccessIterator result_last); |
| 119 |
template<class Inp, class RandomAccessIterator, class Compare> |
| 120 |
RandomAccessIterator |
| 121 |
partial_sort_copy(Inp first, Inp last, RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); |
| 122 |
template<class RandomAccessIterator> |
| 123 |
void nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); |
| 124 |
template<class RandomAccessIterator, class Compare> |
| 125 |
void nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); |
| 126 |
// _lib.alg.binary.search_, binary search: |
| 127 |
template<class Fwd, class T> |
| 128 |
Fwd lower_bound(Fwd first, Fwd last, const T& value); |
| 129 |
template<class Fwd, class T, class Compare> |
| 130 |
Fwd lower_bound(Fwd first, Fwd last, const T& value, Compare comp); |
| 131 |
|
| 132 |
template<class Fwd, class T> |
| 133 |
Fwd upper_bound(Fwd first, Fwd last, const T& value); |
| 134 |
template<class Fwd, class T, class Compare> |
| 135 |
Fwd upper_bound(Fwd first, Fwd last, const T& value, Compare comp); |
| 136 |
template<class Fwd, class T> |
| 137 |
pair<Fwd, Fwd> |
| 138 |
equal_range(Fwd first, Fwd last, const T& value); |
| 139 |
template<class Fwd, class T, class Compare> |
| 140 |
pair<Fwd, Fwd> |
| 141 |
equal_range(Fwd first, Fwd last, const T& value, Compare comp); |
| 142 |
template<class Fwd, class T> |
| 143 |
bool binary_search(Fwd first, Fwd last, const T& value); |
| 144 |
template<class Fwd, class T, class Compare> |
| 145 |
bool binary_search(Fwd first, Fwd last, const T& value, Compare comp); |
| 146 |
// _lib.alg.merge_, merge: |
| 147 |
template<class Inp1, class Inp2, class OutputIterator> |
| 148 |
OutputIterator merge(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result); |
| 149 |
template<class Inp1, class Inp2, class OutputIterator, class Compare> |
| 150 |
OutputIterator merge(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result, Compare comp); |
| 151 |
template<class BidirectionalIterator> |
| 152 |
void inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); |
| 153 |
template<class BidirectionalIterator, class Compare> |
| 154 |
void inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); |
| 155 |
// _lib.alg.set.operations_, set operations: |
| 156 |
template<class Inp1, class Inp2> |
| 157 |
bool includes(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2); |
| 158 |
template<class Inp1, class Inp2, class Compare> |
| 159 |
bool includes(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, Compare comp); |
| 160 |
template<class Inp1, class Inp2, class OutputIterator> |
| 161 |
OutputIterator set_union(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result); |
| 162 |
template<class Inp1, class Inp2, class OutputIterator, class Compare> |
| 163 |
OutputIterator set_union(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result, Compare comp); |
| 164 |
|
| 165 |
template<class Inp1, class Inp2, class OutputIterator> |
| 166 |
OutputIterator set_intersection(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result); |
| 167 |
template<class Inp1, class Inp2, class OutputIterator, class Compare> |
| 168 |
OutputIterator set_intersection(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result, Compare comp); |
| 169 |
template<class Inp1, class Inp2, class OutputIterator> |
| 170 |
OutputIterator set_difference(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result); |
| 171 |
template<class Inp1, class Inp2, class OutputIterator, class Compare> |
| 172 |
OutputIterator set_difference(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result, Compare comp); |
| 173 |
template<class Inp1, class Inp2, class OutputIterator> |
| 174 |
OutputIterator |
| 175 |
set_symmetric_difference(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result); |
| 176 |
template<class Inp1, class Inp2, class OutputIterator, class Compare> |
| 177 |
OutputIterator |
| 178 |
set_symmetric_difference(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, OutputIterator result, Compare comp); |
| 179 |
// _lib.alg.heap.operations_, heap operations: |
| 180 |
template<class RandomAccessIterator> |
| 181 |
void push_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 182 |
template<class RandomAccessIterator, class Compare> |
| 183 |
void push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 184 |
template<class RandomAccessIterator> |
| 185 |
void pop_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 186 |
template<class RandomAccessIterator, class Compare> |
| 187 |
void pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 188 |
template<class RandomAccessIterator> |
| 189 |
void make_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 190 |
template<class RandomAccessIterator, class Compare> |
| 191 |
void make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 192 |
template<class RandomAccessIterator> |
| 193 |
void sort_heap(RandomAccessIterator first, RandomAccessIterator last); |
| 194 |
template<class RandomAccessIterator, class Compare> |
| 195 |
void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); |
| 196 |
|
| 197 |
// _lib.alg.min.max_, minimum and maximum: |
| 198 |
template<class T> const T& min(const T& a, const T& b); |
| 199 |
template<class T, class Compare> |
| 200 |
const T& min(const T& a, const T& b, Compare comp); |
| 201 |
template<class T> const T& max(const T& a, const T& b); |
| 202 |
template<class T, class Compare> |
| 203 |
const T& max(const T& a, const T& b, Compare comp); |
| 204 |
template<class Fwd> |
| 205 |
Fwd min_element(Fwd first, Fwd last); |
| 206 |
template<class Fwd, class Compare> |
| 207 |
Fwd min_element(Fwd first, Fwd last, Compare comp); |
| 208 |
template<class Fwd> |
| 209 |
Fwd max_element(Fwd first, Fwd last); |
| 210 |
template<class Fwd, class Compare> |
| 211 |
Fwd max_element(Fwd first, Fwd last, Compare comp); |
| 212 |
template<class Inp1, class Inp2> |
| 213 |
bool lexicographical_compare(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2); |
| 214 |
template<class Inp1, class Inp2, class Compare> |
| 215 |
bool lexicographical_compare(Inp1 first1, Inp1 last1, Inp2 first2, Inp2 last2, Compare comp); |
| 216 |
// _lib.alg.permutation.generators_, permutations |
| 217 |
template<class BidirectionalIterator> |
| 218 |
bool next_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 219 |
template<class BidirectionalIterator, class Compare> |
| 220 |
bool next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |
| 221 |
template<class BidirectionalIterator> |
| 222 |
bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last); |
| 223 |
template<class BidirectionalIterator, class Compare> |
| 224 |
bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); |