From 7e4ed8da9892de9337b52b29bfffd016f18072cd Mon Sep 17 00:00:00 2001 From: Jordan Maples Date: Wed, 20 May 2020 16:50:50 -0700 Subject: [PATCH] addressing Stephan's comments --- include/gsl/span | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/include/gsl/span b/include/gsl/span index aff06ac..4681465 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -343,9 +343,9 @@ namespace details constexpr extent_type() noexcept = default; - explicit constexpr extent_type(extent_type); + constexpr explicit extent_type(extent_type); - explicit constexpr extent_type(size_type size) { Expects(size == Ext); } + constexpr explicit extent_type(size_type size) { Expects(size == Ext); } constexpr size_type size() const noexcept { return Ext; } }; @@ -357,10 +357,10 @@ namespace details using size_type = std::size_t; template - explicit constexpr extent_type(extent_type ext) : size_(ext.size()) + constexpr explicit extent_type(extent_type ext) : size_(ext.size()) {} - explicit constexpr extent_type(size_type size) : size_(size) + constexpr explicit extent_type(size_type size) : size_(size) { Expects(size != dynamic_extent); } @@ -420,24 +420,24 @@ public: constexpr span() noexcept : storage_(nullptr, details::extent_type<0>()) {} - template = 0> + template = 0> constexpr explicit span(pointer ptr, size_type count) noexcept : storage_(ptr, count) { Expects(count == Extent); } - template = 0> + template = 0> constexpr span(pointer ptr, size_type count) noexcept : storage_(ptr, count) {} - template = 0> + template = 0> constexpr explicit span(pointer firstElem, pointer lastElem) noexcept : storage_(firstElem, static_cast(lastElem - firstElem)) { Expects(lastElem - firstElem == static_cast(Extent)); } - template = 0> + template = 0> constexpr span(pointer firstElem, pointer lastElem) noexcept : storage_(firstElem, static_cast(lastElem - firstElem)) {} @@ -517,18 +517,18 @@ public: constexpr span(const span& other) noexcept = default; template < - class OtherElementType, std::size_t OtherExtent, std::size_t SpanExtent = Extent, + class OtherElementType, std::size_t OtherExtent, std::size_t MyExtent = Extent, std::enable_if_t< - (SpanExtent == dynamic_extent || SpanExtent == OtherExtent) && + (MyExtent == dynamic_extent || MyExtent == OtherExtent) && details::is_allowed_element_type_conversion::value, int> = 0> constexpr span(const span& other) noexcept : storage_(other.data(), details::extent_type(other.size())) {} template < - class OtherElementType, std::size_t OtherExtent, std::size_t SpanExtent = Extent, + class OtherElementType, std::size_t OtherExtent, std::size_t MyExtent = Extent, std::enable_if_t< - SpanExtent != dynamic_extent && OtherExtent == dynamic_extent && + MyExtent != dynamic_extent && OtherExtent == dynamic_extent && details::is_allowed_element_type_conversion::value, int> = 0> constexpr explicit span(const span& other) noexcept : storage_(other.data(), details::extent_type(other.size())) @@ -564,7 +564,7 @@ public: { Expects((size() >= Offset) && (Count == dynamic_extent || (Count <= size() - Offset))); using type = typename details::calculate_subspan_type::type; - return type(data() + Offset, Count == dynamic_extent ? size() - Offset : Count); + return type{data() + Offset, Count == dynamic_extent ? size() - Offset : Count}; } constexpr span first(size_type count) const noexcept @@ -775,8 +775,8 @@ as_bytes(span s) noexcept // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute // clang-format on - return span::value>( - reinterpret_cast(s.data()), s.size_bytes()); + using type = span::value>; + return type{reinterpret_cast(s.data()), s.size_bytes()}; } template s) noexcept // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute // clang-format on - return span::value>( - reinterpret_cast(s.data()), s.size_bytes()); + using type = span::value>; + return type{reinterpret_cast(s.data()), s.size_bytes()}; } } // namespace gsl