diff options
| author | Alina Sbirlea <asbirlea@google.com> | 2018-08-23 18:46:48 +0000 |
|---|---|---|
| committer | Alina Sbirlea <asbirlea@google.com> | 2018-08-23 18:46:48 +0000 |
| commit | 61d76eceed541410225a1863df3feffafbaa6fe6 (patch) | |
| tree | d31f28db25524f7bf67eb820ed5c46c1fcbcf67c | |
| parent | 0f70bc05b34be5792c5e831366639e3f8bd26f19 (diff) | |
| download | bcm5719-llvm-61d76eceed541410225a1863df3feffafbaa6fe6.tar.gz bcm5719-llvm-61d76eceed541410225a1863df3feffafbaa6fe6.zip | |
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
llvm-svn: 340567
| -rw-r--r-- | llvm/include/llvm/ADT/STLExtras.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 3d6d7a6d2a8..35f4c4e5af3 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -677,18 +677,20 @@ class concat_iterator /// Note that something like iterator_range seems nice at first here, but the /// range properties are of little benefit and end up getting in the way /// because we need to do mutation on the current iterators. - std::tuple<std::pair<IterTs, IterTs>...> IterPairs; + std::tuple<IterTs...> Begins; + std::tuple<IterTs...> Ends; /// Attempts to increment a specific iterator. /// /// Returns true if it was able to increment the iterator. Returns false if /// the iterator is already at the end iterator. template <size_t Index> bool incrementHelper() { - auto &IterPair = std::get<Index>(IterPairs); - if (IterPair.first == IterPair.second) + auto &Begin = std::get<Index>(Begins); + auto &End = std::get<Index>(Ends); + if (Begin == End) return false; - ++IterPair.first; + ++Begin; return true; } @@ -712,11 +714,12 @@ class concat_iterator /// dereferences the iterator and returns the address of the resulting /// reference. template <size_t Index> ValueT *getHelper() const { - auto &IterPair = std::get<Index>(IterPairs); - if (IterPair.first == IterPair.second) + auto &Begin = std::get<Index>(Begins); + auto &End = std::get<Index>(Ends); + if (Begin == End) return nullptr; - return &*IterPair.first; + return &*Begin; } /// Finds the first non-end iterator, dereferences, and returns the resulting @@ -743,7 +746,7 @@ public: /// iterators. template <typename... RangeTs> explicit concat_iterator(RangeTs &&... Ranges) - : IterPairs({std::begin(Ranges), std::end(Ranges)}...) {} + : Begins(std::begin(Ranges)...), Ends(std::end(Ranges)...) {} using BaseT::operator++; @@ -755,7 +758,7 @@ public: ValueT &operator*() const { return get(index_sequence_for<IterTs...>()); } bool operator==(const concat_iterator &RHS) const { - return IterPairs == RHS.IterPairs; + return Begins == RHS.Begins && Ends == RHS.Ends; } }; |

