rewrite operators in iterator to take advantage of nrvo

This commit is contained in:
Jordan Maples [MSFT] 2020-02-18 15:36:15 -08:00
parent f4c608fd39
commit 46603698ec

View File

@ -199,7 +199,8 @@ namespace details
constexpr span_iterator operator+(const difference_type n) const noexcept constexpr span_iterator operator+(const difference_type n) const noexcept
{ {
span_iterator ret = *this; span_iterator ret = *this;
return ret += n; ret += n;
return ret;
} }
friend constexpr span_iterator operator+(const difference_type n, 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 constexpr span_iterator operator-(const difference_type n) const noexcept
{ {
span_iterator ret = *this; span_iterator ret = *this;
return ret -= n; ret -= n;
return ret;
} }
template < template <
@ -343,8 +345,6 @@ namespace details
public: public:
using size_type = std::size_t; 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; constexpr extent_type() noexcept = default;
template <size_type Other> template <size_type Other>