From d976ff90b856a01eb4b938562a574747b9260bbd Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 16 Oct 2021 23:41:34 -0400 Subject: [PATCH] I added is_functional. --- Meta/is_functional.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Meta/is_functional.h diff --git a/Meta/is_functional.h b/Meta/is_functional.h new file mode 100644 index 0000000..14d52bd --- /dev/null +++ b/Meta/is_functional.h @@ -0,0 +1,37 @@ +static_assert( __cplusplus > 201700, "C++17 Required" ); + +#pragma once + +#include + +#include + +namespace Alepha::Hydrogen::Meta +{ + inline namespace exports { inline namespace type_traits {} } + + namespace detail::type_traits::is_functional + { + inline namespace exports {} + + template< typename T, typename= void > + struct is_functional : std::false_type {}; + + template< typename T > + struct is_functional< T, std::void_t< decltype( std::function< std::declval< T >() > ) > > : std::true_type {}; + + namespace exports + { + template< typename T > + constexpr bool is_functional_v= is_functional< T >::value; + + template< typename T > + struct is_functional : std::bool_constant< bool, is_functional_v< T > > {}; + } + } + + namespace exports::type_traits + { + using namespace detail::type_traits::is_functional::exports; + } +}