From ccfc7d5405d7ee50eb3ab23d4293d00fee98f3b3 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 23 Mar 2022 03:05:50 -0500 Subject: [PATCH] [ox/std] Remove placement new from Array --- deps/ox/src/ox/std/array.hpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/deps/ox/src/ox/std/array.hpp b/deps/ox/src/ox/std/array.hpp index f4b4ec31..de549ffa 100644 --- a/deps/ox/src/ox/std/array.hpp +++ b/deps/ox/src/ox/std/array.hpp @@ -138,8 +138,6 @@ class Array { public: constexpr Array() noexcept = default; - explicit constexpr Array(std::size_t size) noexcept; - constexpr Array(std::initializer_list list) noexcept; constexpr Array(const Array &other); @@ -216,13 +214,6 @@ constexpr ArrayIt operator+(std::size_t n, const return a + n; } -template -constexpr Array::Array(std::size_t size) noexcept { - for (std::size_t i = 0; i < size; ++i) { - m_items[i] = {}; - } -} - template constexpr Array::Array(std::initializer_list list) noexcept { for (auto i = 0ul; auto &item : list) { @@ -234,7 +225,7 @@ constexpr Array::Array(std::initializer_list list) noexcept { template constexpr Array::Array(const Array &other) { for (std::size_t i = 0; i < ArraySize; ++i) { - new (&m_items[i]) T(other.m_items[i]); + m_items[i] = T(other.m_items[i]); } } @@ -242,7 +233,7 @@ template constexpr Array::Array(Array &&other) noexcept { if (this != &other) { for (std::size_t i = 0; i < ArraySize; ++i) { - new (&m_items[i]) T(std::move(other.m_items[i])); + m_items[i] = T(std::move(other.m_items[i])); } } }