Squashed 'deps/nostalgia/' changes from f128664a..b75bbc4d

b75bbc4d [olympic,nostalgia] Change order of oxModelFieldRename args
227dd68a [ox/model] Change order of oxModelFieldRename args
02db760b [olympic] Add more ImGui helpers, studio::Editor::pushCommand
09c57545 [ox/std] Add Vector::at

git-subtree-dir: deps/nostalgia
git-subtree-split: b75bbc4d200c0f4187f5c4068ba686dad34820cd
This commit is contained in:
2024-01-28 18:05:09 -06:00
parent db978290f3
commit cfc27a384b
9 changed files with 156 additions and 9 deletions

View File

@@ -221,6 +221,12 @@ class Vector: detail::VectorAllocator<T, Allocator, SmallVectorSize> {
constexpr const T &operator[](std::size_t i) const noexcept;
[[nodiscard]]
constexpr Result<T*> at(size_t i) noexcept;
[[nodiscard]]
constexpr Result<T const*> at(size_t i) const noexcept;
[[nodiscard]]
constexpr Result<T*> front() noexcept;
@@ -416,6 +422,22 @@ constexpr const T &Vector<T, SmallVectorSize, Allocator>::operator[](std::size_t
return m_items[i];
}
template<typename T, std::size_t SmallVectorSize, typename Allocator>
constexpr Result<T*> Vector<T, SmallVectorSize, Allocator>::at(size_t i) noexcept {
if (i < size()) {
return &operator[](i);
}
return OxError(1, "Vector: Invalid index");
}
template<typename T, std::size_t SmallVectorSize, typename Allocator>
constexpr Result<T const*> Vector<T, SmallVectorSize, Allocator>::at(size_t i) const noexcept {
if (i < size()) {
return &operator[](i);
}
return OxError(1, "Vector: Invalid index");
}
template<typename T, std::size_t SmallVectorSize, typename Allocator>
constexpr Result<T*> Vector<T, SmallVectorSize, Allocator>::front() noexcept {
if (!m_size) {