Skip to content

Commit

Permalink
Try to make gcc 8 work
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed May 16, 2024
1 parent aea7de3 commit 9d9d1d5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,14 @@ namespace libassert::detail {
}
};

// copied from cppref
template<typename T, std::size_t N, std::size_t... I>
constexpr std::array<std::remove_cv_t<T>, N> to_array_impl(T(&&a)[N], std::index_sequence<I...>) {
// note: the use of U here is mainly to workaround a gcc 8 issue https://godbolt.org/z/bdsWhdGj3
template<typename T, typename U, std::size_t N, std::size_t... I>
constexpr std::array<std::remove_cv_t<T>, N> to_array_impl(U(&&a)[N], std::index_sequence<I...>) {
return {{std::move(a[I])...}};
}

template<typename T, std::size_t N>
constexpr std::array<std::remove_cv_t<T>, N> to_array(T(&&a)[N]) {
return to_array_impl(std::move(a), std::make_index_sequence<N>{});
template<typename T, typename U, std::size_t N>
constexpr std::array<std::remove_cv_t<T>, N> to_array(U(&&a)[N]) {
return to_array_impl<T>(std::move(a), std::make_index_sequence<N>{});
}

template<typename A, typename B>
Expand Down

0 comments on commit 9d9d1d5

Please sign in to comment.