This commit is contained in:
parent
f128664a81
commit
09c57545bc
22
deps/ox/src/ox/std/vector.hpp
vendored
22
deps/ox/src/ox/std/vector.hpp
vendored
@ -221,6 +221,12 @@ class Vector: detail::VectorAllocator<T, Allocator, SmallVectorSize> {
|
|||||||
|
|
||||||
constexpr const T &operator[](std::size_t i) const noexcept;
|
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]]
|
[[nodiscard]]
|
||||||
constexpr Result<T*> front() noexcept;
|
constexpr Result<T*> front() noexcept;
|
||||||
|
|
||||||
@ -416,6 +422,22 @@ constexpr const T &Vector<T, SmallVectorSize, Allocator>::operator[](std::size_t
|
|||||||
return m_items[i];
|
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>
|
template<typename T, std::size_t SmallVectorSize, typename Allocator>
|
||||||
constexpr Result<T*> Vector<T, SmallVectorSize, Allocator>::front() noexcept {
|
constexpr Result<T*> Vector<T, SmallVectorSize, Allocator>::front() noexcept {
|
||||||
if (!m_size) {
|
if (!m_size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user