template <typename Predicate, typename Pipe = ml::Identity>
struct CountIf {
template <typename ...Ts>
using f = /* .... */;
};
CountIf<Predicate, Pipe>
is a metafunction that passes to Pipe
and ml::Int
<count>
, where count is the number of elements of the parameter pack Ts
, for which the Predicate holds. Pipe
defaults to ml::Identity
.
f:: Ts... -> ml::Int<count> >-> Pipe
Predicate must be a metafunction returning ml::Bool<truth_value>
.
f:: T -> ml::Bool<truth_value>
using T0 = ml::f<
ml::CountIf<ml::IsClass<>>,
int, char, std::string>;
static_assert(
std::is_same_v<T, ml::Int<1>);
using T1 = ml::f<
ml::CountIf<
ml::IsClass<>,
ml::Increment<>>,
int, char, std::string>;
static_assert(
std::is_same_v<T, ml::Int<2>);