If you change c-array by std::array, you might create a function to create the array:
// const variant omitted.
// C++20
template <typename T, std::size_t N, typename From>
std::array<T, N> make_array_from(std::array<From, N>& froms) {
return [&]<std::size_t... Is>(std::index_sequence<Is...>) {
return std::array<T, N>{{T{froms[Is]}...}};
}(std::make_index_sequence<N>());
}
// C++17
template <typename T, std::size_t N, typename From, std::size_t... Is>
std::array<T, N> make_array_from_impl(std::index_sequence<Is...>, std::array<From, N>& froms) {
return std::array<T, N>{{T{froms[Is]}...}};
}
template <typename T, std::size_t N, typename From>
std::array<T, N> make_array_from(std::array<From, N>& froms) {
return make_array_from_impl(std::make_index_sequence<N>(), froms);
}
With usage
std::array<thing1, 5> stuff{/*..*/};
auto arr = make_array_from<thing2>(stuff);
Demo
thing2 arr[5]{ stuff[0], stuff[1], stuff[2], stuff[3], stuff[4] };