summaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/iterator_range.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT/iterator_range.h')
-rw-r--r--include/llvm/ADT/iterator_range.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/iterator_range.h b/include/llvm/ADT/iterator_range.h
index 4f2f321..dd17d6c 100644
--- a/include/llvm/ADT/iterator_range.h
+++ b/include/llvm/ADT/iterator_range.h
@@ -40,6 +40,14 @@ public:
IteratorT begin() const { return begin_iterator; }
IteratorT end() const { return end_iterator; }
};
+
+/// \brief Convenience function for iterating over sub-ranges.
+///
+/// This provides a bit of syntactic sugar to make using sub-ranges
+/// in for loops a bit easier. Analogous to std::make_pair().
+template <class T> iterator_range<T> make_range(T x, T y) {
+ return iterator_range<T>(std::move(x), std::move(y));
+}
}
#endif