From 3ae1d6c89795fe993a7fcae88ef5065373483793 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 14 Sep 2024 23:37:07 -0500 Subject: [PATCH] [ox/std] Make operator[] in Array and Vector nodiscard --- deps/ox/src/ox/std/array.hpp | 4 +++- deps/ox/src/ox/std/vector.hpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/std/array.hpp b/deps/ox/src/ox/std/array.hpp index 242010f1..18926ecf 100644 --- a/deps/ox/src/ox/std/array.hpp +++ b/deps/ox/src/ox/std/array.hpp @@ -41,7 +41,7 @@ class Array { constexpr Array(Array &&other) noexcept; - ~Array() = default; + constexpr ~Array() = default; constexpr iterator<> begin() noexcept { return iterator<>(&m_items[0], 0, ArraySize); @@ -81,8 +81,10 @@ class Array { constexpr Array &operator=(Array &&other) noexcept; + [[nodiscard]] constexpr T &operator[](std::size_t i) noexcept; + [[nodiscard]] constexpr const T &operator[](std::size_t i) const noexcept; [[nodiscard]] diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index a3f763de..8035dfb7 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -222,8 +222,10 @@ class Vector: detail::VectorAllocator { constexpr Vector &operator=(Vector &&other) noexcept; + [[nodiscard]] constexpr T &operator[](std::size_t i) noexcept; + [[nodiscard]] constexpr const T &operator[](std::size_t i) const noexcept; [[nodiscard]]