mpc
Haskell-like feature supports in C++
infix.hpp File Reference
#include <functional>
#include <mpc/stdfundamental.hpp>

Go to the source code of this file.

Functions

template<class A1 , class Op , class A2 >
constexpr auto mpc::infixr (A1 &&a1, Op &&op, A2 &&a2) noexcept(noexcept(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))) -> decltype(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))
 Implements the right-associative infix notation. More...
 
template<class A1 , class Op , class... Args>
constexpr auto mpc::infixr (A1 &&a1, Op &&op, Args &&... args) noexcept(noexcept(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), infixr(std::forward< Args >(args)...)))) -> decltype(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), infixr(std::forward< Args >(args)...)))
 Another overloaded function of infixr.
 
template<class A1 , class Op , class A2 >
constexpr auto mpc::infixl (A1 &&a1, Op &&op, A2 &&a2) noexcept(noexcept(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))) -> decltype(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))
 Implements the left-associative infix notation. More...
 
template<class A1 , class Op , class A2 , class... Args>
constexpr auto mpc::infixl (A1 &&a1, Op &&op, A2 &&a2, Args &&... args) noexcept(noexcept(infixl(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)), std::forward< Args >(args)...))) -> decltype(infixl(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)), std::forward< Args >(args)...))
 Another overloaded function of infixl.
 

Function Documentation

◆ infixl()

template<class A1 , class Op , class A2 >
constexpr auto mpc::infixl ( A1 &&  a1,
Op &&  op,
A2 &&  a2 
) -> decltype( std::invoke(std::forward<Op>(op), std::forward<A1>(a1), std::forward<A2>(a2)))
constexprnoexcept

Implements the left-associative infix notation.

infixl(a1, op, a2) = op(a1, a2)
infixl(a1, op, a2, args...) = infixl(op(a1, a2), args...)
constexpr auto infixl(A1 &&a1, Op &&op, A2 &&a2) noexcept(noexcept(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))) -> decltype(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))
Implements the left-associative infix notation.
Definition: infix.hpp:39

◆ infixr()

template<class A1 , class Op , class A2 >
constexpr auto mpc::infixr ( A1 &&  a1,
Op &&  op,
A2 &&  a2 
) -> decltype( std::invoke(std::forward<Op>(op), std::forward<A1>(a1), std::forward<A2>(a2)))
constexprnoexcept

Implements the right-associative infix notation.

infixr(a1, op, a2) = op(a1, a2)
infixr(a1, op, args...) = op(a1, infixr(args...))
constexpr auto infixr(A1 &&a1, Op &&op, A2 &&a2) noexcept(noexcept(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))) -> decltype(std::invoke(std::forward< Op >(op), std::forward< A1 >(a1), std::forward< A2 >(a2)))
Implements the right-associative infix notation.
Definition: infix.hpp:18