#pragma once #include #include #include #include #include #include namespace mbgl { namespace util { template constexpr std::array convert(const std::array& from) requires(std::is_convertible_v) { std::array to{{}}; std::copy(std::begin(from), std::end(from), std::begin(to)); return to; } template constexpr std::array cast(const std::array& from) requires(std::is_assignable_v) { std::array to{{}}; std::transform(std::begin(from), std::end(from), std::begin(to), [](From x) { return static_cast(x); }); return to; } /// Convert an `N`-tuple of all `T`s to `array` template inline constexpr auto to_array(std::tuple&& tuple) { return std::apply([](auto&&... x) { return std::array{std::forward(x)...}; }, std::forward>(tuple)); } } // namespace util } // namespace mbgl