kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit efa5237af86a495072d26fe428e31429ae85bc7d
parent a7c7a5a715441b16fef0c1eddfaa4da88a654dd1
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Tue, 19 Nov 2019 20:59:05 +0000

Remove deprecated in C++17

Diffstat:
Minclude/kfr/base/memory.hpp | 15+--------------
Minclude/kfr/cometa.hpp | 14+++++++-------
Minclude/kfr/simd/vec.hpp | 10+++++-----
3 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/include/kfr/base/memory.hpp b/include/kfr/base/memory.hpp @@ -194,9 +194,7 @@ struct allocator constexpr allocator(const allocator<U>&) CMT_NOEXCEPT { } - pointer address(reference x) const CMT_NOEXCEPT { return std::addressof(x); } - const_pointer address(const_reference x) const CMT_NOEXCEPT { return std::addressof(x); } - pointer allocate(size_type n, std::allocator<void>::const_pointer = 0) const + pointer allocate(size_type n) const { pointer result = aligned_allocate<value_type>(n); if (!result) @@ -204,17 +202,6 @@ struct allocator return result; } void deallocate(pointer p, size_type) { aligned_deallocate(p); } - size_type max_size() const { return std::numeric_limits<size_type>::max() / sizeof(value_type); } - template <typename U, typename... Args> - void construct(U* p, Args&&... args) - { - ::new (pvoid(p)) U(std::forward<Args>(args)...); - } - template <typename U> - void destroy(U* p) - { - p->~U(); - } }; template <typename T1, typename T2> diff --git a/include/kfr/cometa.hpp b/include/kfr/cometa.hpp @@ -125,8 +125,8 @@ constexpr size_t max_size_t = size_t(-1); template <typename... T> using common_type = typename std::common_type<T...>::type; -template <typename T> -using result_of = typename std::result_of<T>::type; +template <typename T, typename... Args> +using invoke_result = typename std::invoke_result<T, Args...>::type; template <bool Condition, typename Type = void> using enable_if = typename std::enable_if<Condition, Type>::type; @@ -745,8 +745,8 @@ struct is_returning_type_impl : std::false_type }; template <typename Ret, typename Fn, typename... Args> -struct is_returning_type_impl<Ret, Fn(Args...), void_t<result_of<Fn(Args...)>>> - : std::is_same<Ret, result_of<Fn(Args...)>> +struct is_returning_type_impl<Ret, Fn(Args...), void_t<invoke_result<Fn, Args...>>> + : std::is_same<Ret, invoke_result<Fn, Args...>> { }; @@ -756,7 +756,7 @@ struct is_callable_impl : std::false_type }; template <typename Fn, typename... Args> -struct is_callable_impl<Fn, ctypes_t<Args...>, void_t<result_of<Fn(Args...)>>> : std::true_type +struct is_callable_impl<Fn, ctypes_t<Args...>, void_t<invoke_result<Fn, Args...>>> : std::true_type { }; @@ -1577,7 +1577,7 @@ inline size_t cfind(cvals_t<T, values...>, identity<T> value) } template <typename Fn, typename... Args> -CMT_NOINLINE static result_of<Fn(Args...)> noinline(Fn&& fn, Args&&... args) +CMT_NOINLINE static invoke_result<Fn, Args...> noinline(Fn&& fn, Args&&... args) { return fn(std::forward<Args>(args)...); } @@ -1586,7 +1586,7 @@ template <typename Fn> struct fn_noinline { template <typename... Args> - CMT_MEM_INTRINSIC result_of<Fn(Args...)> operator()(Args&&... args) const + CMT_MEM_INTRINSIC invoke_result<Fn, Args...> operator()(Args&&... args) const { return noinline(Fn{}, std::forward<Args>(args)...); } diff --git a/include/kfr/simd/vec.hpp b/include/kfr/simd/vec.hpp @@ -971,14 +971,14 @@ namespace internal { template <size_t Index, typename T, size_t N, typename Fn, typename... Args, - typename Tout = result_of<Fn(subtype<decay<Args>>...)>> + typename Tout = invoke_result<Fn, subtype<decay<Args>>...>> constexpr KFR_INTRINSIC Tout applyfn_helper(Fn&& fn, Args&&... args) { return fn(args[Index]...); } template <typename T, size_t N, typename Fn, typename... Args, - typename Tout = result_of<Fn(subtype<decay<Args>>...)>, size_t... Indices> + typename Tout = invoke_result<Fn, subtype<decay<Args>>...>, size_t... Indices> constexpr KFR_INTRINSIC vec<Tout, N> apply_helper(Fn&& fn, csizes_t<Indices...>, Args&&... args) { return make_vector(applyfn_helper<Indices, T, N>(std::forward<Fn>(fn), std::forward<Args>(args)...)...); @@ -992,20 +992,20 @@ constexpr KFR_INTRINSIC vec<T, N> apply0_helper(Fn&& fn, csizes_t<Indices...>) } // namespace internal template <typename T, size_t N, typename Fn, typename... Args, - typename Tout = result_of<Fn(T, subtype<decay<Args>>...)>> + typename Tout = invoke_result<Fn, T, subtype<decay<Args>>...>> constexpr KFR_INTRINSIC vec<Tout, N> apply(Fn&& fn, const vec<T, N>& arg, Args&&... args) { return internal::apply_helper<T, N>(std::forward<Fn>(fn), csizeseq<N>, arg, std::forward<Args>(args)...); } -template <typename T, typename Fn, typename... Args, typename Tout = result_of<Fn(T, decay<Args>...)>, +template <typename T, typename Fn, typename... Args, typename Tout = invoke_result<Fn, T, decay<Args>...>, KFR_ENABLE_IF(is_same<T, subtype<T>>::value)> constexpr KFR_INTRINSIC Tout apply(Fn&& fn, const T& arg, Args&&... args) { return fn(arg, args...); } -template <size_t N, typename Fn, typename T = result_of<Fn()>> +template <size_t N, typename Fn, typename T = invoke_result<Fn>> constexpr KFR_INTRINSIC vec<T, N> apply(Fn&& fn) { return internal::apply0_helper<T, N>(std::forward<Fn>(fn), csizeseq<N>);