llvm.org GIT mirror llvm / 780d32e
Remove the use of pair inside the tuple in concat_iterator. Summary: Remove the use of pair inside the tuple in concat_iterator, and create separate begins and ends tuples instead. This fixes the failure for llvm <= 3.7 and libstd++ that broke the hexagon build. Reviewers: timshen Subscribers: sanjoy, jlebar, dexonsmith, kparzysz, llvm-commits Differential Revision: https://reviews.llvm.org/D51067 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340567 91177308-0d34-0410-b5e6-96231b3b80d8 Alina Sbirlea 2 years ago
1 changed file(s) with 12 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
676676 /// Note that something like iterator_range seems nice at first here, but the
677677 /// range properties are of little benefit and end up getting in the way
678678 /// because we need to do mutation on the current iterators.
679 std::tuple<std::pair...> IterPairs;
679 std::tuple<IterTs...> Begins;
680 std::tuple Ends;
680681
681682 /// Attempts to increment a specific iterator.
682683 ///
683684 /// Returns true if it was able to increment the iterator. Returns false if
684685 /// the iterator is already at the end iterator.
685686 template bool incrementHelper() {
686 auto &IterPair = std::get(IterPairs);
687 if (IterPair.first == IterPair.second)
687 auto &Begin = std::get(Begins);
688 auto &End = std::get(Ends);
689 if (Begin == End)
688690 return false;
689691
690 ++IterPair.first;
692 ++Begin;
691693 return true;
692694 }
693695
711713 /// dereferences the iterator and returns the address of the resulting
712714 /// reference.
713715 template ValueT *getHelper() const {
714 auto &IterPair = std::get(IterPairs);
715 if (IterPair.first == IterPair.second)
716 auto &Begin = std::get(Begins);
717 auto &End = std::get(Ends);
718 if (Begin == End)
716719 return nullptr;
717720
718 return &*IterPair.first;
721 return &*Begin;
719722 }
720723
721724 /// Finds the first non-end iterator, dereferences, and returns the resulting
742745 /// iterators.
743746 template
744747 explicit concat_iterator(RangeTs &&... Ranges)
745 : IterPairs({std::begin(Ranges), std::end(Ranges)}...) {}
748 : Begins(std::begin(Ranges)...), Ends(std::end(Ranges)...) {}
746749
747750 using BaseT::operator++;
748751
754757 ValueT &operator*() const { return get(index_sequence_for()); }
755758
756759 bool operator==(const concat_iterator &RHS) const {
757 return IterPairs == RHS.IterPairs;
760 return Begins == RHS.Begins && Ends == RHS.Ends;
758761 }
759762 };
760763