Fix: Replace std::result_of with std::invoke_result_t for C++20

std::result_of was deprecated in C++17 and removed in C++20.
This patch replaces it with std::invoke_result_t which is the
modern equivalent.

Fixes build on systems with C++20 compilers (e.g., FreeBSD 14+
with clang 18).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
clboss-contributor 2026-03-01 08:56:16 +01:00
parent 401bbb79c9
commit 38bba65ca9
2 changed files with 7 additions and 7 deletions

View file

@ -91,9 +91,9 @@ public:
/* (>>=) :: IO a -> (a -> IO b) -> IO b*/
template<typename f>
Io<typename Detail::IoInner<typename std::result_of<f(a)>::type>::type>
Io<typename Detail::IoInner<std::invoke_result_t<f, a>>::type>
then(f func)&& {
using b = typename Detail::IoInner<typename std::result_of<f(a)>::type>::type;
using b = typename Detail::IoInner<std::invoke_result_t<f, a>>::type;
auto pcore = std::make_shared<CoreFunc>(std::move(this->core));
auto pfunc = std::make_shared<f>(std::move(func));
/* Continuation Monad. */
@ -150,9 +150,9 @@ public:
/* (>>=) :: IO () -> (() -> IO b) -> IO b*/
template<typename f>
Io<typename Detail::IoInner<typename std::result_of<f()>::type>::type>
Io<typename Detail::IoInner<std::invoke_result_t<f>>::type>
then(f func)&& {
using b = typename Detail::IoInner<typename std::result_of<f()>::type>::type;
using b = typename Detail::IoInner<std::invoke_result_t<f>>::type;
auto pcore = std::make_shared<CoreFunc>(std::move(this->core));
auto pfunc = std::make_shared<f>(std::move(func));
/* Continuation Monad. */

View file

@ -43,7 +43,7 @@ namespace Ev {
*/
/* mapIO :: (a -> IO b) -> [a] -> IO [b] */
template<typename f, typename a>
Io<std::vector<typename Detail::IoInner<typename std::result_of<f(a)>::type>::type>>
Io<std::vector<typename Detail::IoInner<std::invoke_result_t<f, a>>::type>>
map(f func, std::vector<a> as);
namespace Detail {
@ -209,9 +209,9 @@ public:
}
template<typename f, typename a>
Io<std::vector<typename Detail::IoInner<typename std::result_of<f(a)>::type>::type>>
Io<std::vector<typename Detail::IoInner<std::invoke_result_t<f, a>>::type>>
map(f func, std::vector<a> as) {
using b = typename Detail::IoInner<typename std::result_of<f(a)>::type>::type;
using b = typename Detail::IoInner<std::invoke_result_t<f, a>>::type;
/* Save the function into shared storage. */
auto pfunc = std::make_shared<f>(std::move(func));