goodbye noexcept

This commit is contained in:
BlackMATov
2020-12-10 03:41:01 +07:00
parent 9b79037170
commit 0d2995f974

View File

@@ -57,7 +57,6 @@ namespace kari_hpp
struct curry_t final { struct curry_t final {
template < typename U > template < typename U >
constexpr curry_t(U&& u, std::tuple<Args...>&& args) constexpr curry_t(U&& u, std::tuple<Args...>&& args)
noexcept(noexcept(F(std::forward<U>(u))) && noexcept(std::tuple<Args...>(std::move(args))))
: f_(std::forward<U>(u)) : f_(std::forward<U>(u))
, args_(std::move(args)) {} , args_(std::move(args)) {}
@@ -70,43 +69,25 @@ namespace kari_hpp
// recurry // recurry
template < std::size_t M > template < std::size_t M >
constexpr decltype(auto) recurry() && constexpr auto recurry() && {
noexcept(noexcept(
detail::curry_or_apply<M>(
std::move(std::declval<F>()),
std::move(std::declval<std::tuple<Args...>>()))))
{
return detail::curry_or_apply<M>( return detail::curry_or_apply<M>(
std::move(f_), std::move(f_),
std::move(args_)); std::move(args_));
} }
template < std::size_t M > template < std::size_t M >
constexpr decltype(auto) recurry() const & constexpr auto recurry() const & {
noexcept(noexcept(
std::move(std::declval<curry_t>()).template recurry<M>()))
{
return std::move(curry_t(*this)).template recurry<M>(); return std::move(curry_t(*this)).template recurry<M>();
} }
// operator(As&&...) // operator(As&&...)
constexpr decltype(auto) operator()() && constexpr auto operator()() && {
noexcept(noexcept(
std::move(std::declval<curry_t>()).template recurry<0>()))
{
return std::move(*this).template recurry<0>(); return std::move(*this).template recurry<0>();
} }
template < typename A > template < typename A >
constexpr decltype(auto) operator()(A&& a) && constexpr auto operator()(A&& a) && {
noexcept(noexcept(
detail::curry_or_apply<(N > 0 ? N - 1 : 0)>(
std::move(std::declval<F>()),
std::tuple_cat(
std::move(std::declval<std::tuple<Args...>>()),
std::make_tuple(std::forward<A>(a))))))
{
return detail::curry_or_apply<(N > 0 ? N - 1 : 0)>( return detail::curry_or_apply<(N > 0 ? N - 1 : 0)>(
std::move(f_), std::move(f_),
std::tuple_cat( std::tuple_cat(
@@ -115,18 +96,12 @@ namespace kari_hpp
} }
template < typename A, typename... As > template < typename A, typename... As >
constexpr decltype(auto) operator()(A&& a, As&&... as) && constexpr auto operator()(A&& a, As&&... as) && {
noexcept(noexcept(
std::move(std::declval<curry_t>())(std::forward<A>(a))(std::forward<As>(as)...)))
{
return std::move(*this)(std::forward<A>(a))(std::forward<As>(as)...); return std::move(*this)(std::forward<A>(a))(std::forward<As>(as)...);
} }
template < typename... As > template < typename... As >
constexpr decltype(auto) operator()(As&&... as) const & constexpr auto operator()(As&&... as) const & {
noexcept(noexcept(
std::move(std::declval<curry_t>())(std::forward<As>(as)...)))
{
return std::move(curry_t(*this))(std::forward<As>(as)...); return std::move(curry_t(*this))(std::forward<As>(as)...);
} }
private: private: