Debian Codegraph @

headers/algorithm

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15 #ifndef CPPREFERENCE_ALGORITHM_H
16 #define CPPREFERENCE_ALGORITHM_H
17
18 #if CPPREFERENCE_STDVER >= 2011
19 #include <initializer_list>
20 #endif
21
22 namespace std {
23
24 #if CPPREFERENCE_STDVER >= 2011
25 template<class InputIt, class UnaryPredicate>
26 bool all_of(InputIt first, InputIt last, UnaryPredicate p);
27
28 template<class InputIt, class UnaryPredicate>
29 bool any_of(InputIt first, InputIt last, UnaryPredicate p);
30
31 template<class InputIt, class UnaryPredicate>
32 bool none_of(InputIt first, InputIt last, UnaryPredicate p);
33 #endif
34
35 template<class InputIt, class UnaryFunction >
36 UnaryFunction for_each(InputIt first, InputIt last, UnaryFunction f);
37
38 template<class InputIt, class T >
39 typename iterator_traits<InputIt>::difference_type
40 count(InputIt first, InputIt last, const T& value);
41
42 template<class InputIt, class UnaryPredicate >
43 typename iterator_traits<InputIt>::difference_type
44 count_if(InputIt first, InputIt last, UnaryPredicate p);
45
46 template<class InputIt1, class InputIt2 >
47 std::pair<InputIt1, InputIt2>
48 mismatch(InputIt1 first1, InputIt1 last1,
49 InputIt2 first2);
50
51 template<class InputIt1, class InputIt2, class BinaryPredicate >
52 std::pair<InputIt1, InputIt2>
53 mismatch(InputIt1 first1, InputIt1 last1,
54 InputIt2 first2,
55 BinaryPredicate p);
56
57 #if CPPREFERENCE_STDVER >= 2014
58 template<class InputIt1, class InputIt2 >
59 std::pair<InputIt1, InputIt2>
60 mismatch(InputIt1 first1, InputIt1 last1,
61 InputIt2 first2, InputIt2 last2);
62
63 template<class InputIt1, class InputIt2, class BinaryPredicate >
64 std::pair<InputIt1, InputIt2>
65 mismatch(InputIt1 first1, InputIt1 last1,
66 InputIt2 first2, InputIt2 last2,
67 BinaryPredicate p);
68 #endif
69
70 template<class InputIt1, class InputIt2 >
71 bool equal(InputIt1 first1, InputIt1 last1,
72 InputIt2 first2);
73
74 template<class InputIt1, class InputIt2, class BinaryPredicate >
75 bool equal(InputIt1 first1, InputIt1 last1,
76 InputIt2 first2, BinaryPredicate p);
77
78 #if CPPREFERENCE_STDVER >= 2014
79 template<class InputIt1, class InputIt2 >
80 bool equal(InputIt1 first1, InputIt1 last1,
81 InputIt2 first2, InputIt2 last2);
82
83 template<class InputIt1, class InputIt2, class BinaryPredicate >
84 bool equal(InputIt1 first1, InputIt1 last1,
85 InputIt2 first2, InputIt2 last2,
86 BinaryPredicate p);
87 #endif
88
89 template<class InputIt, class T >
90 InputIt find(InputIt first, InputIt last, const T& value);
91
92 template<class InputIt, class UnaryPredicate >
93 InputIt find_if(InputIt first, InputIt last,
94 UnaryPredicate p);
95
96 #if CPPREFERENCE_STDVER >= 2011
97 template<class InputIt, class UnaryPredicate >
98 InputIt find_if_not(InputIt first, InputIt last,
99 UnaryPredicate q);
100 #endif
101
102 template<class ForwardIt1, class ForwardIt2 >
103 ForwardIt1 find_end(ForwardIt1 first, ForwardIt1 last,
104 ForwardIt2 s_first, ForwardIt2 s_last);
105
106 template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
107 ForwardIt1 find_end(ForwardIt1 first, ForwardIt1 last,
108 ForwardIt2 s_first, ForwardIt2 s_last, BinaryPredicate p);
109
110 #if CPPREFERENCE_STDVER >= 2011
111 template<class InputIt, class ForwardIt >
112 InputIt find_first_of(InputIt first, InputIt last,
113 ForwardIt s_first, ForwardIt s_last);
114
115 template<class InputIt, class ForwardIt, class BinaryPredicate >
116 InputIt find_first_of(InputIt first, InputIt last,
117 ForwardIt s_first, ForwardIt s_last, BinaryPredicate p);
118 #else
119 template<class ForwardIt1, class ForwardIt2 >
120 ForwardIt1 find_first_of(ForwardIt1 first, ForwardIt1 last,
121 ForwardIt2 s_first, ForwardIt2 s_last);
122
123 template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
124 ForwardIt1 find_first_of(ForwardIt1 first, ForwardIt1 last,
125 ForwardIt2 s_first, ForwardIt2 s_last, BinaryPredicate p);
126 #endif
127
128 template<class ForwardIt >
129 ForwardIt adjacent_find(ForwardIt first, ForwardIt last);
130
131 template<class ForwardIt, class BinaryPredicate>
132 ForwardIt adjacent_find(ForwardIt first, ForwardIt last, BinaryPredicate p);
133
134 template<class ForwardIt1, class ForwardIt2 >
135 ForwardIt1 search(ForwardIt1 first, ForwardIt1 last,
136 ForwardIt2 s_first, ForwardIt2 s_last);
137
138 template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
139 ForwardIt1 search(ForwardIt1 first, ForwardIt1 last,
140 ForwardIt2 s_first, ForwardIt2 s_last, BinaryPredicate p);
141
142 template<class ForwardIt, class Size, class T >
143 ForwardIt search_n(ForwardIt first, ForwardIt last, Size count, const T& value);
144
145 template<class ForwardIt, class Size, class T, class BinaryPredicate >
146 ForwardIt search_n(ForwardIt first, ForwardIt last, Size count, const T& value,
147 BinaryPredicate p);
148
149 template<class InputIt, class OutputIt >
150 OutputIt copy(InputIt first, InputIt last, OutputIt d_first);
151
152 #if CPPREFERENCE_STDVER >= 2011
153 template<class InputIt, class OutputIt, class UnaryPredicate >
154 OutputIt copy_if(InputIt first, InputIt last,
155 OutputIt d_first,
156 UnaryPredicate pred);
157 #endif
158
159 #if CPPREFERENCE_STDVER >= 2011
160 template<class InputIt, class Size, class OutputIt >
161 OutputIt copy_n(InputIt first, Size count, OutputIt result);
162 #endif
163
164 template<class BidirIt1, class BidirIt2 >
165 BidirIt2 copy_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last);
166
167 #if CPPREFERENCE_STDVER >= 2011
168 template<class InputIt, class OutputIt >
169 OutputIt move(InputIt first, InputIt last, OutputIt d_first);
170 #endif
171
172 #if CPPREFERENCE_STDVER >= 2011
173 template<class InputIt, class OutputIt >
174 OutputIt move(InputIt first, InputIt last, OutputIt d_first);
175 #endif
176
177 template<class ForwardIt, class T >
178 void fill(ForwardIt first, ForwardIt last, const T& value);
179
180 #if CPPREFERENCE_STDVER >= 2011
181 template<class OutputIt, class Size, class T >
182 OutputIt fill_n(OutputIt first, Size count, const T& value);
183 #else
184 template<class OutputIt, class Size, class T >
185 void fill_n(OutputIt first, Size count, const T& value);
186 #endif
187
188 template<class InputIt, class OutputIt, class UnaryOperation >
189 OutputIt transform(InputIt first1, InputIt last1, OutputIt d_first,
190 UnaryOperation unary_op);
191
192 template<class InputIt1, class InputIt2, class OutputIt, class BinaryOperation >
193 OutputIt transform(InputIt1 first1, InputIt1 last1, InputIt2 first2,
194 OutputIt d_first, BinaryOperation binary_op);
195
196 template<class ForwardIt, class Generator >
197 void generate(ForwardIt first, ForwardIt last, Generator g);
198
199 #if CPPREFERENCE_STDVER >= 2011
200 template<class OutputIt, class Size, class Generator >
201 OutputIt generate_n(OutputIt first, Size count, Generator g);
202 #else
203 template<class OutputIt, class Size, class Generator >
204 void generate_n(OutputIt first, Size count, Generator g);
205 #endif
206
207 template<class ForwardIt, class T >
208 ForwardIt remove(ForwardIt first, ForwardIt last, const T& value);
209
210 template<class ForwardIt, class UnaryPredicate >
211 ForwardIt remove_if(ForwardIt first, ForwardIt last, UnaryPredicate p);
212
213 template<class InputIt, class OutputIt, class T >
214 OutputIt remove_copy(InputIt first, InputIt last, OutputIt d_first,
215 const T& value);
216
217 template<class InputIt, class OutputIt, class UnaryPredicate >
218 OutputIt remove_copy_if(InputIt first, InputIt last, OutputIt d_first,
219 UnaryPredicate p);
220
221 template<class InputIt, class OutputIt, class UnaryPredicate >
222 OutputIt remove_copy_if(InputIt first, InputIt last, OutputIt d_first,
223 UnaryPredicate p);
224
225 template<class ForwardIt, class UnaryPredicate, class T >
226 void replace_if(ForwardIt first, ForwardIt last,
227 UnaryPredicate p, const T& new_value);
228
229 template<class InputIt, class OutputIt, class T >
230 OutputIt replace_copy(InputIt first, InputIt last, OutputIt d_first,
231 const T& old_value, const T& new_value);
232
233 template<class InputIt, class OutputIt, class UnaryPredicate, class T >
234 OutputIt replace_copy_if(InputIt first, InputIt last, OutputIt d_first,
235 UnaryPredicate p, const T& new_value);
236
237 // defined in <utility> in C++11
238 #if CPPREFERENCE_STDVER >= 2011
239 template<class T >
240 void swap(T& a, T& b);
241 #endif
242
243 template<class ForwardIt1, class ForwardIt2 >
244 ForwardIt2 swap_ranges(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2);
245
246 template<class ForwardIt1, class ForwardIt2 >
247 void iter_swap(ForwardIt1 a, ForwardIt2 b);
248
249 template<class BidirIt >
250 void reverse(BidirIt first, BidirIt last);
251
252 template<class BidirIt, class OutputIt >
253 OutputIt reverse_copy(BidirIt first, BidirIt last, OutputIt d_first);
254
255 #if CPPREFERENCE_STDVER >= 2011
256 template<class ForwardIt >
257 ForwardIt rotate(ForwardIt first, ForwardIt n_first, ForwardIt last);
258 #else
259 template<class ForwardIt >
260 void rotate(ForwardIt first, ForwardIt n_first, ForwardIt last);
261 #endif
262
263 template<class ForwardIt, class OutputIt >
264 OutputIt rotate_copy(ForwardIt first, ForwardIt n_first,
265 ForwardIt last, OutputIt d_first);
266
267 #if CPPREFERENCE_STDVER <2017
268 // deprecated in C++14
269 template<class RandomIt >
270 void random_shuffle(RandomIt first, RandomIt last);
271 #endif
272
273 #if CPPREFERENCE_STDVER <2011
274 template<class RandomIt, class RandomFunc >
275 void random_shuffle(RandomIt first, RandomIt last, RandomFunc&& r);
276 #elif CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2017
277 // deprecated in C++14
278 template<class RandomIt, class RandomFunc >
279 void random_shuffle(RandomIt first, RandomIt last, RandomFunc& r);
280 #endif
281
282 #if CPPREFERENCE_STDVER >= 2011
283 template<class RandomIt, class URNG >
284 void shuffle(RandomIt first, RandomIt last, URNG&& g);
285 #endif
286
287 template<class ForwardIt >
288 ForwardIt unique(ForwardIt first, ForwardIt last);
289
290 template<class ForwardIt, class BinaryPredicate >
291 ForwardIt unique(ForwardIt first, ForwardIt last, BinaryPredicate p);
292
293 template<class InputIt, class OutputIt >
294 OutputIt unique_copy(InputIt first, InputIt last,
295 OutputIt d_first);
296
297 template<class InputIt, class OutputIt, class BinaryPredicate >
298 OutputIt unique_copy(InputIt first, InputIt last,
299 OutputIt d_first, BinaryPredicate p);
300
301 #if CPPREFERENCE_STDVER >= 2011
302 template<class InputIt, class UnaryPredicate >
303 bool is_partitioned(InputIt first, InputIt last, UnaryPredicate p);
304 #endif
305
306 #if CPPREFERENCE_STDVER <2011
307 template<class BidirIt, class UnaryPredicate >
308 BidirIt partition(BidirIt first, BidirIt last, UnaryPredicate p);
309 #else
310 template<class ForwardIt, class UnaryPredicate >
311 ForwardIt partition(ForwardIt first, ForwardIt last, UnaryPredicate p);
312 #endif
313
314 #if CPPREFERENCE_STDVER >= 2011
315 template<class InputIt, class OutputIt1,
316 class OutputIt2, class UnaryPredicate >
317 std::pair<OutputIt1, OutputIt2>
318 partition_copy(InputIt first, InputIt last,
319 OutputIt1 d_first_true, OutputIt2 d_first_false,
320 UnaryPredicate p);
321 #endif
322
323 template<class BidirIt, class UnaryPredicate >
324 BidirIt stable_partition(BidirIt first, BidirIt last, UnaryPredicate p);
325
326 #if CPPREFERENCE_STDVER >= 2011
327 template<class ForwardIt, class UnaryPredicate >
328 ForwardIt partition_point(ForwardIt first, ForwardIt last, UnaryPredicate p);
329 #endif
330
331 #if CPPREFERENCE_STDVER >= 2011
332 template<class ForwardIt >
333 bool is_sorted(ForwardIt first, ForwardIt last);
334
335 template<class ForwardIt, class Compare >
336 bool is_sorted(ForwardIt first, ForwardIt last, Compare comp);
337
338 template<class ForwardIt >
339 ForwardIt is_sorted_until(ForwardIt first, ForwardIt last);
340
341 template<class ForwardIt, class Compare >
342 ForwardIt is_sorted_until(ForwardIt first, ForwardIt last,
343 Compare comp);
344 #endif
345
346 template<class RandomIt >
347 void sort(RandomIt first, RandomIt last);
348
349 template<class RandomIt, class Compare >
350 void sort(RandomIt first, RandomIt last, Compare comp);
351
352 template<class RandomIt >
353 void partial_sort(RandomIt first, RandomIt middle, RandomIt last);
354
355 template<class RandomIt, class Compare >
356 void partial_sort(RandomIt first, RandomIt middle, RandomIt last, Compare comp);
357
358 template<class InputIt, class RandomIt >
359 RandomIt partial_sort_copy(InputIt first, InputIt last,
360 RandomIt d_first, RandomIt d_last);
361
362 template<class InputIt, class RandomIt, class Compare >
363 RandomIt partial_sort_copy(InputIt first, InputIt last,
364 RandomIt d_first, RandomIt d_last,
365 Compare comp);
366
367 template<class RandomIt >
368 void stable_sort(RandomIt first, RandomIt last);
369
370 template<class RandomIt, class Compare >
371 void stable_sort(RandomIt first, RandomIt last, Compare comp);
372
373 template<class RandomIt >
374 void nth_element(RandomIt first, RandomIt nth, RandomIt last);
375
376 template<class RandomIt, class Compare >
377 void nth_element(RandomIt first, RandomIt nth, RandomIt last, Compare comp);
378
379 template<class ForwardIt, class T >
380 ForwardIt lower_bound(ForwardIt first, ForwardIt last, const T& value);
381
382 template<class ForwardIt, class T, class Compare >
383 ForwardIt lower_bound(ForwardIt first, ForwardIt last, const T& value, Compare comp);
384
385 template<class ForwardIt, class T >
386 ForwardIt upper_bound(ForwardIt first, ForwardIt last, const T& value);
387
388 template<class ForwardIt, class T, class Compare >
389 ForwardIt upper_bound(ForwardIt first, ForwardIt last, const T& value, Compare comp);
390
391 template<class ForwardIt, class T >
392 bool binary_search(ForwardIt first, ForwardIt last, const T& value);
393
394 template<class ForwardIt, class T, class Compare >
395 bool binary_search(ForwardIt first, ForwardIt last, const T& value, Compare comp);
396
397 template<class ForwardIt, class T >
398 std::pair<ForwardIt, ForwardIt>
399 equal_range(ForwardIt first, ForwardIt last,
400 const T& value);
401
402 template<class ForwardIt, class T, class Compare >
403 std::pair<ForwardIt, ForwardIt>
404 equal_range(ForwardIt first, ForwardIt last,
405 const T& value, Compare comp);
406
407 template<class InputIt1, class InputIt2, class OutputIt >
408 OutputIt merge(InputIt1 first1, InputIt1 last1,
409 InputIt2 first2, InputIt2 last2,
410 OutputIt d_first);
411
412 template<class InputIt1, class InputIt2, class OutputIt, class Compare>
413 OutputIt merge(InputIt1 first1, InputIt1 last1,
414 InputIt2 first2, InputIt2 last2,
415 OutputIt d_first, Compare comp);
416
417 template<class BidirIt >
418 void inplace_merge(BidirIt first, BidirIt middle, BidirIt last);
419
420 template<class BidirIt, class Compare>
421 void inplace_merge(BidirIt first, BidirIt middle, BidirIt last, Compare comp);
422
423 template<class InputIt1, class InputIt2 >
424 bool includes(InputIt1 first1, InputIt1 last1,
425 InputIt2 first2, InputIt2 last2);
426
427 template<class InputIt1, class InputIt2, class Compare >
428 bool includes(InputIt1 first1, InputIt1 last1,
429 InputIt2 first2, InputIt2 last2, Compare comp);
430
431 template<class InputIt1, class InputIt2, class OutputIt >
432 OutputIt set_difference(InputIt1 first1, InputIt1 last1,
433 InputIt2 first2, InputIt2 last2,
434 OutputIt d_first);
435
436 template<class InputIt1, class InputIt2,
437 class OutputIt, class Compare >
438 OutputIt set_difference(InputIt1 first1, InputIt1 last1,
439 InputIt2 first2, InputIt2 last2,
440 OutputIt d_first, Compare comp);
441
442 template<class InputIt1, class InputIt2, class OutputIt >
443 OutputIt set_intersection(InputIt1 first1, InputIt1 last1,
444 InputIt2 first2, InputIt2 last2,
445 OutputIt d_first);
446
447 template<class InputIt1, class InputIt2,
448 class OutputIt, class Compare >
449 OutputIt set_intersection(InputIt1 first1, InputIt1 last1,
450 InputIt2 first2, InputIt2 last2,
451 OutputIt d_first, Compare comp);
452
453 template<class InputIt1, class InputIt2, class OutputIt >
454 OutputIt set_symmetric_difference(InputIt1 first1, InputIt1 last1,
455 InputIt2 first2, InputIt2 last2,
456 OutputIt d_first);
457
458 template<class InputIt1, class InputIt2,
459 class OutputIt, class Compare >
460 OutputIt set_symmetric_difference(InputIt1 first1, InputIt1 last1,
461 InputIt2 first2, InputIt2 last2,
462 OutputIt d_first, Compare comp);
463
464 template<class InputIt1, class InputIt2, class OutputIt >
465 OutputIt set_union(InputIt1 first1, InputIt1 last1,
466 InputIt2 first2, InputIt2 last2,
467 OutputIt d_first);
468
469 template<class InputIt1, class InputIt2,
470 class OutputIt, class Compare >
471 OutputIt set_union(InputIt1 first1, InputIt1 last1,
472 InputIt2 first2, InputIt2 last2,
473 OutputIt d_first, Compare comp);
474
475 #if CPPREFERENCE_STDVER >= 2011
476 template<class RandomIt >
477 bool is_heap(RandomIt first, RandomIt last);
478
479 template<class RandomIt, class Compare >
480 bool is_heap(RandomIt first, RandomIt last, Compare comp);
481
482 template<class RandomIt >
483 RandomIt is_heap_until(RandomIt first, RandomIt last);
484
485 template<class RandomIt, class Compare >
486 RandomIt is_heap_until(RandomIt first, RandomIt last, Compare comp);
487 #endif
488
489 template<class RandomIt >
490 void make_heap(RandomIt first, RandomIt last);
491
492 template<class RandomIt, class Compare >
493 void make_heap(RandomIt first, RandomIt last,
494 Compare comp);
495
496 template<class RandomIt >
497 void push_heap(RandomIt first, RandomIt last);
498
499 template<class RandomIt, class Compare >
500 void push_heap(RandomIt first, RandomIt last,
501 Compare comp);
502
503 template<class RandomIt >
504 void pop_heap(RandomIt first, RandomIt last);
505
506 template<class RandomIt, class Compare >
507 void pop_heap(RandomIt first, RandomIt last, Compare comp);
508
509 template<class RandomIt >
510 void sort_heap(RandomIt first, RandomIt last);
511
512 template<class RandomIt, class Compare >
513 void sort_heap(RandomIt first, RandomIt last, Compare comp);
514
515 #if CPPREFERENCE_STDVER <2014
516 template<class T >
517 const T& max(const T& a, const T& b);
518
519 template<class T, class Compare >
520 const T& max(const T& a, const T& b, Compare comp);
521 #else
522 template<class T >
523 constexpr const T& max(const T& a, const T& b);
524
525 template<class T, class Compare >
526 constexpr const T& max(const T& a, const T& b, Compare comp);
527 #endif
528
529 #if CPPREFERENCE_STDVER >= 2011
530 template<class T >
531 T max(std::initializer_list<T> ilist);
532
533 template<class T, class Compare >
534 T max(std::initializer_list<T> ilist, Compare comp);
535 #elif CPPREFERENCE_STDVER >= 2014
536 template<class T >
537 constexpr T max(std::initializer_list<T> ilist);
538
539 template<class T, class Compare >
540 constexpr T max(std::initializer_list<T> ilist, Compare comp);
541 #endif
542
543 #if CPPREFERENCE_STDVER <2017
544 template<class ForwardIt >
545 ForwardIt max_element(ForwardIt first, ForwardIt last);
546
547 template<class ForwardIt, class Compare >
548 ForwardIt max_element(ForwardIt first, ForwardIt last, Compare cmp);
549 #else
550 template<class ForwardIt >
551 constexpr ForwardIt max_element(ForwardIt first, ForwardIt last);
552
553 template<class ForwardIt, class Compare >
554 constexpr ForwardIt max_element(ForwardIt first, ForwardIt last, Compare cmp);
555 #endif
556
557 #if CPPREFERENCE_STDVER <2014
558 template<class T >
559 const T& min(const T& a, const T& b);
560
561 template<class T, class Compare >
562 const T& min(const T& a, const T& b, Compare comp);
563 #else
564 template<class T >
565 constexpr const T& min(const T& a, const T& b);
566
567 template<class T, class Compare >
568 constexpr const T& min(const T& a, const T& b, Compare comp);
569 #endif
570
571 #if CPPREFERENCE_STDVER >= 2011
572 template<class T >
573 T min(std::initializer_list<T> ilist);
574
575 template<class T, class Compare >
576 T min(std::initializer_list<T> ilist, Compare comp);
577 #elif CPPREFERENCE_STDVER >= 2014
578 template<class T >
579 constexpr T min(std::initializer_list<T> ilist);
580
581 template<class T, class Compare >
582 constexpr T min(std::initializer_list<T> ilist, Compare comp);
583 #endif
584
585 #if CPPREFERENCE_STDVER <2017
586 template<class ForwardIt >
587 ForwardIt min_element(ForwardIt first, ForwardIt last);
588
589 template<class ForwardIt, class Compare >
590 ForwardIt min_element(ForwardIt first, ForwardIt last, Compare cmp);
591 #else
592 template<class ForwardIt >
593 constexpr ForwardIt min_element(ForwardIt first, ForwardIt last);
594
595 template<class ForwardIt, class Compare >
596 constexpr ForwardIt min_element(ForwardIt first, ForwardIt last, Compare cmp);
597 #endif
598
599 #if CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2014
600 template<class T >
601 std::pair<const T&, const T&> minmax(const T& a, const T& b);
602
603 template<class T, class Compare >
604 std::pair<const T&, const T&> minmax(const T& a, const T& b,
605 Compare comp);
606
607 template<class T >
608 std::pair<T, T> minmax(std::initializer_list<T> ilist);
609
610 template<class T, class Compare >
611 std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
612
613 #elif CPPREFERENCE_STDVER >= 2014
614 template<class T >
615 constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b);
616
617 template<class T, class Compare >
618 constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b,
619 Compare comp);
620 template<class T >
621 constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist);
622
623 template<class T, class Compare >
624 constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
625 #endif
626
627 #if CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2017
628 template<class ForwardIt >
629 std::pair<ForwardIt, ForwardIt>
630 minmax_element(ForwardIt first, ForwardIt last);
631
632 template<class ForwardIt, class Compare >
633 std::pair<ForwardIt, ForwardIt>
634 minmax_element(ForwardIt first, ForwardIt last, Compare comp);
635 #elif CPPREFERENCE_STDVER >= 2017
636 template<class ForwardIt >
637 constexpr std::pair<ForwardIt, ForwardIt>
638 minmax_element(ForwardIt first, ForwardIt last);
639
640 template<class ForwardIt, class Compare >
641 constexpr std::pair<ForwardIt, ForwardIt>
642 minmax_element(ForwardIt first, ForwardIt last, Compare comp);
643 #endif
644
645 template<class InputIt1, class InputIt2 >
646 bool lexicographical_compare(InputIt1 first1, InputIt1 last1,
647 InputIt2 first2, InputIt2 last2);
648
649 template<class InputIt1, class InputIt2, class Compare >
650 bool lexicographical_compare(InputIt1 first1, InputIt1 last1,
651 InputIt2 first2, InputIt2 last2,
652 Compare comp);
653
654 #if CPPREFERENCE_STDVER >= 2011
655 template<class ForwardIt1, class ForwardIt2 >
656 bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
657 ForwardIt2 first2);
658
659 template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
660 bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
661 ForwardIt2 first2, BinaryPredicate p);
662 #endif
663
664 #if CPPREFERENCE_STDVER >= 2011
665 template<class ForwardIt1, class ForwardIt2 >
666 bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
667 ForwardIt2 first2, ForwardIt2 last2);
668
669 template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
670 bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
671 ForwardIt2 first2, ForwardIt2 last2,
672 BinaryPredicate p);
673 #endif
674
675 template<class BidirIt >
676 bool next_permutation(BidirIt first, BidirIt last);
677
678 template<class BidirIt, class Compare >
679 bool next_permutation(BidirIt first, BidirIt last, Compare comp);
680
681 template<class BidirIt >
682 bool prev_permutation(BidirIt first, BidirIt last);
683
684 template<class BidirIt, class Compare >
685 bool prev_permutation(BidirIt first, BidirIt last, Compare comp);
686
687 } // namespace std
688
689 #endif // CPPREFERENCE_ALGORITHM_H