From eed8407599e5953b3cd07060d8afca782b4941e1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 23 Mar 2020 17:18:11 -0700 Subject: Remove some unused functions --- common/almalloc.h | 67 +++---------------------------------------------------- 1 file changed, 3 insertions(+), 64 deletions(-) (limited to 'common/almalloc.h') diff --git a/common/almalloc.h b/common/almalloc.h index fc83b0d8..157ca8d6 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -146,24 +146,6 @@ inline T destroy_n(T first, N count) } -template -inline void uninitialized_default_construct(T first, const T last) -{ - using ValueT = typename std::iterator_traits::value_type; - T current{first}; - try { - while(current != last) - { - ::new (static_cast(std::addressof(*current))) ValueT; - ++current; - } - } - catch(...) { - al::destroy(first, current); - throw; - } -} - template::value)> inline T uninitialized_default_construct_n(T first, N count) { @@ -173,7 +155,7 @@ inline T uninitialized_default_construct_n(T first, N count) { try { do { - ::new (static_cast(std::addressof(*current))) ValueT; + ::new(static_cast(std::addressof(*current))) ValueT; ++current; } while(--count); } @@ -186,49 +168,6 @@ inline T uninitialized_default_construct_n(T first, N count) } -template -inline T1 uninitialized_move(T0 first, const T0 last, const T1 output) -{ - using ValueT = typename std::iterator_traits::value_type; - T1 current{output}; - try { - while(first != last) - { - ::new (static_cast(std::addressof(*current))) ValueT{std::move(*first)}; - ++current; - ++first; - } - } - catch(...) { - al::destroy(output, current); - throw; - } - return current; -} - -template::value)> -inline T1 uninitialized_move_n(T0 first, N count, const T1 output) -{ - using ValueT = typename std::iterator_traits::value_type; - T1 current{output}; - if(count != 0) - { - try { - do { - ::new (static_cast(std::addressof(*current))) ValueT{std::move(*first)}; - ++current; - ++first; - } while(--count); - } - catch(...) { - al::destroy(output, current); - throw; - } - } - return current; -} - - /* A flexible array type. Used either standalone or at the end of a parent * struct, with placement new, to have a run-time-sized array that's embedded * with its size. @@ -236,7 +175,7 @@ inline T1 uninitialized_move_n(T0 first, N count, const T1 output) template struct FlexArray { using element_type = T; - using value_type = typename std::remove_cv::type; + using value_type = std::remove_cv_t; using index_type = size_t; using difference_type = ptrdiff_t; @@ -261,7 +200,7 @@ DIAGNOSTIC_POP static std::unique_ptr Create(index_type count) { void *ptr{al_calloc(alignof(FlexArray), Sizeof(count))}; - return std::unique_ptr{new (ptr) FlexArray{count}}; + return std::unique_ptr{new(ptr) FlexArray{count}}; } static constexpr index_type Sizeof(index_type count, index_type base=0u) noexcept { -- cgit v1.2.3