kumi v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches

◆ count_if()

template<typename Pred, concepts::product_type T>
std::size_t kumi::count_if ( T && ts,
Pred p )
inlinenodiscardconstexprnoexcept

Counts the number of elements of t satisfying predicates p.

Parameters
tsValue to process
pUnary predicate. p must return a value convertible to bool for every element of t.
Returns
Number of elements satisfying the condition.

Examples:

#include <kumi/kumi.hpp>
#include <iostream>
#include <type_traits>
int main()
{
auto t = kumi::tuple{1, 2., 3.f, 'z'};
std::cout << std::boolalpha
}
constexpr std::size_t count_if(T &&ts, Pred p) noexcept
Counts the number of elements of t satisfying predicates p.
Definition predicates.hpp:125
constexpr auto predicate() noexcept
Convert a unary template meta-program in a running predicate.
Definition ct_helpers.hpp:111
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:29
#include <kumi/kumi.hpp>
#include <iostream>
#include <type_traits>
int main()
{
using namespace kumi::literals;
auto r = kumi::record{"a"_id = 1, "b"_id = 2.,"c"_id = 3.f, "d"_id = 'z'};
std::cout << std::boolalpha
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29