Skip to content

Commit 9120723

Browse files
ashvardanianab-10
andcommitted
Fix: Missing const qualifiers in strided_ptr
Co-authored-by: Armin Stepanyan <[email protected]>
1 parent 4d00aba commit 9120723

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

less_slow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,8 +2628,8 @@ class strided_ptr {
26282628
strided_ptr operator--(int) noexcept { strided_ptr temp = *this; --(*this); return temp; }
26292629
strided_ptr &operator+=(difference_type offset) noexcept { data_ += offset * stride_; return *this; }
26302630
strided_ptr &operator-=(difference_type offset) noexcept { data_ -= offset * stride_; return *this; }
2631-
strided_ptr operator+(difference_type offset) noexcept { strided_ptr temp = *this; return temp += offset; }
2632-
strided_ptr operator-(difference_type offset) noexcept { strided_ptr temp = *this; return temp -= offset; }
2631+
strided_ptr operator+(difference_type offset) const noexcept { strided_ptr temp = *this; return temp += offset; }
2632+
strided_ptr operator-(difference_type offset) const noexcept { strided_ptr temp = *this; return temp -= offset; }
26332633
friend difference_type operator-(strided_ptr const &a, strided_ptr const &b) noexcept { assert(a.stride_ == b.stride_); return (a.data_ - b.data_) / static_cast<difference_type>(a.stride_); }
26342634
friend bool operator==(strided_ptr const &a, strided_ptr const &b) noexcept { return a.data_ == b.data_; }
26352635
friend bool operator<(strided_ptr const &a, strided_ptr const &b) noexcept { return a.data_ < b.data_; }

0 commit comments

Comments
 (0)