forked from Alepha/Alepha
I added is_functional.
This commit is contained in:
37
Meta/is_functional.h
Normal file
37
Meta/is_functional.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
static_assert( __cplusplus > 201700, "C++17 Required" );
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Alepha/Alepha.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user