Removed span.length() as synonym for span.size().

This commit is contained in:
Neil MacIntosh
2018-02-10 18:58:28 -08:00
parent 9ed6ecc4e0
commit 72688ff009
3 changed files with 126 additions and 128 deletions
+8 -10
View File
@@ -128,7 +128,7 @@ namespace details
constexpr span_iterator(const Span* span, typename Span::index_type index) GSL_NOEXCEPT
: span_(span), index_(index)
{
Expects(span == nullptr || (0 <= index_ && index <= span_->length()));
Expects(span == nullptr || (0 <= index_ && index <= span_->size()));
}
friend span_iterator<Span, true>;
@@ -140,19 +140,19 @@ namespace details
constexpr reference operator*() const GSL_NOEXCEPT
{
Expects(index_ != span_->length());
Expects(index_ != span_->size());
return *(span_->data() + index_);
}
constexpr pointer operator->() const GSL_NOEXCEPT
{
Expects(index_ != span_->length());
Expects(index_ != span_->size());
return span_->data() + index_;
}
constexpr span_iterator& operator++() GSL_NOEXCEPT
{
Expects(0 <= index_ && index_ != span_->length());
Expects(0 <= index_ && index_ != span_->size());
++index_;
return *this;
}
@@ -166,7 +166,7 @@ namespace details
constexpr span_iterator& operator--() GSL_NOEXCEPT
{
Expects(index_ != 0 && index_ <= span_->length());
Expects(index_ != 0 && index_ <= span_->size());
--index_;
return *this;
}
@@ -186,7 +186,7 @@ namespace details
constexpr span_iterator& operator+=(difference_type n) GSL_NOEXCEPT
{
Expects((index_ + n) >= 0 && (index_ + n) <= span_->length());
Expects((index_ + n) >= 0 && (index_ + n) <= span_->size());
index_ += n;
return *this;
}
@@ -461,9 +461,7 @@ public:
// [span.obs], span observers
constexpr index_type length() const GSL_NOEXCEPT { return size(); }
constexpr index_type size() const GSL_NOEXCEPT { return storage_.size(); }
constexpr index_type length_bytes() const GSL_NOEXCEPT { return size_bytes(); }
constexpr index_type size_bytes() const GSL_NOEXCEPT
{
return size() * narrow_cast<index_type>(sizeof(element_type));
@@ -483,10 +481,10 @@ public:
// [span.iter], span iterator support
constexpr iterator begin() const GSL_NOEXCEPT { return {this, 0}; }
constexpr iterator end() const GSL_NOEXCEPT { return {this, length()}; }
constexpr iterator end() const GSL_NOEXCEPT { return {this, size()}; }
constexpr const_iterator cbegin() const GSL_NOEXCEPT { return {this, 0}; }
constexpr const_iterator cend() const GSL_NOEXCEPT { return {this, length()}; }
constexpr const_iterator cend() const GSL_NOEXCEPT { return {this, size()}; }
constexpr reverse_iterator rbegin() const GSL_NOEXCEPT { return reverse_iterator{end()}; }
constexpr reverse_iterator rend() const GSL_NOEXCEPT { return reverse_iterator{begin()}; }
+1 -1
View File
@@ -145,7 +145,7 @@ template <class Cont>
span<typename std::remove_pointer<typename Cont::pointer>::type, dynamic_extent>
ensure_z(Cont& cont)
{
return ensure_z(cont.data(), static_cast<std::ptrdiff_t>(cont.length()));
return ensure_z(cont.data(), static_cast<std::ptrdiff_t>(cont.size()));
}
template <typename CharT, std::ptrdiff_t>