Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 931 Bytes

Contains.md

File metadata and controls

36 lines (29 loc) · 931 Bytes

<CppML/Algorithm/Contains.hpp>

Contains

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

Contains<T, Pipe>

Contains<T, Pipe> is a metafunction that passes to Pipe an ml::Bool<truth_value>, where truth_value marks whether the parameter pack Ts contains T. Pipe defaults to ml::Identity.

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

Example

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

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