KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ all_of

all_of_t kumi::all_of {}
inlineconstexprnoexcept

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

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

Header file

#include <kumi/algorithm/predicates.hpp>

Call Signature

template<product_type T, typename Pred>
constexpr auto all_of(T && t, Pred p) noexcept;
constexpr all_of_t all_of
Callable object checking if a unary predicate p returns true for every element of t.
Definition predicates.hpp:157
template<product_type T, typename Pred>
constexpr auto all_of(T && t) noexcept;

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::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";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33

Record

#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 tagged fields, tags are unique.
Definition record.hpp:36