Skip to content

Commit

Permalink
Switch from std::result_of to std::invoke_result
Browse files Browse the repository at this point in the history
`std::result_of` was deprecated in C++17 and removed in C++20,
though not all compilers hide it when compiling C++20.
  • Loading branch information
thejohnfreeman committed May 7, 2024
1 parent 9c88d27 commit 64a58e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/autocheck/classifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ namespace autocheck {
typename Func,
typename Enable = typename std::enable_if<
!std::is_convertible<
#if __cplusplus < 201703L
typename std::result_of<Func(const Args&...)>::type,
#else
typename std::invoke_result<Func, const Args&...>::type,
#endif
std::string
>::value
>::type
Expand Down
12 changes: 9 additions & 3 deletions include/autocheck/generator_combinators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ namespace autocheck {
template <typename Func, typename Gen>
class mapped_generator {
public:


typedef
typename std::result_of<
Func(typename Gen::result_type&&, size_t)
>::type
typename
#if __cplusplus < 201703L
std::result_of<Func(typename Gen::result_type&&, size_t)>
#else
std::invoke_result<Func, typename Gen::result_type&&, size_t>
#endif
::type
result_type;

private:
Expand Down

0 comments on commit 64a58e6

Please sign in to comment.