mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Fixed conversion problem when creating strided_span from span and bounds
This commit is contained in:
parent
4552575e34
commit
c95eb57d3f
@ -1610,8 +1610,12 @@ public:
|
||||
{}
|
||||
|
||||
// from array view
|
||||
template <std::ptrdiff_t... Dimensions, typename Dummy = std::enable_if<sizeof...(Dimensions) == Rank>>
|
||||
constexpr strided_span(span<ValueType, Dimensions...> av, bounds_type bounds) : strided_span(av.data(), av.bounds().total_size(), std::move(bounds))
|
||||
template <typename OtherValueType, std::ptrdiff_t... Dimensions,
|
||||
bool Enabled1 = (sizeof...(Dimensions) == Rank),
|
||||
bool Enabled2 = std::is_convertible<OtherValueType*, ValueType*>::value,
|
||||
typename Dummy = std::enable_if_t<Enabled1 && Enabled2>
|
||||
>
|
||||
constexpr strided_span(span<OtherValueType, Dimensions...> av, bounds_type bounds) : strided_span(av.data(), av.bounds().total_size(), std::move(bounds))
|
||||
{}
|
||||
|
||||
// convertible
|
||||
|
@ -333,7 +333,7 @@ SUITE(span_tests)
|
||||
CHECK(sav_c[1] == 2);
|
||||
|
||||
#if _MSC_VER > 1800
|
||||
strided_span<volatile int, 1> sav_v{ {src}, {2, 1} };
|
||||
strided_span<volatile int, 1> sav_v{ src, {2, 1} };
|
||||
#else
|
||||
strided_span<volatile int, 1> sav_v{ span<volatile int>{src}, strided_bounds<1>{2, 1} };
|
||||
#endif
|
||||
@ -342,7 +342,7 @@ SUITE(span_tests)
|
||||
CHECK(sav_v[1] == 2);
|
||||
|
||||
#if _MSC_VER > 1800
|
||||
strided_span<const volatile int, 1> sav_cv{ {src}, {2, 1} };
|
||||
strided_span<const volatile int, 1> sav_cv{ src, {2, 1} };
|
||||
#else
|
||||
strided_span<const volatile int, 1> sav_cv{ span<const volatile int>{src}, strided_bounds<1>{2, 1} };
|
||||
#endif
|
||||
@ -361,7 +361,7 @@ SUITE(span_tests)
|
||||
CHECK(sav_c[1] == 2);
|
||||
|
||||
#if _MSC_VER > 1800
|
||||
strided_span<const volatile int, 1> sav_cv{ {src}, {2, 1} };
|
||||
strided_span<const volatile int, 1> sav_cv{ src, {2, 1} };
|
||||
#else
|
||||
strided_span<const volatile int, 1> sav_cv{ span<const volatile int>{src}, strided_bounds<1>{2, 1} };
|
||||
#endif
|
||||
@ -381,7 +381,7 @@ SUITE(span_tests)
|
||||
CHECK(sav_v[1] == 2);
|
||||
|
||||
#if _MSC_VER > 1800
|
||||
strided_span<const volatile int, 1> sav_cv{ {src}, {2, 1} };
|
||||
strided_span<const volatile int, 1> sav_cv{ src, {2, 1} };
|
||||
#else
|
||||
strided_span<const volatile int, 1> sav_cv{ span<const volatile int>{src}, strided_bounds<1>{2, 1} };
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user