diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index 45c86eb5..ab45828f 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -59,6 +59,8 @@ class Vector { bool contains(T) const noexcept; + void insert(std::size_t pos, const T &val) noexcept; + template void emplace_back(Args&&... args) noexcept; @@ -215,6 +217,18 @@ bool Vector::contains(T v) const noexcept { return false; } +template +void Vector::insert(std::size_t pos, const T &val) noexcept { + if (m_size == m_cap) { + expandCap(m_cap ? m_cap * 2 : 100); + } + for (auto i = m_size; i > pos; i--) { + m_items[i] = m_items[i - 1]; + } + m_items[pos] = val; + ++m_size; +} + template template void Vector::emplace_back(Args&&... args) noexcept {