Open t-sakashita opened 1 month ago
std::apply
を用いる。
関数の定義:
template<typename TUPLE>
constexpr auto to_array(TUPLE && tuple) {
constexpr auto make_array = [](auto&& ... x) {
return std::array{std::forward<decltype(x)>(x) ... };
};
return std::apply(make_array, std::forward<TUPLE>(tuple));
}
https://stackoverflow.com/questions/10604794/how-do-you-convert-a-homogeneous-stdtuple-to-a-stdarray