A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/commit/f51ee632475654a396f93da9d36841989e1c7742 below:

Make next/prev/advance/distance operations on iterators be constexpr.… · llvm/llvm-project@f51ee63 · GitHub

@@ -64,14 +64,23 @@ struct forward_iterator_tag : public input_iterator_tag {};

64 64

struct bidirectional_iterator_tag : public forward_iterator_tag {};

65 65

struct random_access_iterator_tag : public bidirectional_iterator_tag {};

66 66 67 +

// 27.4.3, iterator operations

67 68

// extension: second argument not conforming to C++03

68 -

template <class InputIterator>

69 -

void advance(InputIterator& i,

69 +

template <class InputIterator> // constexpr in C++17

70 +

constexpr void advance(InputIterator& i,

70 71

typename iterator_traits<InputIterator>::difference_type n);

71 72 72 -

template <class InputIterator>

73 -

typename iterator_traits<InputIterator>::difference_type

74 -

distance(InputIterator first, InputIterator last);

73 +

template <class InputIterator> // constexpr in C++17

74 +

constexpr typename iterator_traits<InputIterator>::difference_type

75 +

distance(InputIterator first, InputIterator last);

76 + 77 +

template <class InputIterator> // constexpr in C++17

78 +

constexpr InputIterator next(InputIterator x,

79 +

typename iterator_traits<InputIterator>::difference_type n = 1);

80 + 81 +

template <class BidirectionalIterator> // constexpr in C++17

82 +

constexpr BidirectionalIterator prev(BidirectionalIterator x,

83 +

typename iterator_traits<BidirectionalIterator>::difference_type n = 1);

75 84 76 85

template <class Iterator>

77 86

class reverse_iterator

@@ -529,7 +538,7 @@ struct _LIBCPP_TEMPLATE_VIS iterator

529 538

};

530 539 531 540

template <class _InputIter>

532 -

inline _LIBCPP_INLINE_VISIBILITY

541 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

533 542

void __advance(_InputIter& __i,

534 543

typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag)

535 544

{

@@ -538,7 +547,7 @@ void __advance(_InputIter& __i,

538 547

}

539 548 540 549

template <class _BiDirIter>

541 -

inline _LIBCPP_INLINE_VISIBILITY

550 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

542 551

void __advance(_BiDirIter& __i,

543 552

typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag)

544 553

{

@@ -551,23 +560,23 @@ void __advance(_BiDirIter& __i,

551 560

}

552 561 553 562

template <class _RandIter>

554 -

inline _LIBCPP_INLINE_VISIBILITY

563 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

555 564

void __advance(_RandIter& __i,

556 565

typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag)

557 566

{

558 567

__i += __n;

559 568

}

560 569 561 570

template <class _InputIter>

562 -

inline _LIBCPP_INLINE_VISIBILITY

571 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

563 572

void advance(_InputIter& __i,

564 573

typename iterator_traits<_InputIter>::difference_type __n)

565 574

{

566 575

__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());

567 576

}

568 577 569 578

template <class _InputIter>

570 -

inline _LIBCPP_INLINE_VISIBILITY

579 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

571 580

typename iterator_traits<_InputIter>::difference_type

572 581

__distance(_InputIter __first, _InputIter __last, input_iterator_tag)

573 582

{

@@ -578,23 +587,23 @@ __distance(_InputIter __first, _InputIter __last, input_iterator_tag)

578 587

}

579 588 580 589

template <class _RandIter>

581 -

inline _LIBCPP_INLINE_VISIBILITY

590 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

582 591

typename iterator_traits<_RandIter>::difference_type

583 592

__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag)

584 593

{

585 594

return __last - __first;

586 595

}

587 596 588 597

template <class _InputIter>

589 -

inline _LIBCPP_INLINE_VISIBILITY

598 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

590 599

typename iterator_traits<_InputIter>::difference_type

591 600

distance(_InputIter __first, _InputIter __last)

592 601

{

593 602

return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());

594 603

}

595 604 596 605

template <class _InputIter>

597 -

inline _LIBCPP_INLINE_VISIBILITY

606 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

598 607

_InputIter

599 608

next(_InputIter __x,

600 609

typename iterator_traits<_InputIter>::difference_type __n = 1,

@@ -605,7 +614,7 @@ next(_InputIter __x,

605 614

}

606 615 607 616

template <class _BidiretionalIter>

608 -

inline _LIBCPP_INLINE_VISIBILITY

617 +

inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

609 618

_BidiretionalIter

610 619

prev(_BidiretionalIter __x,

611 620

typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4