Bug 1277740 - Add const to RangedPtr<T>::operator+ and operator-. r=Waldo
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 03 Jun 2016 12:16:33 +0800
changeset 341544 c918e224f9d1a826e2d2ebe002ad3b6bf0d81564
parent 341543 f457175b1c4fe381a05c1fbde3776199b37b0250
child 341545 82bf2f128bfbc05c495e6fb77ecf287bf41a8458
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1277740
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277740 - Add const to RangedPtr<T>::operator+ and operator-. r=Waldo MozReview-Commit-ID: FlHmq5eh5ph
mfbt/RangedPtr.h
--- a/mfbt/RangedPtr.h
+++ b/mfbt/RangedPtr.h
@@ -131,24 +131,24 @@ public:
   {
     MOZ_ASSERT(mRangeStart == aOther.mRangeStart);
     MOZ_ASSERT(mRangeEnd == aOther.mRangeEnd);
     mPtr = aOther.mPtr;
     checkSanity();
     return *this;
   }
 
-  RangedPtr<T> operator+(size_t aInc)
+  RangedPtr<T> operator+(size_t aInc) const
   {
     MOZ_ASSERT(aInc <= size_t(-1) / sizeof(T));
     MOZ_ASSERT(asUintptr() + aInc * sizeof(T) >= asUintptr());
     return create(mPtr + aInc);
   }
 
-  RangedPtr<T> operator-(size_t aDec)
+  RangedPtr<T> operator-(size_t aDec) const
   {
     MOZ_ASSERT(aDec <= size_t(-1) / sizeof(T));
     MOZ_ASSERT(asUintptr() - aDec * sizeof(T) <= asUintptr());
     return create(mPtr - aDec);
   }
 
   /*
    * You can assign a raw pointer into a RangedPtr if the raw pointer is