[llvm] r244620 - Add non-member begin and end so that drop_begin works on iterator_range.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 09:12:56 PDT 2015


Author: rafael
Date: Tue Aug 11 11:12:56 2015
New Revision: 244620

URL: http://llvm.org/viewvc/llvm-project?rev=244620&view=rev
Log:
Add non-member begin and end so that drop_begin works on iterator_range.

Modified:
    llvm/trunk/include/llvm/ADT/iterator_range.h

Modified: llvm/trunk/include/llvm/ADT/iterator_range.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator_range.h?rev=244620&r1=244619&r2=244620&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/iterator_range.h (original)
+++ llvm/trunk/include/llvm/ADT/iterator_range.h Tue Aug 11 11:12:56 2015
@@ -47,6 +47,16 @@ public:
   IteratorT end() const { return end_iterator; }
 };
 
+template <typename IteratorT>
+IteratorT begin(const iterator_range<IteratorT> &R) {
+  return R.begin();
+}
+
+template <typename IteratorT>
+IteratorT end(const iterator_range<IteratorT> &R) {
+  return R.end();
+}
+
 /// \brief Convenience function for iterating over sub-ranges.
 ///
 /// This provides a bit of syntactic sugar to make using sub-ranges




More information about the llvm-commits mailing list