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

Callable object checking if a unary predicate p returns true for any element of t. More...

Variables

constexpr any_of_t kumi::any_of {}

Detailed Description

Callable object checking if a unary predicate p returns true for any element of t.

Variable Documentation

◆ any_of

any_of_t kumi::any_of {}
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 any_of(T && t, Pred p) noexcept;
template<concepts::product_type T, typename Pred>
constexpr auto any_of(T && t) noexcept;
}
constexpr any_of_t any_of
Definition predicates.hpp:231
Main KUMI namespace.
Definition algorithm.hpp:11

Parameters

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

Return value

  • The evaluation of p(get<0>(t)) || ... || p(get<N-1>(t)) where N is the size of t.

Examples

  • Tuple
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    auto t = kumi::tuple{1,2.,3.f};
    std::cout << std::boolalpha << kumi::any_of( t, [](auto e) { return e == 2; }) << "\n";
    auto u = kumi::tuple{true,false,true,false};
    std::cout << std::boolalpha << kumi::any_of(u) << "\n";
    }
    Fixed-size collection of heterogeneous values.
    Definition tuple.hpp:35
  • Record
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    using namespace kumi::literals;
    auto r = kumi::record{"a"_id = 1,"b"_id = 2.,"c"_id = 3.f};
    std::cout << std::boolalpha << kumi::any_of( r, [](auto e) { return e == 2; }) << "\n";
    auto u = kumi::record{"a"_id = true,"b"_id = false,"c"_id = true,"d"_id = false};
    std::cout << std::boolalpha << kumi::any_of(u) << "\n";
    }
    Fixed-size collection of heterogeneous fields with distinct labels.
    Definition record.hpp:36