From f5c7c26340fe43d393312a894f60022edc77512a Mon Sep 17 00:00:00 2001 From: Gary Talent <gary@drinkingtea.net> Date: Tue, 8 Feb 2022 02:11:59 -0600 Subject: [PATCH] [ox/std] Remove unnecessary functions from ox::Array --- deps/ox/src/ox/std/array.hpp | 66 +----------------------------------- 1 file changed, 1 insertion(+), 65 deletions(-) diff --git a/deps/ox/src/ox/std/array.hpp b/deps/ox/src/ox/std/array.hpp index ed24782f..bf231977 100644 --- a/deps/ox/src/ox/std/array.hpp +++ b/deps/ox/src/ox/std/array.hpp @@ -146,7 +146,7 @@ class Array { constexpr Array(Array &&other) noexcept; - ~Array(); + ~Array() = default; constexpr iterator<> begin() noexcept { return iterator<>(&m_items[0], 0, ArraySize); @@ -190,24 +190,9 @@ class Array { constexpr const T &operator[](std::size_t i) const noexcept; - Result<T&> front() noexcept; - - Result<const T&> front() const noexcept; - - Result<T&> back() noexcept; - - Result<const T&> back() const noexcept; - [[nodiscard]] constexpr std::size_t size() const noexcept; - [[nodiscard]] - constexpr bool empty() const noexcept; - - constexpr void clear(); - - constexpr void resize(std::size_t size); - [[nodiscard]] constexpr T *data() noexcept { return m_items; @@ -221,40 +206,6 @@ class Array { [[nodiscard]] constexpr bool contains(const T&) const; - constexpr void insert(std::size_t pos, const T &val); - - template<typename... Args> - constexpr T &emplace_back(Args&&... args); - - constexpr void push_back(const T &item); - - constexpr void pop_back(); - - /** - * Removes an item from the Array. - * @param pos iterator at the point to remove - * @return Error if index is out of bounds - */ - constexpr Result<iterator<>> erase(const iterator<> &pos); - - /** - * Removes an item from the Array. - * @param pos position of item to remove - * @return Error if index is out of bounds - */ - constexpr Result<iterator<>> erase(std::size_t pos); - - /** - * Moves the last item in the Array to position pos and decrements the - * size by 1. - * @param pos position of item to remove - * @return Error if index is out of bounds - */ - constexpr Error unordered_erase(std::size_t pos); - - private: - constexpr void expandCap(std::size_t cap); - }; template<typename T, std::size_t ArraySize, typename RefType, bool reverse> @@ -295,10 +246,6 @@ constexpr Array<T, ArraySize>::Array(Array &&other) noexcept { } } -template<typename T, std::size_t ArraySize> -Array<T, ArraySize>::~Array() { -} - template<typename T, std::size_t ArraySize> constexpr bool Array<T, ArraySize>::operator==(const Array &other) const { for (std::size_t i = 0; i < ArraySize; i++) { @@ -355,15 +302,4 @@ constexpr bool Array<T, ArraySize>::contains(const T &v) const { return false; } -template<typename T, std::size_t ArraySize> -constexpr void Array<T, ArraySize>::expandCap(std::size_t cap) { - auto oldItems = m_items; - if (oldItems) { // move over old items - const auto itRange = ox::min(cap, ArraySize); - for (std::size_t i = 0; i < itRange; ++i) { - new (&m_items[i]) T(std::move(oldItems[i])); - } - } -} - }