Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.21 KB

RemoveIdsIf.md

File metadata and controls

46 lines (37 loc) · 1.21 KB

<CppML/Algorithm/RemoveIdsIf.hpp>

RemoveIdsIf

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

RemoveIdsIf<Predicate, Pipe>

RemoveIdsIf<Predicate, Pipe> is a metafunction that passes to Pipe a parameter pack ml::Int<Is>... of indexes of the elements of the parameter pack Ts..., for which the predicate does not hold. Pipe defaults to ml::ToList.

f:: Ts... -> ml::Int<Is>... >-> Pipe

Predicate

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

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

Example

using T0 = ml::f<
                 ml::RemoveIdsIf<ml::IsClass<>>,
                 int, char, std::string>;
static_assert(
              std::is_same_v<
                  T,
                  ml::ListT<ml::Int<0>, ml::Int<1>>>);

using T1 = ml::f<
                 ml::RemoveIdsIf<
                           ml::IsClass<ml::Not<>>>,
                 int, char, std::string>;
static_assert(
              std::is_same_v<
                  T,
                  ml::ListT<ml::Int<2>>>);