[llvm] r196768 - ADT: Implement MutableArrayRef::reverse_iterator
David Majnemer
david.majnemer at gmail.com
Mon Dec 9 01:04:00 PST 2013
Author: majnemer
Date: Mon Dec 9 03:04:00 2013
New Revision: 196768
URL: http://llvm.org/viewvc/llvm-project?rev=196768&view=rev
Log:
ADT: Implement MutableArrayRef::reverse_iterator
This adds rbegin/rend methods to MutableArrayRef, they will be used by a
follow-on commit in clang.
Modified:
llvm/trunk/include/llvm/ADT/ArrayRef.h
Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=196768&r1=196767&r2=196768&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ArrayRef.h (original)
+++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Dec 9 03:04:00 2013
@@ -185,6 +185,8 @@ namespace llvm {
public:
typedef T *iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+
/// Construct an empty MutableArrayRef.
/*implicit*/ MutableArrayRef() : ArrayRef<T>() {}
@@ -219,6 +221,9 @@ namespace llvm {
iterator begin() const { return data(); }
iterator end() const { return data() + this->size(); }
+ reverse_iterator rbegin() const { return reverse_iterator(end()); }
+ reverse_iterator rend() const { return reverse_iterator(begin()); }
+
/// front - Get the first element.
T &front() const {
assert(!this->empty());
More information about the llvm-commits
mailing list