Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 701 Bytes

IfElse.md

File metadata and controls

33 lines (24 loc) · 701 Bytes

<CppML/Functional/IfElse.hpp>

IfElse

template <typename B, typename Pipe = ml::Identity>
struct IfElse {
  template <typename T0, typename T1>
  using f = /* .... */;
};

IfElse<Bool<t>, Pipe>

IfElse<Test> is a metafunction that passes to U, which is T0 if B is ml::Bool<true>, and T1 if B is ml::Bool<false>. Pipe defaults to ml::Identity.

f:: T0, T1 -> U

Example

using U = ml::f<
              IfElse<ml::Bool<true>>,
              int,
              char;

static_assert(
          std::is_same_v<
                         U, int>);