Address some comments
Change-Id: I0262304cc720a0e93015955d0a7fb05dfebe213e
diff --git a/runtime/stride_iterator.h b/runtime/stride_iterator.h
index c69f30e..a9da51b 100644
--- a/runtime/stride_iterator.h
+++ b/runtime/stride_iterator.h
@@ -31,7 +31,7 @@
StrideIterator(T* ptr, size_t stride)
: ptr_(reinterpret_cast<uintptr_t>(ptr)),
- stride_(reinterpret_cast<uintptr_t>(stride)) {}
+ stride_(stride) {}
bool operator==(const StrideIterator& other) const {
DCHECK_EQ(stride_, other.stride_);
@@ -48,17 +48,22 @@
}
StrideIterator operator++(int) {
- auto temp = *this;
+ StrideIterator<T> temp = *this;
ptr_ += stride_;
return temp;
}
StrideIterator operator+(ssize_t delta) const {
- auto temp = *this;
- temp.ptr_ += static_cast<ssize_t>(stride_) * delta;
+ StrideIterator<T> temp = *this;
+ temp += delta;
return temp;
}
+ StrideIterator& operator+=(ssize_t delta) {
+ ptr_ += static_cast<ssize_t>(stride_) * delta;
+ return *this;
+ }
+
T& operator*() const {
return *reinterpret_cast<T*>(ptr_);
}