mpc
Haskell-like feature supports in C++
partial.hpp File Reference
#include <functional>
#include <mpc/utility/copyable_box.hpp>
#include <mpc/utility/forward_like.hpp>

Go to the source code of this file.

Classes

struct  mpc::partial< Op, Bound >
 Implements a perfect-forwarding call wrapper. More...
 

Functions

template<class Op , class Tuple , std::size_t... Idx, class... Args>
constexpr auto mpc::make_partial_impl (Op &&op, Tuple &&tuple, std::index_sequence< Idx... >, Args &&... args) noexcept(noexcept(partial(std::forward< Op >(op), std::get< Idx >(std::forward< Tuple >(tuple))..., std::forward< Args >(args)...))) -> decltype(partial(std::forward< Op >(op), std::get< Idx >(std::forward< Tuple >(tuple))..., std::forward< Args >(args)...))
 
template<class Op , class... Args, class = std::enable_if_t<is_partial_v<std::remove_cvref_t<Op>>>>
constexpr auto mpc::make_partial (Op &&op, Args &&... args) noexcept(noexcept(make_partial_impl(forward_like< Op >(op.op_), forward_like< Op >(op.bound_), std::make_index_sequence< std::tuple_size_v< decltype(op.bound_)> >(), std::forward< Args >(args)...))) -> decltype(make_partial_impl(forward_like< Op >(op.op_), forward_like< Op >(op.bound_), std::make_index_sequence< std::tuple_size_v< decltype(op.bound_)> >(), std::forward< Args >(args)...))
 
template<class Op , class Tuple , std::size_t... Idx, class... Args, class = std::enable_if_t<std::is_invocable_v<Op, forward_like_t<Tuple, std::tuple_element_t<Idx, std::remove_cvref_t<Tuple>>>..., Args...>>>
constexpr auto mpc::__call (Op &&op, Tuple &&tuple, std::index_sequence< Idx... >, Args &&... args) noexcept(noexcept(std::invoke(std::forward< Op >(op), std::get< Idx >(std::forward< Tuple >(tuple))..., std::forward< Args >(args)...))) -> decltype(std::invoke(std::forward< Op >(op), std::get< Idx >(std::forward< Tuple >(tuple))..., std::forward< Args >(args)...))
 
template<class Op , class... Args>
 mpc::partial (Op, Args...) -> partial< Op, Args... >
 A deduction guide for partial.
 

Variables

template<class T >
constexpr bool mpc::is_partial_v = false
 
template<copy_constructible_object Op, class... Bound>
constexpr bool mpc::is_partial_v< partial< Op, Bound... > > = true