Skip to content

Commit 4b002c3

Browse files
author
Fytch
committed
simplify SFINAE code
1 parent a1eee19 commit 4b002c3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ProgramOptions.hxx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -846,20 +846,17 @@ namespace po {
846846
namespace detail {
847847
template< typename fun_t, typename... args_t >
848848
class is_invocable_sfinae {
849-
using false_t = char[ 1 ];
850-
using true_t = char[ 2 ];
851-
852849
template< typename _fun_t, typename... _args_t >
853-
static false_t& test( ... );
850+
static std::false_type test( ... );
854851
template< typename _fun_t, typename... _args_t >
855-
static true_t& test( decltype( std::declval< _fun_t >()( std::declval< _args_t >()... ) )* );
852+
static std::true_type test( decltype( std::declval< _fun_t >()( std::declval< _args_t >()... ) )* );
856853

857854
public:
858-
static constexpr bool value = sizeof( test< fun_t, args_t... >( 0 ) ) == sizeof( true_t );
855+
using type = decltype( test< fun_t, args_t... >( 0 ) );
859856
};
860857
}
861858
template< typename fun_t, typename... args_t >
862-
struct is_invocable : public std::integral_constant< bool, detail::is_invocable_sfinae< fun_t, args_t... >::value > {
859+
struct is_invocable : public detail::is_invocable_sfinae< fun_t, args_t... >::type {
863860
};
864861

865862
struct callback_base {

0 commit comments

Comments
 (0)