[ox/std] Make Vector::back constexpr
This commit is contained in:
parent
713f5c4bce
commit
f9c3c17592
8
deps/ox/src/ox/std/vector.hpp
vendored
8
deps/ox/src/ox/std/vector.hpp
vendored
@ -310,10 +310,10 @@ class Vector: detail::VectorAllocator<T, SmallVectorSize> {
|
|||||||
Result<const T&> front() const noexcept;
|
Result<const T&> front() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
Result<T&> back() noexcept;
|
constexpr Result<T&> back() noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
Result<const T&> back() const noexcept;
|
constexpr Result<const T&> back() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr std::size_t size() const noexcept;
|
constexpr std::size_t size() const noexcept;
|
||||||
@ -501,7 +501,7 @@ Result<const T&> Vector<T, SmallVectorSize>::front() const noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, std::size_t SmallVectorSize>
|
template<typename T, std::size_t SmallVectorSize>
|
||||||
Result<T&> Vector<T, SmallVectorSize>::back() noexcept {
|
constexpr Result<T&> Vector<T, SmallVectorSize>::back() noexcept {
|
||||||
if (!m_size) {
|
if (!m_size) {
|
||||||
AllocAlias<T> v;
|
AllocAlias<T> v;
|
||||||
return {*reinterpret_cast<T*>(&v), OxError(1)};
|
return {*reinterpret_cast<T*>(&v), OxError(1)};
|
||||||
@ -510,7 +510,7 @@ Result<T&> Vector<T, SmallVectorSize>::back() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, std::size_t SmallVectorSize>
|
template<typename T, std::size_t SmallVectorSize>
|
||||||
Result<const T&> Vector<T, SmallVectorSize>::back() const noexcept {
|
constexpr Result<const T&> Vector<T, SmallVectorSize>::back() const noexcept {
|
||||||
if (!m_size) {
|
if (!m_size) {
|
||||||
AllocAlias<T> v;
|
AllocAlias<T> v;
|
||||||
return {*reinterpret_cast<T*>(&v), OxError(1)};
|
return {*reinterpret_cast<T*>(&v), OxError(1)};
|
||||||
|
Loading…
Reference in New Issue
Block a user