Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.11 KB

AllOf.md

File metadata and controls

43 lines (34 loc) · 1.11 KB

<CppML/Algorithm/AllOf.hpp>

AllOf

template <typename Predicate, typename Pipe = ml::Identity>
struct AllOf {
  template <typename ...Ts>
  using f = /* .... */;
};

AllOf<Predicate, Pipe>

AllOf<Predicate, Pipe> is a metafunction that passes to Pipe an ml::Bool<truth_value>, where truth_value marks whether the predicate holds for all elements of the parameter pack Ts. Pipe defaults to ml::Identity.

f:: Ts... ---> ml::Bool<truth_value> >-> Pipe

Predicate

Predicate must be a metafunction returning ml::Bool<truth_value>.

f:: T -> ml::Bool<truth_value>

Example

using T0 = ml::f<
                 ml::AllOf<ml::IsClass<>>,
                 int, char, std::string>;
static_assert(
              std::is_same_v<T, ml::Bool<false>);

using T1 = ml::f<
                 ml::AllOf<
                           ml::IsClass<>,
                           ml::Not<>>,
                 int, char, std::string>;
static_assert(
              std::is_same_v<T, ml::Bool<true>);