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

◆ any_of() [2/2]

template<typename Pred, concepts::product_type T>
auto kumi::any_of ( T && ts,
Pred p )
inlinenodiscardconstexprnoexcept

Checks if unary predicate p returns true for any elements in the value t.

Parameters
tsValue to process.
pUnary predicate.
Returns
The evaluation of p(get<0>(ts)) || ... || p(get<N-1>(ts)) where N is the size of ts.

Examples:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto t = kumi::tuple{1,2.,3.f};
std::cout << std::boolalpha << kumi::all_of( t, [](auto e) { return e < 5; }) << "\n";
auto u = kumi::tuple{true,false,true,false};
std::cout << std::boolalpha << kumi::all_of(u) << "\n";
}
constexpr auto all_of(T &&ts, Pred p) noexcept
Checks if unary predicate p returns true for all elements in the value t.
Definition predicates.hpp:23
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:29
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto t = kumi::record{"a"_id = 1,"b"_id = 2.,"c"_id = 3.f};
std::cout << std::boolalpha << kumi::all_of( t, [](auto e) { return e < 5; }) << "\n";
auto u = kumi::record{"a"_id = true,"b"_id = false,"c"_id = true, "d"_id = false};
std::cout << std::boolalpha << kumi::all_of(u) << "\n";
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29