#pragma once #include // PETSC_DECLTYPE_NOEXCEPT_AUTO_RETURNS #include // index_sequence #include #include namespace Petsc { namespace util { namespace detail { template struct return_type_helper { using type = D; }; template struct return_type_helper : std::common_type { }; template using array_return_type = std::array::type, sizeof...(T)>; template inline constexpr std::array concat_array_impl(const std::array &l, const std::array &r, index_sequence, index_sequence) noexcept(std::is_nothrow_copy_constructible::value) { return {l[IL]..., r[IR]...}; } } // namespace detail template PETSC_NODISCARD inline constexpr detail::array_return_type make_array(T &&...t) noexcept(std::is_nothrow_constructible>::value) { return {std::forward(t)...}; } template PETSC_NODISCARD inline constexpr auto concat_array(const std::array &l, const std::array &r) PETSC_DECLTYPE_NOEXCEPT_AUTO_RETURNS(detail::concat_array_impl(l, r, make_index_sequence{}, make_index_sequence{})) } // namespace util } // namespace Petsc