[ox/std] Make operator[] in Array and Vector nodiscard
This commit is contained in:
parent
a7af6c6660
commit
3ae1d6c897
4
deps/ox/src/ox/std/array.hpp
vendored
4
deps/ox/src/ox/std/array.hpp
vendored
@ -41,7 +41,7 @@ class Array {
|
|||||||
|
|
||||||
constexpr Array(Array &&other) noexcept;
|
constexpr Array(Array &&other) noexcept;
|
||||||
|
|
||||||
~Array() = default;
|
constexpr ~Array() = default;
|
||||||
|
|
||||||
constexpr iterator<> begin() noexcept {
|
constexpr iterator<> begin() noexcept {
|
||||||
return iterator<>(&m_items[0], 0, ArraySize);
|
return iterator<>(&m_items[0], 0, ArraySize);
|
||||||
@ -81,8 +81,10 @@ class Array {
|
|||||||
|
|
||||||
constexpr Array &operator=(Array &&other) noexcept;
|
constexpr Array &operator=(Array &&other) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr T &operator[](std::size_t i) noexcept;
|
constexpr T &operator[](std::size_t i) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr const T &operator[](std::size_t i) const noexcept;
|
constexpr const T &operator[](std::size_t i) const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
2
deps/ox/src/ox/std/vector.hpp
vendored
2
deps/ox/src/ox/std/vector.hpp
vendored
@ -222,8 +222,10 @@ class Vector: detail::VectorAllocator<T, Allocator, SmallVectorSize> {
|
|||||||
|
|
||||||
constexpr Vector &operator=(Vector &&other) noexcept;
|
constexpr Vector &operator=(Vector &&other) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr T &operator[](std::size_t i) noexcept;
|
constexpr T &operator[](std::size_t i) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr const T &operator[](std::size_t i) const noexcept;
|
constexpr const T &operator[](std::size_t i) const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
Loading…
Reference in New Issue
Block a user