Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.1 KB

AnyOf.md

File metadata and controls

43 lines (34 loc) · 1.1 KB

<CppML/Algorithm/AnyOf.hpp>

AnyOf

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

AnyOf<Predicate, Pipe>

AnyOf<Predicate, Pipe> is a metafunction that passes to Pipe and ml::Bool<truth_value>, where truth_value marks whether the predicate holds for any element 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::AnyOf<ml::IsClass<>>,
                 int, char, std::string>;
static_assert(
              std::is_same_v<T, ml::Bool<true>);

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