KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches

Callable object creating a tuple of product types, each containing N consecutive elements from t. Tiles starts at 0 and advance by O element each time. More...

Variables

template<std::size_t N, std::size_t O>
constexpr tiles_t< N, O > kumi::tiles {}

Detailed Description

Callable object creating a tuple of product types, each containing N consecutive elements from t. Tiles starts at 0 and advance by O element each time.

Variable Documentation

◆ tiles

template<std::size_t N, std::size_t O>
tiles_t<N, O> kumi::tiles {}
inlineconstexprnodiscard

On record types, this function operates on elements as if they were ordered. The considered order is the order of declaration.

Note
Tiles is the most general form of tiling each inner product_type is a tile over t starting at index tile_size * tile_number. The last tile will be smaller if the size of the product type is not a multiple of the tile size.

Header file

#include <kumi/kumi.hpp>

Call Signature

namespace kumi
{
template<std::size_t N, std::size_t O, concepts::product_type T>
constexpr auto tiles(T && t);
}
constexpr tiles_t< N, O > tiles
Definition tiler.hpp:106
Main KUMI namespace.
Definition algorithm.hpp:11

Template Parameters

  • N: Size of the tile to generate
  • O: Offset from the beginning of the previous tile

Parameters

  • t: Product Type from which to extract the tiles

Return value

  • A tuple of product types, each containing N consecutive elements of t offset by O

Helper type

template<std::size_t N, std::size_t O, kumi::concepts::product_type T>
using tiles_t = decltype(kumi::tiles<N, O>(kumi::declval<T>()));
template<std::size_t N, std::size_t O, kumi::concepts::product_type T> struct tiles
{
using type = kumi::result::tiles_t<N, O, T>;
};

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

Examples

  • Tuple
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    auto t = kumi::tuple{1, 'y', 3.f, short{55}, -8, 66., "Pete"};
    auto w = kumi::tiles<2,3>(t);
    std::cout << " Standard Tiles" << "\n";
    std::cout << w << "\n";
    kumi::for_each([&](auto tile)
    {
    get<0>(tile)++;
    },w);
    std::cout << t << "\n";
    std::cout << " Tiles with references " << "\n";
    std::cout << w2 << "\n";
    kumi::for_each([&](auto tile)
    {
    get<0>(tile)++;
    },w2);
    std::cout << t << "\n";
    }
    constexpr for_each_t for_each
    Definition for_each.hpp:141
    constexpr to_ref_t to_ref
    Definition tuple.hpp:722
    Fixed-size collection of heterogeneous values.
    Definition tuple.hpp:35
  • Record
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    using namespace kumi::literals;
    auto r = kumi::record{"a"_id = 1, "b"_id = 'y', "c"_id = 3.f, "d"_id = short{55}
    ,"e"_id = -8, "f"_id = 66., "g"_id = "Pete"};
    auto w = kumi::tiles<2,3>(r);
    std::cout << " Standard Tiles" << "\n";
    std::cout << w << "\n";
    kumi::for_each([&](auto tile)
    {
    },w);
    std::cout << r << "\n";
    std::cout << " Tiles with references " << "\n";
    std::cout << w2 << "\n";
    kumi::for_each([&](auto tile)
    {
    },w2);
    std::cout << r << "\n";
    }
    constexpr values_of_t values_of
    Definition tuple.hpp:1049
    decltype(auto) constexpr get(array< T, N > &t) noexcept
    Extracts the Ith element from a kumi::array.
    Definition array.hpp:672
    Fixed-size collection of heterogeneous fields with distinct labels.
    Definition record.hpp:36