Skip to content

Commit

Permalink
fix: fix compile issue in C++23
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyAndNotDown authored Apr 7, 2022
1 parent 2c32b2f commit f7cffbd
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions include/clipp.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,39 @@ namespace traits {
* @brief function (class) signature type trait
*
*****************************************************************************/
#if defined(__cpp_lib_is_invocable)
template<class Fn, class Ret, class... Args>
constexpr auto
check_is_callable(int) -> decltype(
std::declval<Fn>()(std::declval<Args>()...),
std::integral_constant<bool,
std::is_same<Ret,typename std::result_of<Fn(Args...)>::type>::value>{} );
std::is_same<Ret,typename std::invoke_result<Fn,Args...>::type>::value>{} );

template<class,class,class...>
template<class Fn, class Ret>
constexpr auto
check_is_callable(long) -> std::false_type;
check_is_callable_without_arg(int) -> decltype(
std::declval<Fn>()(),
std::integral_constant<bool,
std::is_same<Ret,typename std::invoke_result<Fn>::type>::value>{} );
#else
template<class Fn, class Ret, class... Args>
constexpr auto
check_is_callable(int) -> decltype(
std::declval<Fn>()(std::declval<Args>()...),
std::integral_constant<bool,
std::is_same<Ret,typename std::result_of<Fn(Args...)>::type>::value>{} );

template<class Fn, class Ret>
constexpr auto
check_is_callable_without_arg(int) -> decltype(
std::declval<Fn>()(),
std::integral_constant<bool,
std::is_same<Ret,typename std::result_of<Fn()>::type>::value>{} );
#endif

template<class,class,class...>
constexpr auto
check_is_callable(long) -> std::false_type;

template<class,class>
constexpr auto
Expand Down

0 comments on commit f7cffbd

Please sign in to comment.