|
|
@ -292,60 +292,74 @@ class Span { |
|
|
|
|
|
|
|
|
|
|
|
// Span::front()
|
|
|
|
// Span::front()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a reference to the first element of this span.
|
|
|
|
// Returns a reference to the first element of this span. The span must not
|
|
|
|
|
|
|
|
// be empty.
|
|
|
|
constexpr reference front() const noexcept { |
|
|
|
constexpr reference front() const noexcept { |
|
|
|
return ABSL_ASSERT(size() > 0), *data(); |
|
|
|
return ABSL_ASSERT(size() > 0), *data(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Span::back()
|
|
|
|
// Span::back()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a reference to the last element of this span.
|
|
|
|
// Returns a reference to the last element of this span. The span must not
|
|
|
|
|
|
|
|
// be empty.
|
|
|
|
constexpr reference back() const noexcept { |
|
|
|
constexpr reference back() const noexcept { |
|
|
|
return ABSL_ASSERT(size() > 0), *(data() + size() - 1); |
|
|
|
return ABSL_ASSERT(size() > 0), *(data() + size() - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Span::begin()
|
|
|
|
// Span::begin()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns an iterator to the first element of this span.
|
|
|
|
// Returns an iterator pointing to the first element of this span, or `end()`
|
|
|
|
|
|
|
|
// if the span is empty.
|
|
|
|
constexpr iterator begin() const noexcept { return data(); } |
|
|
|
constexpr iterator begin() const noexcept { return data(); } |
|
|
|
|
|
|
|
|
|
|
|
// Span::cbegin()
|
|
|
|
// Span::cbegin()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a const iterator to the first element of this span.
|
|
|
|
// Returns a const iterator pointing to the first element of this span, or
|
|
|
|
|
|
|
|
// `end()` if the span is empty.
|
|
|
|
constexpr const_iterator cbegin() const noexcept { return begin(); } |
|
|
|
constexpr const_iterator cbegin() const noexcept { return begin(); } |
|
|
|
|
|
|
|
|
|
|
|
// Span::end()
|
|
|
|
// Span::end()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns an iterator to the last element of this span.
|
|
|
|
// Returns an iterator pointing just beyond the last element at the
|
|
|
|
|
|
|
|
// end of this span. This iterator acts as a placeholder; attempting to
|
|
|
|
|
|
|
|
// access it results in undefined behavior.
|
|
|
|
constexpr iterator end() const noexcept { return data() + size(); } |
|
|
|
constexpr iterator end() const noexcept { return data() + size(); } |
|
|
|
|
|
|
|
|
|
|
|
// Span::cend()
|
|
|
|
// Span::cend()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a const iterator to the last element of this span.
|
|
|
|
// Returns a const iterator pointing just beyond the last element at the
|
|
|
|
|
|
|
|
// end of this span. This iterator acts as a placeholder; attempting to
|
|
|
|
|
|
|
|
// access it results in undefined behavior.
|
|
|
|
constexpr const_iterator cend() const noexcept { return end(); } |
|
|
|
constexpr const_iterator cend() const noexcept { return end(); } |
|
|
|
|
|
|
|
|
|
|
|
// Span::rbegin()
|
|
|
|
// Span::rbegin()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a reverse iterator starting at the last element of this span.
|
|
|
|
// Returns a reverse iterator pointing to the last element at the end of this
|
|
|
|
|
|
|
|
// span, or `rend()` if the span is empty.
|
|
|
|
constexpr reverse_iterator rbegin() const noexcept { |
|
|
|
constexpr reverse_iterator rbegin() const noexcept { |
|
|
|
return reverse_iterator(end()); |
|
|
|
return reverse_iterator(end()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Span::crbegin()
|
|
|
|
// Span::crbegin()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a reverse const iterator starting at the last element of this span.
|
|
|
|
// Returns a const reverse iterator pointing to the last element at the end of
|
|
|
|
|
|
|
|
// this span, or `crend()` if the span is empty.
|
|
|
|
constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } |
|
|
|
constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } |
|
|
|
|
|
|
|
|
|
|
|
// Span::rend()
|
|
|
|
// Span::rend()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a reverse iterator starting at the first element of this span.
|
|
|
|
// Returns a reverse iterator pointing just before the first element
|
|
|
|
|
|
|
|
// at the beginning of this span. This pointer acts as a placeholder;
|
|
|
|
|
|
|
|
// attempting to access its element results in undefined behavior.
|
|
|
|
constexpr reverse_iterator rend() const noexcept { |
|
|
|
constexpr reverse_iterator rend() const noexcept { |
|
|
|
return reverse_iterator(begin()); |
|
|
|
return reverse_iterator(begin()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Span::crend()
|
|
|
|
// Span::crend()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Returns a reverse iterator starting at the first element of this span.
|
|
|
|
// Returns a reverse const iterator pointing just before the first element
|
|
|
|
|
|
|
|
// at the beginning of this span. This pointer acts as a placeholder;
|
|
|
|
|
|
|
|
// attempting to access its element results in undefined behavior.
|
|
|
|
constexpr const_reverse_iterator crend() const noexcept { return rend(); } |
|
|
|
constexpr const_reverse_iterator crend() const noexcept { return rend(); } |
|
|
|
|
|
|
|
|
|
|
|
// Span mutations
|
|
|
|
// Span mutations
|
|
|
|