Finished integrating CaseyCarter's changes into span

This commit is contained in:
Jordan Maples 2020-05-20 13:37:42 -07:00
parent ed3fea6d93
commit 1e44481646
2 changed files with 5 additions and 5 deletions

View File

@ -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>

View File

@ -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);