133 constexpr
span() noexcept = default;
147 : m_ptr{ptr}, m_count{count}
149 if ((
nullptr == m_ptr) || (0U == m_count)) {
175 if ((
nullptr == m_ptr) || (index >= m_count)) {
179 return &m_ptr[index];
197 if ((
nullptr == m_ptr) || (index >= m_count)) {
201 return &m_ptr[index];
218 return this->
at_if(0U);
235 return this->
at_if(0U);
252 return this->
at_if((m_count > 0U) ? (m_count - 1U) : 0U);
269 return this->
at_if((m_count > 0U) ? (m_count - 1U) : 0U);
512 size_type const ai{(i >= m_count) ? m_count : (i + 1U)};
533 size_type const ai{(i >= m_count) ? m_count : (i + 1U)};
554 size_type const ai{(i >= m_count) ? m_count : (i + 1U)};
622 [[nodiscard]] constexpr
bool 625 return 0U == m_count;
668 return m_count *
sizeof(T);
681 [[nodiscard]] constexpr
span<T> 684 return this->
subspan(0U, count);
697 [[nodiscard]] constexpr
span<T> 700 return this->
subspan(0U, count);
717 [[nodiscard]] constexpr
span<T> 720 if (count > this->
size()) {
721 count = this->
size();
741 [[nodiscard]] constexpr
span<T> 744 if (count > this->
size()) {
745 count = this->
size();
764 [[nodiscard]] constexpr
span<T> 767 if ((
nullptr == m_ptr) || (pos >= m_count)) {
787 [[nodiscard]] constexpr
span<T> 790 if ((
nullptr == m_ptr) || (pos >= m_count)) {
821 if (lhs.size() != rhs.size()) {
830 if (*lhs.at_if(i) != *rhs.at_if(i)) {
855 return !(lhs == rhs);
constexpr const_reverse_iterator_type crbegin() const noexcept
Returns a reverse iterator to one past the last element of the view. When accessing the iterator,...
Definition: span.hpp:490
constexpr size_type size() const noexcept
Returns the number of elements in the array being viewed. If this is a default constructed view,...
Definition: span.hpp:640
T * pointer_type
alias for: T *
Definition: span.hpp:104
contiguous_iterator< T > iterator_type
alias for: contiguous_iterator<T>
Definition: span.hpp:108
constexpr pointer_type front_if() noexcept
Returns a pointer to the instance of T stored at index "0". If the index is out of bounds,...
Definition: span.hpp:216
If the provided type is a fundamental type, provides the member constant value equal to true....
Definition: is_fundamental.hpp:76
constexpr const_reverse_iterator_type riter(size_type const i) const noexcept
Returns a reverse iterator element "i" in the view. When accessing the iterator, the iterator will al...
Definition: span.hpp:531
constexpr pointer_type data() noexcept
Returns a pointer to the array being viewed. If this is a default constructed view,...
Definition: span.hpp:284
constexpr pointer_type at_if(size_type const index) noexcept
Returns a pointer to the instance of T stored at index "index". If the index is out of bounds,...
Definition: span.hpp:173
constexpr span< T > subspan(size_type const pos, size_type const count=npos) noexcept
Returns span{at_if(pos), min_of(count, size() - pos)}. If the provided "pos" is greater than or equal...
Definition: span.hpp:765
constexpr reverse_iterator_type rend() noexcept
Returns a reverse iterator first element of the view. When accessing the iterator,...
Definition: span.hpp:572
constexpr span< T > subspan(size_type const pos, size_type const count=npos) const noexcept
Returns span{at_if(pos), min_of(count, size() - pos)}. If the provided "pos" is greater than or equal...
Definition: span.hpp:788
constexpr const_pointer_type front_if() const noexcept
Returns a pointer to the instance of T stored at index "0". If the index is out of bounds,...
Definition: span.hpp:233
constexpr const_iterator_type begin() const noexcept
Returns an iterator to the first element of the view.
Definition: span.hpp:327
constexpr span< T > first(size_type const count=npos) const noexcept
Returns subspan(0, count). If count is 0, an invalid span is returned.
Definition: span.hpp:698
constexpr const_iterator_type cbegin() const noexcept
Returns an iterator to the first element of the view.
Definition: span.hpp:340
T const & const_reference_type
alias for: T &
Definition: span.hpp:102
bsl::uintmax difference_type
alias for: bsl::uintmax
Definition: span.hpp:98
constexpr iterator_type iter(size_type const i) noexcept
Returns an iterator to the element "i" in the view.
Definition: span.hpp:354
reverse_iterator< iterator_type > reverse_iterator_type
alias for: reverse_iterator<iterator>
Definition: span.hpp:112
constexpr const_pointer_type data() const noexcept
Returns a pointer to the array being viewed. If this is a default constructed view,...
Definition: span.hpp:301
contiguous_iterator< T const > const_iterator_type
alias for: contiguous_iterator<T const>
Definition: span.hpp:110
T const * const_pointer_type
alias for: T const *
Definition: span.hpp:106
constexpr const_reverse_iterator_type crend() const noexcept
Returns a reverse iterator first element of the view. When accessing the iterator,...
Definition: span.hpp:610
constexpr const_iterator_type cend() const noexcept
Returns an iterator to one past the last element of the view. If you attempt to access this iterator,...
Definition: span.hpp:433
constexpr span< T > last(size_type count=npos) const noexcept
Returns subspan(this->size() - count, count). If count is greater than the size of the current span,...
Definition: span.hpp:742
A bsl::span is a non-owning view of an array type. Unlike a bsl::array, the bsl::span does not own th...
Definition: span.hpp:90
T value_type
alias for: T
Definition: span.hpp:94
constexpr reverse_iterator_type riter(size_type const i) noexcept
Returns a reverse iterator element "i" in the view. When accessing the iterator, the iterator will al...
Definition: span.hpp:510
static constexpr T max() noexcept
Returns the max value of T.
Definition: numeric_limits.hpp:154
constexpr bool operator==(span< T > const &lhs, span< T > const &rhs) noexcept
Returns true if two spans have the same size and contain the same contents. Returns false otherwise.
Definition: span.hpp:819
constexpr const_iterator_type end() const noexcept
Returns an iterator to one past the last element of the view. If you attempt to access this iterator,...
Definition: span.hpp:416
Provides a reverse iterator as defined by the C++ specification, with the follwing differences:
Definition: reverse_iterator.hpp:78
constexpr span< T > last(size_type count=npos) noexcept
Returns subspan(this->size() - count, count). If count is greater than the size of the current span,...
Definition: span.hpp:718
constexpr bool empty() const noexcept
Returns size() == 0.
Definition: span.hpp:623
constexpr const_reverse_iterator_type rend() const noexcept
Returns a reverse iterator first element of the view. When accessing the iterator,...
Definition: span.hpp:591
constexpr const_pointer_type back_if() const noexcept
Returns a pointer to the instance of T stored at index "size() - 1". If the index is out of bounds,...
Definition: span.hpp:267
constexpr iterator_type begin() noexcept
Returns an iterator to the first element of the view.
Definition: span.hpp:314
constexpr iterator_type end() noexcept
Returns an iterator to one past the last element of the view. If you attempt to access this iterator,...
Definition: span.hpp:399
constexpr const_iterator_type citer(size_type const i) const noexcept
Returns an iterator to the element "i" in the view.
Definition: span.hpp:382
constexpr bool operator!=(span< T > const &lhs, span< T > const &rhs) noexcept
Returns false if two spans have the same size and contain the same contents. Returns true otherwise.
Definition: span.hpp:853
constexpr const_reverse_iterator_type criter(size_type const i) const noexcept
Returns a reverse iterator element "i" in the view. When accessing the iterator, the iterator will al...
Definition: span.hpp:552
constexpr span< T > first(size_type const count=npos) noexcept
Returns subspan(0, count). If count is 0, an invalid span is returned.
Definition: span.hpp:682
constexpr const_reverse_iterator_type rbegin() const noexcept
Returns a reverse iterator to one past the last element of the view. When accessing the iterator,...
Definition: span.hpp:471
static constexpr size_type max_size() noexcept
Returns the max number of elements the BSL supports.
Definition: span.hpp:653
reverse_iterator< const_iterator_type > const_reverse_iterator_type
alias for: reverse_iterator<const_iterator>
Definition: span.hpp:114
constexpr pointer_type back_if() noexcept
Returns a pointer to the instance of T stored at index "size() - 1". If the index is out of bounds,...
Definition: span.hpp:250
T & reference_type
alias for: T &
Definition: span.hpp:100
constexpr size_type size_bytes() const noexcept
Returns size() * sizeof(T)
Definition: span.hpp:666
bsl::uintmax size_type
alias for: bsl::uintmax
Definition: span.hpp:96
constexpr span() noexcept=default
Default constructor that creates a span with data() == nullptr and size() == 0. All accessors will re...
constexpr bool is_constant_evaluated() noexcept
Detects whether the function call occurs within a constant-evaluated context. Returns true if the eva...
Definition: is_constant_evaluated.hpp:46
constexpr const_pointer_type at_if(size_type const index) const noexcept
Returns a pointer to the instance of T stored at index "index". If the index is out of bounds,...
Definition: span.hpp:195
constexpr T const & min_of(T const &a, T const &b) noexcept
Returns a if a is smaller than b, otherwise returns b. Note that this function is called min_of to pr...
Definition: min_of.hpp:47
::uintmax_t uintmax
defines a unsigned integer with the maximum possible size
Definition: cstdint.hpp:97
Provides a contiguous iterator as defined by the C++ specification, with the follwing differences:
Definition: contiguous_iterator.hpp:76
constexpr reverse_iterator_type rbegin() noexcept
Returns a reverse iterator to one past the last element of the view. When accessing the iterator,...
Definition: span.hpp:452
constexpr const_iterator_type iter(size_type const i) const noexcept
Returns an iterator to the element "i" in the view.
Definition: span.hpp:368
bsl::int32 builtin_memcmp(void const *const lhs, void const *const rhs, bsl::uintmax const count) noexcept
Same as std::memcmp with parameter checks. If lhs, rhs are a nullptr, or count is 0,...
Definition: cstring.hpp:108