Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 753 Bytes

Add.md

File metadata and controls

33 lines (24 loc) · 753 Bytes

<CppML/Arithmetic/Add.hpp>

Add

template <typename Pipe = ml::Identity>
struct Add {
  template <typename T, typename U>
  using f = /* .... */;
};

Add<Pipe>

Add<Pipe> is a metafunction that passes to Pipe an ml::Int<value>, where value is the sum of ::values of underlying types. Pipe defaults to ml::Identity.

f:: T, U -> ml::Int<value> -> ResultOf(Pipe)

T, U

Types T and U need an ::value alias, like ml::Value<Type, value>.

Example

using T0 = ml::f<
                 ml::Add<>,
                 ml::Int<1>, ml::Int<2>>;
static_assert(
              std::is_same_v<T0, ml::Int<3>);