aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-10-16 00:12:39 +0000
committerDan Gohman <gohman@apple.com>2008-10-16 00:12:39 +0000
commitf16ac7d41fa00ae7d7a3f694621c5c41ee3c697a (patch)
tree8c00d8fec134ebb5cfa331caa78aa272bbb1548e /include
parent995183622ed4a26abd74d0cdf18c7a1c34150ff8 (diff)
downloadexternal_llvm-f16ac7d41fa00ae7d7a3f694621c5c41ee3c697a.zip
external_llvm-f16ac7d41fa00ae7d7a3f694621c5c41ee3c697a.tar.gz
external_llvm-f16ac7d41fa00ae7d7a3f694621c5c41ee3c697a.tar.bz2
Fix several places that called mapped_iterator's constructor without
passing in a function object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/STLExtras.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h
index 5c5e4aa..e009939 100644
--- a/include/llvm/ADT/STLExtras.h
+++ b/include/llvm/ADT/STLExtras.h
@@ -73,6 +73,7 @@ public:
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 @@ public:
_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 @@ template <class _Iterator, class Func>
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());
}