Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions include/clipp.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
#include <iterator>
#include <functional>

#ifdef _MSVC_LANG
#define CLIPP_CPLUSPLUS _MSVC_LANG
#else
#define CLIPP_CPLUSPLUS __cplusplus
#endif

/*************************************************************************//**
*
Expand Down Expand Up @@ -160,7 +165,14 @@ 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,
#if CLIPP_CPLUSPLUS >= 201703L
typename std::invoke_result<Fn(Args...)>::type

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Apple Clang version 14.0.3 (C++17, C++20), this will not compile.
Shouldn't it be typename std::invoke_result<Fn, Args...> ?
One can also use the shorter version std::invoke_result_t<Fn, Args...>.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix it.

#else
typename std::result_of<Fn(Args...)>::type
#endif
>::value>{} );


template<class,class,class...>
constexpr auto
Expand All @@ -171,7 +183,13 @@ 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>{} );
std::is_same<Ret,
#if CLIPP_CPLUSPLUS >= 201703L
typename std::invoke_result<Fn()>::type
#else
typename std::result_of<Fn()>::type
#endif
>::value>{} );

template<class,class>
constexpr auto
Expand Down