template <typename Predicate, typename Pipe = ml::Identity>
struct FindIdIf {
template <typename ...Ts>
using f = /* .... */;
};
FindIdIf<Predicate, Pipe>
is a metafunction that passes to Pipe
the index ml::Int
<index>
of the first element of the parameter pack Ts...
, for which the predicate holds. Pipe
defaults to ml::Identity
.
f:: Ts... -> ml::Int<index> >-> Pipe
Predicate must be a metafunction returning ml::Bool<truth_value>
.
f:: T -> ml::Bool<truth_value>
using T0 = ml::f<
ml::FindIdIf<ml::IsClass<>>,
int, char, std::string>;
static_assert(
std::is_same_v<
T, ml::Int<2>>);
using T1 = ml::f<
ml::FindIdIf<
ml::IsClass<ml::Not<>>>,
int, char, std::string>;
static_assert(
std::is_same_v<
T, ml::Int<0>>);