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

Reverses the elements of a constexpr container at compile time. More...

#include <algorithms.hpp>

Static Public Attributes

static constexpr auto reverse_sequence
 The reversed version of the input container.

Detailed Description

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

Reverses the elements of a constexpr container at compile time.

Accepts a container expression (e.g., std::array) and constructs a new one with the elements in reversed order.

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

Member Data Documentation

◆ reverse_sequence

template<auto a>
auto templa::algorithms::reverse_from< a >::reverse_sequence
staticconstexpr
Initial value:
= []<std::size_t... I>(std::index_sequence<I...>)
{
constexpr decltype(a) ret{old[a.size() - I - 1]...};
return ret;
}(std::make_index_sequence<a.size()>{})

The reversed version of the input container.

Constructs a new container by indexing from the end of the original container.


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