-
-
Save picanumber/48d033904b451621b1cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define fw(...) ::std::forward<decltype(__VA_ARGS__)>(__VA_ARGS__) | |
namespace detail | |
{ | |
/* Implementation ... */ | |
template <class F, class T> | |
constexpr auto makeO_x(T&& data) | |
{ | |
return O_x<F, decltype(data)>(fw(data)); | |
} | |
/* Implementation ... */ | |
template <class... Ts> | |
constexpr auto _foldr(Ts&&... args) | |
{ | |
return (fw(args) + ...); | |
} | |
} | |
template <class F, class... Ts> | |
constexpr decltype(auto) foldr(Ts&&... args) | |
{ | |
return detail::_foldr(detail::makeO_x<F>(fw(args))...); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment