Loading [MathJax]/extensions/tex2jax.js
kumi v3.1.0
Exquisite Epidote
 
All Classes Namespaces Functions Variables Friends Modules Pages Concepts
Loading...
Searching...
No Matches

◆ all_of() [2/2]

template<typename Pred , typename T >
constexpr auto kumi::all_of ( T const ts,
Pred  p 
)
constexprnoexcept

Checks if unary predicate p returns true for all 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.

Example:

#include <kumi/tuple.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";
std::cout << std::boolalpha << kumi::all_of( -3.3, [](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 const &ts, Pred p) noexcept
Checks if unary predicate p returns true for all elements in the value t.
Definition predicates.hpp:22
constexpr auto from_tuple(tuple< Ts... > const &t)
Converts a kumi::tuple to an instance of an arbitrary type.
Definition convert.hpp:59
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:35