diff options
author | Chris Robinson <[email protected]> | 2020-03-23 17:18:11 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-23 17:18:11 -0700 |
commit | eed8407599e5953b3cd07060d8afca782b4941e1 (patch) | |
tree | eff5009653a9c2a92a795efd3fab8bcbfdebc765 /common | |
parent | 7effad45c2bd0d621442c49bc31d38a720f3124c (diff) |
Remove some unused functions
Diffstat (limited to 'common')
-rw-r--r-- | common/almalloc.h | 67 |
1 files changed, 3 insertions, 64 deletions
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<typename T> -inline void uninitialized_default_construct(T first, const T last) -{ - using ValueT = typename std::iterator_traits<T>::value_type; - T current{first}; - try { - while(current != last) - { - ::new (static_cast<void*>(std::addressof(*current))) ValueT; - ++current; - } - } - catch(...) { - al::destroy(first, current); - throw; - } -} - template<typename T, typename N, REQUIRES(std::is_integral<N>::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<void*>(std::addressof(*current))) ValueT; + ::new(static_cast<void*>(std::addressof(*current))) ValueT; ++current; } while(--count); } @@ -186,49 +168,6 @@ inline T uninitialized_default_construct_n(T first, N count) } -template<typename T0, typename T1> -inline T1 uninitialized_move(T0 first, const T0 last, const T1 output) -{ - using ValueT = typename std::iterator_traits<T1>::value_type; - T1 current{output}; - try { - while(first != last) - { - ::new (static_cast<void*>(std::addressof(*current))) ValueT{std::move(*first)}; - ++current; - ++first; - } - } - catch(...) { - al::destroy(output, current); - throw; - } - return current; -} - -template<typename T0, typename N, typename T1, REQUIRES(std::is_integral<N>::value)> -inline T1 uninitialized_move_n(T0 first, N count, const T1 output) -{ - using ValueT = typename std::iterator_traits<T1>::value_type; - T1 current{output}; - if(count != 0) - { - try { - do { - ::new (static_cast<void*>(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<typename T, size_t alignment=alignof(T)> struct FlexArray { using element_type = T; - using value_type = typename std::remove_cv<T>::type; + using value_type = std::remove_cv_t<T>; using index_type = size_t; using difference_type = ptrdiff_t; @@ -261,7 +200,7 @@ DIAGNOSTIC_POP static std::unique_ptr<FlexArray> Create(index_type count) { void *ptr{al_calloc(alignof(FlexArray), Sizeof(count))}; - return std::unique_ptr<FlexArray>{new (ptr) FlexArray{count}}; + return std::unique_ptr<FlexArray>{new(ptr) FlexArray{count}}; } static constexpr index_type Sizeof(index_type count, index_type base=0u) noexcept { |