[llvm-commits] [llvm] r57615 - /llvm/trunk/include/llvm/ADT/STLExtras.h
Dan Gohman
gohman at apple.com
Wed Oct 15 17:12:40 PDT 2008
Author: djg
Date: Wed Oct 15 19:12:39 2008
New Revision: 57615
URL: http://llvm.org/viewvc/llvm-project?rev=57615&view=rev
Log:
Fix several places that called mapped_iterator's constructor without
passing in a function object.
Modified:
llvm/trunk/include/llvm/ADT/STLExtras.h
Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=57615&r1=57614&r2=57615&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Wed Oct 15 19:12:39 2008
@@ -73,6 +73,7 @@
typedef mapped_iterator<RootIt, UnaryFunc> _Self;
inline const RootIt &getCurrent() const { return current; }
+ inline const UnaryFunc &getFunc() const { return Fn; }
inline explicit mapped_iterator(const RootIt &I, UnaryFunc F)
: current(I), Fn(F) {}
@@ -87,9 +88,13 @@
_Self& operator--() { --current; return *this; }
_Self operator++(int) { _Self __tmp = *this; ++current; return __tmp; }
_Self operator--(int) { _Self __tmp = *this; --current; return __tmp; }
- _Self operator+ (difference_type n) const { return _Self(current + n); }
+ _Self operator+ (difference_type n) const {
+ return _Self(current + n, Fn);
+ }
_Self& operator+= (difference_type n) { current += n; return *this; }
- _Self operator- (difference_type n) const { return _Self(current - n); }
+ _Self operator- (difference_type n) const {
+ return _Self(current - n, Fn);
+ }
_Self& operator-= (difference_type n) { current -= n; return *this; }
reference operator[](difference_type n) const { return *(*this + n); }
@@ -106,7 +111,7 @@
inline mapped_iterator<_Iterator, Func>
operator+(typename mapped_iterator<_Iterator, Func>::difference_type N,
const mapped_iterator<_Iterator, Func>& X) {
- return mapped_iterator<_Iterator, Func>(X.getCurrent() - N);
+ return mapped_iterator<_Iterator, Func>(X.getCurrent() - N, X.getFunc());
}
More information about the llvm-commits
mailing list