Try to get make_array to compile with older compiler version

This commit is contained in:
Maxime Coste 2017-08-18 07:45:38 +07:00
parent b807731468
commit e0e9b8bae4

View File

@ -25,17 +25,16 @@ struct Array
}; };
template<typename T, size_t N, size_t... Indices> template<typename T, size_t N, size_t... Indices>
constexpr Array<T, N> make_array(T (&&data)[N], std::index_sequence<Indices...>) constexpr Array<T, N> make_array(const T (&data)[N], std::index_sequence<Indices...>)
{ {
static_assert(sizeof...(Indices) == N, "size mismatch"); static_assert(sizeof...(Indices) == N, "size mismatch");
return {{data[Indices]...}}; return {{data[Indices]...}};
} }
template<typename T, size_t N> template<typename T, size_t N>
constexpr Array<T, N> make_array(T (&&data)[N]) constexpr Array<T, N> make_array(const T (&data)[N])
{ {
return make_array(std::forward<decltype(data)>(data), return make_array(data, std::make_index_sequence<N>());
std::make_index_sequence<N>());
} }
} }