mirror of
https://github.com/microsoft/GSL.git
synced 2025-01-18 17:55:01 -05:00
Finished integrating CaseyCarter's changes into span
This commit is contained in:
parent
ed3fea6d93
commit
1e44481646
@ -519,7 +519,7 @@ public:
|
||||
template <
|
||||
class OtherElementType, std::size_t OtherExtent, std::size_t SpanExtent = Extent,
|
||||
std::enable_if_t<
|
||||
(SpanExtent == dynamic_extent || OtherExtent == dynamic_extent) &&
|
||||
(SpanExtent == dynamic_extent || SpanExtent == OtherExtent) &&
|
||||
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value, int> = 0>
|
||||
constexpr span(const span<OtherElementType, OtherExtent>& other) noexcept
|
||||
: storage_(other.data(), details::extent_type<OtherExtent>(other.size()))
|
||||
@ -542,7 +542,7 @@ public:
|
||||
constexpr span<element_type, Count> first() const noexcept
|
||||
{
|
||||
Expects(Count <= size());
|
||||
return span<element_type, Count>(data(), Count);
|
||||
return span<element_type, Count>{data(), Count};
|
||||
}
|
||||
|
||||
template <std::size_t Count>
|
||||
@ -552,7 +552,7 @@ public:
|
||||
constexpr span<element_type, Count> last() const noexcept
|
||||
{
|
||||
Expects(Count <= size());
|
||||
return span<element_type, Count>(data() + (size() - Count), Count);
|
||||
return span<element_type, Count>{data() + (size() - Count), Count};
|
||||
}
|
||||
|
||||
template <std::size_t Offset, std::size_t Count = dynamic_extent>
|
||||
|
@ -1144,7 +1144,7 @@ TEST(span_test, from_array_constructor)
|
||||
|
||||
// you can convert statically
|
||||
{
|
||||
const span<int, 2> s2(&arr[0], 2);
|
||||
const span<int, 2> s2{&arr[0], 2};
|
||||
static_cast<void>(s2);
|
||||
}
|
||||
{
|
||||
@ -1180,7 +1180,7 @@ TEST(span_test, from_array_constructor)
|
||||
#endif
|
||||
{
|
||||
auto f = [&]() {
|
||||
const span<int, 4> _s4(arr2, 2);
|
||||
span<int, 4> _s4{arr2, 2};
|
||||
static_cast<void>(_s4);
|
||||
};
|
||||
EXPECT_DEATH(f(), deathstring);
|
||||
|
Loading…
Reference in New Issue
Block a user