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

◆ max

max_t kumi::max {}
inlineconstexprnodiscardnoexcept

Callable object computing the maximum value of all elements of t.

Header file

#include <kumi/algorithm/minmax.hpp>

Call Signature

template<product_type T>
constexpr auto max(T && t) noexcept;
constexpr max_t max
Callable object computing the maximum value of all elements of t.
Definition minmax.hpp:174
template<product_type T, typename Function>
constexpr auto max(T && t, Function f) noexcept;

Parameters

  • t: Product Type to inspect
  • f: Unary callable object to be invoked

Return value

  • The maximum value of all elements of t

Helper type

template<typename T, typename F = void> struct max
{
using type = decltype(kumi::max(std::declval<T>(), std::declval<F>()));
};
template<typename T> struct max<T, void>
{
using type = decltype(kumi::max(std::declval<T>()));
};
template<typename T, typename F = void> using max_t = typename kumi::result::max<T, F>::type;

Computes the return type of a call to kumi::max

Examples

Tuple

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto f0 = kumi::tuple {1, 'A', 99.77f, 3. };
auto f1 = kumi::tuple {2., f0, 3.f };
std::cout << kumi::max(f0) << "\n";
std::cout << kumi::max(f1, [](auto m) { return sizeof(m); }) << "\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 f0 = kumi::record {"a"_id = 1, "b"_id = 'A', "c"_id = 99.77f, "d"_id = 3. };
auto f1 = kumi::record {"a"_id = 2., "b"_id = f0, "c"_id = 3.f };
std::cout << kumi::max(f0) << "\n";
std::cout << kumi::max(f1, [](auto m) { return sizeof(m); }) << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36