KUMI v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches
kumi::projection_map< V > Class Template Reference

A stateless, compile-time schema for product type transformation. More...

#include <kumi/utils/projections.hpp>

Detailed Description

template<typename... V>
class kumi::projection_map< V >

A stateless, compile-time schema for product type transformation.

kumi::projection_map reifies the act of indexing or member access into a first-class type-level entity. It defines a sequence of accessors (projections) that can be applied to any kumi::product_type to extract, reorder, or reshape its components.

Because it is a "Meta-Product Type" (a product of accessors), it allows for complex data manipulations (like zipping or partitioning) to be expressed as a single Non-Type Template Parameter (NTTP).

Note
This type is stateless and carries zero runtime data.
Template Parameters
VA pack of elements modeling kumi::concepts::projection.

Examples:

#include <kumi/kumi.hpp>
#include <iostream>
using namespace kumi::literals;
int main()
{
std::cout << kumi::projection_map{0_c, "a"_id} << "\n";
std::cout << kumi::projection_map{0_c, 1_c, kumi::projection_map{2_c, 3_c}} << "\n\n";
// Projections maps can be built from functions in simpler cases
std::cout << kumi::indexes(0_c, 1_c, 2_c) << "\n\n";
std::cout << kumi::identifiers("a"_id, "b"_id) << "\n";
}
consteval auto identifiers(Ts... ts) noexcept
Creates a kumi::projection_map object, deducing the target type from the types of arguments.
Definition projections.hpp:167
consteval auto indexes(Ts... ts) noexcept
Creates a kumi::projection_map object, deducing the target type from the types of arguments.
Definition projections.hpp:127
A stateless, compile-time schema for product type transformation.
Definition projections.hpp:34

Accessors

template<std::size_t I>
constexpr decltype(auto) get (projection_map const &pm) noexcept
 Extracts the Ith element from a kumi::projection_map.

Properties

static constexpr auto size () noexcept
 Returns the number of elements in a kumi::indexes_t.
static constexpr auto empty () noexcept
 Returns true if a kumi::indexes_t contains 0 elements.