Creates a tuple of product types, each containing N consecutive elements from t. Windows starts at 0 and advance by 1 element each time.
On record types, this function operates on elements as if they were ordered. The considered order is the order of declaration.
- Template Parameters
-
| N | Size of the window to generate |
- Parameters
-
| t | the product type from which to extract the windows |
- Returns
- A tuple of product types, each containing N consecutive elements of t
- Note
- Windows behaves like overlapping tiles: each inner product_type is a tile over t starting at index tile_number. All the windows are of the same size.
Helper type
namespace kumi::result
{
template<std::
size_t N, product_type T>
struct windows;
template<std::size_t N, product_type T>
}
constexpr auto windows(T &&t)
Creates a tuple of product types, each containing N consecutive elements from t. Windows starts at 0 ...
Definition tiler.hpp:48
Computes the return type of a call to kumi::windows
Examples:
Tuple:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto t =
kumi::tuple{1,
'y', 3.f,
short{55}, -8, 66.,
"Pete"};
std::cout << " Standard Windows " << "\n";
std::cout << w << "\n";
{
get<0>(tile)++;
},w);
std::cout << t << "\n";
std::cout << " Windows with references " << "\n";
std::cout << w2 << "\n";
{
get<0>(tile)++;
},w2);
std::cout << t << "\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 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"};
std::cout << " Standard Windows " << "\n";
std::cout << w << "\n";
{
},w);
std::cout << r << "\n";
std::cout << " Windows with references " << "\n";
std::cout << w2 << "\n";
{
},w2);
std::cout << r << "\n";
}
constexpr auto values_of(T &&t) noexcept
Extracts the values of the fields of a product type.
Definition meta.hpp:54
decltype(auto) constexpr get(record< Ts... > &r) noexcept
Extracts the Ith field from a kumi::record.
Definition record.hpp:604
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36