koutil
Loading...
Searching...
No Matches
array_concat.h
Go to the documentation of this file.
1#ifndef KOUTIL_TYPE_ARRAY_CONCAT_H
2#define KOUTIL_TYPE_ARRAY_CONCAT_H
3
4#include <array>
5#include <cstddef>
6#include <tuple>
7#include <utility>
8
9namespace koutil::type {
10
19template <typename T, std::size_t... Sizes> constexpr auto array_concat(const std::array<T, Sizes>&... arrays) {
20 constexpr std::size_t size = (Sizes + ...);
21
22 auto all = std::tuple_cat(arrays...);
23
24 return [&]<std::size_t... I>(std::index_sequence<I...>) {
25 return std::array<T, size> { { std::get<I>(all)... } };
26 }(std::make_index_sequence<size>());
27}
28
29}
30
31#endif
Definition array_concat.h:9
constexpr auto array_concat(const std::array< T, Sizes > &... arrays)
Concatenates multiple arrays into one array.
Definition array_concat.h:19