|
1 | 1 | // -*- C++ -*-
|
2 | 2 | //===-------------------------- algorithm ---------------------------------===//
|
3 | 3 | //
|
4 |
| -// The LLVM Compiler Infrastructure |
5 |
| -// |
6 |
| -// This file is dual licensed under the MIT and the University of Illinois Open |
7 |
| -// Source Licenses. See LICENSE.TXT for details. |
| 4 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | +// See https://llvm.org/LICENSE.txt for license information. |
| 6 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
8 | 7 | //
|
9 | 8 | //===----------------------------------------------------------------------===//
|
10 | 9 |
|
| 10 | +#include <__config> |
11 | 11 | #include <initializer_list>
|
12 | 12 | #include <iterator>
|
13 | 13 |
|
@@ -495,59 +495,77 @@ RandomAccessIterator is_heap_until(RandomAccessIterator first,
|
495 | 495 | RandomAccessIterator last, Compare comp);
|
496 | 496 |
|
497 | 497 | template <class ForwardIterator>
|
498 |
| -ForwardIterator min_element(ForwardIterator first, ForwardIterator last); |
| 498 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator min_element(ForwardIterator first, |
| 499 | + ForwardIterator last); |
499 | 500 |
|
500 | 501 | template <class ForwardIterator, class Compare>
|
501 |
| -ForwardIterator min_element(ForwardIterator first, ForwardIterator last, |
502 |
| - Compare comp); |
| 502 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator min_element(ForwardIterator first, |
| 503 | + ForwardIterator last, |
| 504 | + Compare comp); |
503 | 505 |
|
504 |
| -template <class T> const T &min(const T &a, const T &b); |
| 506 | +template <class T> |
| 507 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &min(const T &a, const T &b); |
505 | 508 |
|
506 | 509 | template <class T, class Compare>
|
507 |
| -const T &min(const T &a, const T &b, Compare comp); |
| 510 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &min(const T &a, const T &b, |
| 511 | + Compare comp); |
508 | 512 |
|
509 |
| -template <class T> T min(initializer_list<T> t); |
| 513 | +template <class T> _LIBCPP_CONSTEXPR_AFTER_CXX11 T min(initializer_list<T> t); |
510 | 514 |
|
511 |
| -template <class T, class Compare> T min(initializer_list<T> t, Compare comp); |
| 515 | +template <class T, class Compare> |
| 516 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 T min(initializer_list<T> t, Compare comp); |
512 | 517 |
|
513 |
| -template <class T> const T &clamp(const T &v, const T &lo, const T &hi); |
| 518 | +#if _LIBCPP_STD_VER > 14 |
| 519 | +template <class T> |
| 520 | +const T constexpr &clamp(const T &v, const T &lo, const T &hi); |
514 | 521 |
|
515 | 522 | template <class T, class Compare>
|
516 |
| -const T &clamp(const T &v, const T &lo, const T &hi, Compare comp); |
| 523 | +const T constexpr &clamp(const T &v, const T &lo, const T &hi, Compare comp); |
| 524 | +#endif |
517 | 525 |
|
518 | 526 | template <class ForwardIterator>
|
519 |
| -ForwardIterator max_element(ForwardIterator first, ForwardIterator last); |
| 527 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator max_element(ForwardIterator first, |
| 528 | + ForwardIterator last); |
520 | 529 |
|
521 | 530 | template <class ForwardIterator, class Compare>
|
522 |
| -ForwardIterator max_element(ForwardIterator first, ForwardIterator last, |
523 |
| - Compare comp); |
| 531 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 ForwardIterator max_element(ForwardIterator first, |
| 532 | + ForwardIterator last, |
| 533 | + Compare comp); |
524 | 534 |
|
525 |
| -template <class T> const T &max(const T &a, const T &b); |
| 535 | +template <class T> |
| 536 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &max(const T &a, const T &b); |
526 | 537 |
|
527 | 538 | template <class T, class Compare>
|
528 |
| -const T &max(const T &a, const T &b, Compare comp); |
| 539 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 const T &max(const T &a, const T &b, |
| 540 | + Compare comp); |
529 | 541 |
|
530 |
| -template <class T> T max(initializer_list<T> t); |
| 542 | +template <class T> _LIBCPP_CONSTEXPR_AFTER_CXX11 T max(initializer_list<T> t); |
531 | 543 |
|
532 |
| -template <class T, class Compare> T max(initializer_list<T> t, Compare comp); |
| 544 | +template <class T, class Compare> |
| 545 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 T max(initializer_list<T> t, Compare comp); |
533 | 546 |
|
534 | 547 | template <class ForwardIterator>
|
535 |
| -pair<ForwardIterator, ForwardIterator> minmax_element(ForwardIterator first, |
536 |
| - ForwardIterator last); |
| 548 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<ForwardIterator, ForwardIterator> |
| 549 | +minmax_element(ForwardIterator first, ForwardIterator last); |
537 | 550 |
|
538 | 551 | template <class ForwardIterator, class Compare>
|
539 |
| -pair<ForwardIterator, ForwardIterator> |
| 552 | +pair<ForwardIterator, ForwardIterator> _LIBCPP_CONSTEXPR_AFTER_CXX11 |
540 | 553 | minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
|
541 | 554 |
|
542 |
| -template <class T> pair<const T &, const T &> minmax(const T &a, const T &b); |
| 555 | +template <class T> |
| 556 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<const T &, const T &> minmax(const T &a, |
| 557 | + const T &b); |
543 | 558 |
|
544 | 559 | template <class T, class Compare>
|
545 |
| -pair<const T &, const T &> minmax(const T &a, const T &b, Compare comp); |
| 560 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<const T &, const T &> |
| 561 | +minmax(const T &a, const T &b, Compare comp); |
546 | 562 |
|
547 |
| -template <class T> pair<T, T> minmax(initializer_list<T> t); |
| 563 | +template <class T> |
| 564 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<T, T> minmax(initializer_list<T> t); |
548 | 565 |
|
549 | 566 | template <class T, class Compare>
|
550 |
| -pair<T, T> minmax(initializer_list<T> t, Compare comp); |
| 567 | +_LIBCPP_CONSTEXPR_AFTER_CXX11 pair<T, T> minmax(initializer_list<T> t, |
| 568 | + Compare comp); |
551 | 569 |
|
552 | 570 | template <class InputIterator1, class InputIterator2>
|
553 | 571 | bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
|
0 commit comments