Templa 0.0.1-alpha
C++ Metaprogramming Utilities
Loading...
Searching...
No Matches
templa::algorithms::max_from< e > Struct Template Reference

Computes the maximum value from a container-like object at compile time. More...

#include <algorithms.hpp>

Public Types

using type = typename decltype(e)::value_type
 The type of the elements in the container.

Static Public Attributes

static constexpr std::size_t size = e.size()
 The number of elements in the container.
static constexpr auto value
 The maximum value computed at compile time from the container.

Detailed Description

template<auto e>
requires (concepts::Container<std::remove_cv_t<decltype(e)>>)
struct templa::algorithms::max_from< e >

Computes the maximum value from a container-like object at compile time.

Unpacks a constexpr container (e.g., std::array) and computes the maximum element using the max struct.

Template Parameters
eA container expression with known size and random access. @requires The container must satisfy the concepts::Container constraint.

Member Data Documentation

◆ value

template<auto e>
auto templa::algorithms::max_from< e >::value
staticconstexpr
Initial value:
=
[]<std::size_t... I>(std::index_sequence<I...>) consteval noexcept
{
return max<e[I]...>::value;
}(std::make_index_sequence<size>{})
static constexpr auto value
The maximum value computed at compile time from the container.
Definition algorithms.hpp:244
Computes the maximum value among a pack of compile-time constants.
Definition algorithms.hpp:205

The maximum value computed at compile time from the container.

Internally uses the max struct to evaluate the maximum by unpacking the elements.


The documentation for this struct was generated from the following file: