[ox/std] Make operator[] in Array and Vector nodiscard

This commit is contained in:
Gary Talent 2024-09-14 23:37:07 -05:00
parent a7af6c6660
commit 3ae1d6c897
2 changed files with 5 additions and 1 deletions

View File

@ -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]]

View File

@ -222,8 +222,10 @@ class Vector: detail::VectorAllocator<T, Allocator, SmallVectorSize> {
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]]