diff --git a/include/gsl/span b/include/gsl/span index 59bd121..d3ff3ca 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -383,9 +383,9 @@ public: constexpr span() noexcept : storage_(nullptr, details::extent_type<0>()) {} - constexpr span(pointer ptr, index_type count) : storage_(ptr, count) {} + constexpr span(pointer ptr, index_type count) noexcept: storage_(ptr, count) {} - constexpr span(pointer firstElem, pointer lastElem) + constexpr span(pointer firstElem, pointer lastElem) noexcept : storage_(firstElem, std::distance(firstElem, lastElem)) {} @@ -424,7 +424,7 @@ public: std::is_convertible::value && std::is_convertible().data())>::value>> - constexpr span(Container& cont) : span(cont.data(), narrow(cont.size())) + constexpr span(Container& cont) noexcept : span(cont.data(), narrow(cont.size())) {} template ::value && std::is_convertible().data())>::value>> - constexpr span(const Container& cont) : span(cont.data(), narrow(cont.size())) + constexpr span(const Container& cont) noexcept : span(cont.data(), narrow(cont.size())) {} constexpr span(const span& other) noexcept = default; @@ -443,7 +443,7 @@ public: class = std::enable_if_t< details::is_allowed_extent_conversion::value && details::is_allowed_element_type_conversion::value>> - constexpr span(const span& other) + constexpr span(const span& other) noexcept : storage_(other.data(), details::extent_type(other.size())) {} @@ -452,7 +452,7 @@ public: // [span.sub], span subviews template - constexpr span first() const + constexpr span first() const noexcept { Expects(Count >= 0 && Count <= size()); return {data(), Count}; @@ -460,7 +460,7 @@ public: template GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute - constexpr span last() const + constexpr span last() const noexcept { Expects(Count >= 0 && size() - Count >= 0); return {data() + (size() - Count), Count}; @@ -468,7 +468,7 @@ public: template GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute - constexpr auto subspan() const -> + constexpr auto subspan() const noexcept -> typename details::calculate_subspan_type::type { Expects((Offset >= 0 && size() - Offset >= 0) && @@ -477,19 +477,19 @@ public: return {data() + Offset, Count == dynamic_extent ? size() - Offset : Count}; } - constexpr span first(index_type count) const + constexpr span first(index_type count) const noexcept { Expects(count >= 0 && count <= size()); return {data(), count}; } - constexpr span last(index_type count) const + constexpr span last(index_type count) const noexcept { return make_subspan(size() - count, dynamic_extent, subspan_selector{}); } constexpr span subspan(index_type offset, - index_type count = dynamic_extent) const + index_type count = dynamic_extent) const noexcept { return make_subspan(offset, count, subspan_selector{}); } @@ -504,14 +504,14 @@ public: // [span.elem], span element access GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute - constexpr reference operator[](index_type idx) const + constexpr reference operator[](index_type idx) const noexcept { Expects(CheckRange(idx, storage_.size())); return data()[idx]; } - constexpr reference at(index_type idx) const { return this->operator[](idx); } - constexpr reference operator()(index_type idx) const { return this->operator[](idx); } + constexpr reference at(index_type idx) const noexcept{ return this->operator[](idx); } + constexpr reference operator()(index_type idx) const noexcept{ return this->operator[](idx); } constexpr pointer data() const noexcept { return storage_.data(); } // [span.iter], span iterator support