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 ee827301599a0c4a6e67c5bf0ff4926aedd930da
parent 02fa0219dd0cec8503cad03e71e144b466cc7c3f
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon,  2 Dec 2019 18:30:44 +0000

is_invocable

Diffstat:
Minclude/kfr/cometa.hpp | 3+++
Minclude/kfr/cometa/function.hpp | 10+++++-----
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/kfr/cometa.hpp b/include/kfr/cometa.hpp @@ -186,6 +186,9 @@ constexpr inline bool is_convertible = std::is_convertible<Tfrom, Tto>::value; template <typename T, typename... Args> constexpr inline bool is_constructible = std::is_constructible<T, Args...>::value; +template <typename T, typename... Args> +constexpr inline bool is_invocable = std::is_invocable<T, Args...>::value; + template <typename T> constexpr inline bool is_template_arg = std::is_integral<T>::value || std::is_enum<T>::value; diff --git a/include/kfr/cometa/function.hpp b/include/kfr/cometa/function.hpp @@ -5,10 +5,10 @@ #include "../cometa.hpp" #include "memory.hpp" -#include <cstdlib> #include <cstddef> -#include <type_traits> +#include <cstdlib> #include <memory> +#include <type_traits> #if CMT_HAS_EXCEPTIONS #include <functional> #endif @@ -91,9 +91,9 @@ struct function<R(Args...)> function(nullptr_t) noexcept {} - template <typename Fn, typename = std::enable_if_t<std::is_invocable_r_v<R, Fn, Args...> && - !std::is_same_v<std::decay_t<Fn>, function>>> - function(Fn fn) : impl(new details::function_impl<std::decay_t<Fn>, R, Args...>(std::move(fn))) + template <typename Fn, + typename = enable_if<is_invocable<R, Fn, Args...> && !is_same<decay<Fn>, function>>> + function(Fn fn) : impl(new details::function_impl<decay<Fn>, R, Args...>(std::move(fn))) { }