diff --git a/src/array_view.hh b/src/array_view.hh index 922cd99a8..33ae8979f 100644 --- a/src/array_view.hh +++ b/src/array_view.hh @@ -44,6 +44,8 @@ public: constexpr T* pointer() const { return m_pointer; } constexpr size_t size() const { return m_size; } + + [[gnu::always_inline]] constexpr T& operator[](size_t n) const { return *(m_pointer + n); } constexpr T* begin() const { return m_pointer; } diff --git a/src/diff.hh b/src/diff.hh index e68ec10c4..da1328e23 100644 --- a/src/diff.hh +++ b/src/diff.hh @@ -18,7 +18,9 @@ struct MirroredArray : public ArrayView (*this)[i] = 0; } + [[gnu::always_inline]] T& operator[](int n) { return ArrayView::operator[](n + size); } + [[gnu::always_inline]] const T& operator[](int n) const { return ArrayView::operator[](n + size); } private: int size;