From 46603698ec9a37b07c2a39926c47cb465bda0aa8 Mon Sep 17 00:00:00 2001 From: "Jordan Maples [MSFT]" <49793787+JordanMaples@users.noreply.github.com> Date: Tue, 18 Feb 2020 15:36:15 -0800 Subject: [PATCH] rewrite operators in iterator to take advantage of nrvo --- include/gsl/span | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/gsl/span b/include/gsl/span index e3ea0db..0d8dcb0 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -199,7 +199,8 @@ namespace details constexpr span_iterator operator+(const difference_type n) const noexcept { span_iterator ret = *this; - return ret += n; + ret += n; + return ret; } friend constexpr span_iterator operator+(const difference_type n, @@ -220,7 +221,8 @@ namespace details constexpr span_iterator operator-(const difference_type n) const noexcept { span_iterator ret = *this; - return ret -= n; + ret -= n; + return ret; } template < @@ -343,8 +345,6 @@ namespace details public: using size_type = std::size_t; - static_assert(Ext != dynamic_extent, "A fixed-size span must not have size == dynamic_extent"); - constexpr extent_type() noexcept = default; template