KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches
kumi::count_if

Callable object counting the number of elements of t satisfying predicates p. More...

Variables

constexpr count_if_t kumi::count_if {}

Detailed Description

Callable object counting the number of elements of t satisfying predicates p.

Variable Documentation

◆ count_if

count_if_t kumi::count_if {}
inlineconstexprnoexcept

On a record type, the function operates on the underlying elements of the fields.

Header file

#include <kumi/kumi.hpp>

Call Signature

namespace kumi
{
template<concepts::product_type T, typename Pred>
constexpr auto count_if(T && t, Pred p) noexcept;
}
constexpr count_if_t count_if
Definition predicates.hpp:344
Main KUMI namespace.
Definition algorithm.hpp:11

Parameters

  • t: Product Type to process
  • p: Unary predicate

Return value

  • Number of elements satisfying the condition.

Examples

  • Tuple
    #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 auto predicate() noexcept
    Convert a unary template meta-program in a running predicate.
    Definition ct_helpers.hpp:154
    Fixed-size collection of heterogeneous values.
    Definition tuple.hpp:35
  • Record
    #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 with distinct labels.
    Definition record.hpp:36