|
constexpr | span () noexcept=default |
| Constructs a span. Constructs an empty span whose data() == nullptr and size() == 0.
|
|
constexpr auto | back () const -> reference |
| Returns a reference to the last element in the span. Calling front on an empty span results in undefined behavior.
|
|
constexpr auto | begin () const noexcept -> iterator |
| Returns an iterator to the first element of the span. If the span is empty, the returned iterator will be equal to end().
|
|
constexpr auto | data () const noexcept -> pointer |
| Returns a pointer to the beginning of the sequence.
|
|
constexpr auto | empty () const noexcept -> bool |
| Checks if the span is empty.
|
|
constexpr auto | end () const noexcept -> iterator |
| Returns an iterator to the element following the last element of the span. This element acts as a placeholder; attempting to access it results in undefined behavior.
|
|
template<typename It>
requires detail::span_convertible_from<remove_reference_t<iter_reference_t<It>>, T> |
| explicit (extent !=dynamic_extent) const expr span(It first |
| Constructs a span.
|
|
template<size_t Count> |
constexpr auto | first () const -> span< element_type, Count > |
| Obtains a span that is a view over the first Count elements of this span. The program is ill-formed if Count > Extent.
|
|
constexpr auto | first (size_type count) const -> span< element_type, dynamic_extent > |
| Obtains a span that is a view over the first Count elements of this span. The behavior is undefined if Count > size().
|
|
constexpr auto | front () const -> reference |
| Returns a reference to the first element in the span. Calling front on an empty span results in undefined behavior.
|
|
template<size_t Count> |
constexpr auto | last () const -> span< element_type, Count > |
| Obtains a span that is a view over the last Count elements of this span. The program is ill-formed if Count > Extent.
|
|
constexpr auto | last (size_type count) const -> span< element_type, dynamic_extent > |
| Obtains a span that is a view over the last Count elements of this span. The behavior is undefined if Count > size().
|
|
constexpr auto | operator[] (size_type idx) const -> reference |
| Returns a reference to the idx-th element of the sequence. The behavior is undefined if idx is out of range (i.e., if it is greater than or equal to size()).
|
|
constexpr auto | rbegin () const noexcept -> reverse_iterator |
| Returns a reverse iterator to the first element of the reversed span. It corresponds to the last element of the non-reversed span. If the span is empty, the returned iterator is equal to rend().
|
|
constexpr auto | rend () const noexcept -> reverse_iterator |
| Returns a reverse iterator to the element following the last element of the reversed span. It corresponds to the element preceding the first element of the non-reversed span. This element acts as a placeholder, attempting to access it results in undefined behavior.
|
|
constexpr auto | size () const noexcept -> size_type |
| Returns the number of elements in the span.
|
|
constexpr auto | size_bytes () const noexcept -> size_type |
| Returns the number of elements in the span.
|
|
template<size_t Offset, size_t Count = dynamic_extent> |
constexpr auto | subspan () const -> span< T, detail::subspan_extent< Offset, Count, Extent >()> |
| Obtains a span that is a view over the Count elements of this span starting at offset Offset. If Count is etl::dynamic_extent, the number of elements in the subspan is size() - offset (i.e., it ends at the end of *this.).
|
|
constexpr auto | subspan (size_type offset, size_type count=dynamic_extent) const -> span< T, dynamic_extent > |
| Obtains a span that is a view over the Count elements of this span starting at offset Offset. If Count is etl::dynamic_extent, the number of elements in the subspan is size() - offset (i.e., it ends at the end of *this.).
|
|
|
(Note that these are not member symbols.)
|
template<typename T, size_t N> |
auto | as_bytes (span< T, N > s) noexcept -> span< byte const, detail::span_as_bytes_size< T, N > > |
| Obtains a view to the object representation of the elements of the span s.
|
|
template<typename T, size_t N> |
auto | as_writable_bytes (span< T, N > s) noexcept -> span< byte, detail::span_as_bytes_size< T, N > > |
| Obtains a view to the object representation of the elements of the span s.
|
|
template<typename T,
size_t Extent>
struct etl::span< T, Extent >
A non-owning view over a contiguous sequence of objects.
The class template span describes an object that can refer to a contiguous sequence of objects with the first element of the sequence at position zero. A span can either have a static extent, in which case the number of elements in the sequence is known and encoded in the type, or a dynamic extent.
If a span has dynamic extent a typical implementation holds two members: a pointer to T and a size. A span with static extent may have only one member: a pointer to T.
- Examples
- numeric.cpp.