mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Fix multi_span constructor taking a const std::array. (#523)
not called even by the unit test (it was calling the "container" ctor instead). I mimicked the constructor taking a non-const std::array to fix the issue.
This commit is contained in:
parent
1cfb241be7
commit
010ab921bf
@ -1332,10 +1332,10 @@ public:
|
|||||||
|
|
||||||
// construct from const std::array
|
// construct from const std::array
|
||||||
template <typename T, std::size_t N>
|
template <typename T, std::size_t N>
|
||||||
constexpr multi_span(const std::array<std::remove_const_t<value_type>, N>& arr)
|
constexpr multi_span(const std::array<T, N>& arr)
|
||||||
: multi_span(arr.data(), static_bounds<N>())
|
: multi_span(arr.data(), bounds_type{static_bounds<N>{}})
|
||||||
{
|
{
|
||||||
static_assert(std::is_convertible<T(*)[], std::remove_const_t<value_type>>::value,
|
static_assert(std::is_convertible<T(*)[], typename std::remove_const_t<value_type>(*)[]>::value,
|
||||||
"Cannot convert from source type to target multi_span type.");
|
"Cannot convert from source type to target multi_span type.");
|
||||||
static_assert(std::is_convertible<static_bounds<N>, bounds_type>::value,
|
static_assert(std::is_convertible<static_bounds<N>, bounds_type>::value,
|
||||||
"You cannot construct a multi_span from a std::array of smaller size.");
|
"You cannot construct a multi_span from a std::array of smaller size.");
|
||||||
|
Loading…
Reference in New Issue
Block a user