From 1e444816463196b1dbf6eeb8b6cb7c797d4c9c11 Mon Sep 17 00:00:00 2001 From: Jordan Maples Date: Wed, 20 May 2020 13:37:42 -0700 Subject: [PATCH] Finished integrating CaseyCarter's changes into span --- include/gsl/span | 6 +++--- tests/span_tests.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/gsl/span b/include/gsl/span index 1cb9e84..fcc74aa 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -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::value, int> = 0> constexpr span(const span& other) noexcept : storage_(other.data(), details::extent_type(other.size())) @@ -542,7 +542,7 @@ public: constexpr span first() const noexcept { Expects(Count <= size()); - return span(data(), Count); + return span{data(), Count}; } template @@ -552,7 +552,7 @@ public: constexpr span last() const noexcept { Expects(Count <= size()); - return span(data() + (size() - Count), Count); + return span{data() + (size() - Count), Count}; } template diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index ae4503e..44198a6 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1144,7 +1144,7 @@ TEST(span_test, from_array_constructor) // you can convert statically { - const span s2(&arr[0], 2); + const span s2{&arr[0], 2}; static_cast(s2); } { @@ -1180,7 +1180,7 @@ TEST(span_test, from_array_constructor) #endif { auto f = [&]() { - const span _s4(arr2, 2); + span _s4{arr2, 2}; static_cast(_s4); }; EXPECT_DEATH(f(), deathstring);