[ox/std] Fix Vector reverse iterators

This commit is contained in:
Gary Talent 2021-10-25 18:26:53 -05:00
parent 4a4f380a11
commit e2b9823ae2

View File

@ -110,7 +110,7 @@ class Vector: detail::SmallVector<T, SmallVectorSize> {
size_type m_max = 0;
public:
constexpr iterator(PtrType t, size_type offset, size_type max) {
constexpr iterator(PtrType t, size_type offset, size_type max) noexcept {
m_t = t;
m_offset = offset;
m_max = max;
@ -240,19 +240,19 @@ class Vector: detail::SmallVector<T, SmallVectorSize> {
}
constexpr iterator<T&, T*, true> rbegin() const noexcept {
return iterator<T&, T*, true>(m_items, m_size, m_size);
return iterator<T&, T*, true>(m_items, m_size - 1, m_size);
}
constexpr iterator<T&, T*, true> rend() const noexcept {
return iterator<T&, T*, true>(m_items, 0, m_size);
return iterator<T&, T*, true>(m_items, MaxValue<size_type>, m_size);
}
constexpr iterator<const T&, const T*, true> crbegin() const noexcept {
return iterator<const T&, const T*, true>(m_items, m_size, m_size);
return iterator<const T&, const T*, true>(m_items, m_size - 1, m_size);
}
constexpr iterator<const T&, const T*, true> crend() const noexcept {
return iterator<const T&, const T*, true>(m_items, 0, m_size);
return iterator<const T&, const T*, true>(m_items, MaxValue<size_type>, m_size);
}
bool operator==(const Vector &other) const;