diff --git a/BAN/include/BAN/Vector.h b/BAN/include/BAN/Vector.h index 039e2649..c58a111d 100644 --- a/BAN/include/BAN/Vector.h +++ b/BAN/include/BAN/Vector.h @@ -7,6 +7,7 @@ #include #include #include +#include namespace BAN { @@ -65,6 +66,8 @@ namespace BAN const T& front() const; T& front(); + void reverse(); + ErrorOr resize(size_type) requires is_default_constructible_v; ErrorOr resize(size_type, const T&) requires is_copy_constructible_v; ErrorOr reserve(size_type); @@ -301,6 +304,13 @@ namespace BAN return m_data[0]; } + template + void Vector::reverse() + { + for (size_type i = 0; i < m_size / 2; i++) + BAN::swap(m_data[i], m_data[m_size - i - 1]); + } + template ErrorOr Vector::resize(size_type size) requires is_default_constructible_v {