always_inline a few methods

This commit is contained in:
Maxime Coste 2015-05-14 19:05:41 +01:00
parent 8ba6804480
commit e9af3a4217
2 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,8 @@ public:
constexpr T* pointer() const { return m_pointer; } constexpr T* pointer() const { return m_pointer; }
constexpr size_t size() const { return m_size; } constexpr size_t size() const { return m_size; }
[[gnu::always_inline]]
constexpr T& operator[](size_t n) const { return *(m_pointer + n); } constexpr T& operator[](size_t n) const { return *(m_pointer + n); }
constexpr T* begin() const { return m_pointer; } constexpr T* begin() const { return m_pointer; }

View File

@ -18,7 +18,9 @@ struct MirroredArray : public ArrayView<T>
(*this)[i] = 0; (*this)[i] = 0;
} }
[[gnu::always_inline]]
T& operator[](int n) { return ArrayView<T>::operator[](n + size); } T& operator[](int n) { return ArrayView<T>::operator[](n + size); }
[[gnu::always_inline]]
const T& operator[](int n) const { return ArrayView<T>::operator[](n + size); } const T& operator[](int n) const { return ArrayView<T>::operator[](n + size); }
private: private:
int size; int size;