diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGfx/VectorN.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/VectorN.h b/Userland/Libraries/LibGfx/VectorN.h index a06d7019c6..758f6e9d8e 100644 --- a/Userland/Libraries/LibGfx/VectorN.h +++ b/Userland/Libraries/LibGfx/VectorN.h @@ -58,7 +58,13 @@ public: constexpr void set_z(T value) requires(N >= 3) { m_data[2] = value; } constexpr void set_w(T value) requires(N >= 4) { m_data[3] = value; } - [[nodiscard]] constexpr T operator[](size_t index) const + [[nodiscard]] constexpr T const& operator[](size_t index) const + { + VERIFY(index < N); + return m_data[index]; + } + + [[nodiscard]] constexpr T& operator[](size_t index) { VERIFY(index < N); return m_data[index]; |