Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::span< T, etl::dynamic_extent > Class Template Reference

Span - Dynamic Extent. More...

#include <span.h>

Public Types

typedef T element_type
typedef etl::remove_cv< T >::type value_type
typedef size_t size_type
typedef T & reference
typedef const T & const_reference
typedef T * pointer
typedef const T * const_pointer
typedef T * iterator
typedef const T * const_iterator
typedef ETL_OR_STD::reverse_iterator< iterator > reverse_iterator
typedef ETL_OR_STD::reverse_iterator< const_iterator > const_reverse_iterator
typedef etl::circular_iterator< pointer > circular_iterator
typedef etl::circular_iterator< ETL_OR_STD::reverse_iterator< pointer > > reverse_circular_iterator

Public Member Functions

ETL_CONSTEXPR span () ETL_NOEXCEPT
 Default constructor.
template<typename TIterator, typename TSize>
ETL_CONSTEXPR span (const TIterator begin_, const TSize size_) ETL_NOEXCEPT
 Construct from pointer + size.
template<typename TIterator>
ETL_CONSTEXPR span (const TIterator begin_, const TIterator end_) ETL_NOEXCEPT
 Construct from iterators.
template<size_t Array_Size>
ETL_CONSTEXPR span (element_type(&begin_)[Array_Size]) ETL_NOEXCEPT
 Construct from C array.
template<typename TContainer>
ETL_CONSTEXPR span (TContainer &a, typename etl::enable_if<!etl::is_base_of< span_tag, typename etl::remove_reference< TContainer >::type >::value &&!etl::is_pointer< typename etl::remove_reference< TContainer >::type >::value &&!etl::is_array< TContainer >::value &&etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< typename etl::remove_reference< TContainer >::type::value_type >::type >::value, void >::type *=0) ETL_NOEXCEPT
template<typename TContainer>
ETL_CONSTEXPR span (const TContainer &a, typename etl::enable_if<!etl::is_base_of< span_tag, typename etl::remove_reference< TContainer >::type >::value &&!etl::is_pointer< typename etl::remove_reference< TContainer >::type >::value &&!etl::is_array< TContainer >::value &&etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< typename etl::remove_reference< TContainer >::type::value_type >::type >::value, void >::type *=0) ETL_NOEXCEPT
ETL_CONSTEXPR span (const span &other) ETL_NOEXCEPT
 Copy constructor.
template<typename U, size_t Size>
ETL_CONSTEXPR span (const etl::span< U, Size > &other) ETL_NOEXCEPT
 Copy constructor.
ETL_NODISCARD ETL_CONSTEXPR reference front () const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Returns a reference to the first element.
ETL_NODISCARD ETL_CONSTEXPR reference back () const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Returns a reference to the last element.
ETL_NODISCARD ETL_CONSTEXPR pointer data () const ETL_NOEXCEPT
 Returns a pointer to the first element of the internal storage.
ETL_NODISCARD ETL_CONSTEXPR const_iterator cbegin () const ETL_NOEXCEPT
 Returns a const iterator to the beginning of the span.
ETL_NODISCARD ETL_CONSTEXPR iterator begin () const ETL_NOEXCEPT
 Returns an iterator to the beginning of the span.
ETL_NODISCARD ETL_CONSTEXPR circular_iterator begin_circular () const ETL_NOEXCEPT
 Returns a circular iterator to the beginning of the span.
ETL_NODISCARD ETL_CONSTEXPR const_iterator cend () const ETL_NOEXCEPT
 Returns a const iterator to the end of the span.
ETL_NODISCARD ETL_CONSTEXPR iterator end () const ETL_NOEXCEPT
 Returns an iterator to the end of the span.
ETL_NODISCARD ETL_CONSTEXPR reverse_iterator rbegin () const ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crbegin () const ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR reverse_circular_iterator rbegin_circular () const ETL_NOEXCEPT
 Returns a reverse circular iterator to the end of the span.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crend () const ETL_NOEXCEPT
 Returns a const reverse iterator to the end of the span.
ETL_NODISCARD ETL_CONSTEXPR reverse_iterator rend () const ETL_NOEXCEPT
 Returns a reverse iterator to the end of the span.
ETL_NODISCARD ETL_CONSTEXPR bool empty () const ETL_NOEXCEPT
 Returns true if the span size is zero.
ETL_NODISCARD ETL_CONSTEXPR size_t size () const ETL_NOEXCEPT
 Returns the size of the span.
ETL_NODISCARD ETL_CONSTEXPR size_t size_bytes () const ETL_NOEXCEPT
 Returns the size of the span in bytes.
ETL_NODISCARD ETL_CONSTEXPR size_t max_size () const ETL_NOEXCEPT
 Returns the maximum possible size of the span.
ETL_CONSTEXPR14 spanoperator= (const span &other) ETL_NOEXCEPT
 Assign from a span.
ETL_NODISCARD ETL_CONSTEXPR14 reference at (size_t i)
 Returns a reference to the value at index 'i'.
ETL_NODISCARD ETL_CONSTEXPR14 const_reference at (size_t i) const
 Returns a const reference to the value at index 'i'.
ETL_CONSTEXPR reference operator[] (const size_t i) const
 Returns a reference to the indexed value.
template<size_t COUNT>
ETL_NODISCARD ETL_CONSTEXPR etl::span< element_type, COUNT > first () const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Obtains a span that is a view over the first COUNT elements of this span.
ETL_NODISCARD ETL_CONSTEXPR etl::span< element_type, etl::dynamic_extent > first (size_t count) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Obtains a span that is a view over the first count elements of this span.
template<size_t COUNT>
ETL_NODISCARD ETL_CONSTEXPR etl::span< element_type, COUNT > last () const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Obtains a span that is a view over the last COUNT elements of this span.
ETL_NODISCARD ETL_CONSTEXPR etl::span< element_type, etl::dynamic_extent > last (size_t count) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Obtains a span that is a view over the last count elements of this span.
template<size_t OFFSET, size_t COUNT>
etl::span< element_type, COUNT !=etl::dynamic_extent ? COUNT :etl::dynamic_extent > subspan () const
 Obtains a span that is a view from OFFSET over the next COUNT elements of this span.
ETL_NODISCARD ETL_CONSTEXPR14 etl::span< element_type, etl::dynamic_extent > subspan (size_t offset, size_t count=etl::dynamic_extent) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_EXTRA)
 Obtains a span that is a view from 'offset' over the next 'count' elements of this span.
void advance (size_t elements) ETL_NOEXCEPT
template<typename TNew>
ETL_NODISCARD ETL_CONSTEXPR14 etl::span< TNew, etl::dynamic_extent > reinterpret_as () const
 Reinterpret the span as a span with different element type.
template<typename TRet>
ETL_NODISCARD etl::span< TRet > take (size_t const n)
template<typename TRet>
ETL_NODISCARD TRet & take ()

Static Public Attributes

static ETL_CONSTANT size_t extent = etl::dynamic_extent

Detailed Description

template<typename T>
class etl::span< T, etl::dynamic_extent >

Span - Dynamic Extent.

Constructor & Destructor Documentation

◆ span() [1/2]

template<typename T>
template<typename TContainer>
ETL_CONSTEXPR etl::span< T, etl::dynamic_extent >::span ( TContainer & a,
typename etl::enable_if<!etl::is_base_of< span_tag, typename etl::remove_reference< TContainer >::type >::value &&!etl::is_pointer< typename etl::remove_reference< TContainer >::type >::value &&!etl::is_array< TContainer >::value &&etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< typename etl::remove_reference< TContainer >::type::value_type >::type >::value, void >::type * = 0 )
inline

Construct from a container or other type that supports data() and size() member functions.

◆ span() [2/2]

template<typename T>
template<typename TContainer>
ETL_CONSTEXPR etl::span< T, etl::dynamic_extent >::span ( const TContainer & a,
typename etl::enable_if<!etl::is_base_of< span_tag, typename etl::remove_reference< TContainer >::type >::value &&!etl::is_pointer< typename etl::remove_reference< TContainer >::type >::value &&!etl::is_array< TContainer >::value &&etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< typename etl::remove_reference< TContainer >::type::value_type >::type >::value, void >::type * = 0 )
inline

Construct from a container or other type that supports data() and size() member functions.

Member Function Documentation

◆ advance()

template<typename T>
void etl::span< T, etl::dynamic_extent >::advance ( size_t elements)
inline

Moves the pointer to the first element of the span further by a specified number of elements.

Template Parameters
elementsNumber of elements to move forward

◆ take() [1/2]

template<typename T>
template<typename TRet>
ETL_NODISCARD TRet & etl::span< T, etl::dynamic_extent >::take ( )
inline

Split off and return an initial value of specified type of this span. The original span is advanced by the size of TRet

Template Parameters
TRetReturned span type

◆ take() [2/2]

template<typename T>
template<typename TRet>
ETL_NODISCARD etl::span< TRet > etl::span< T, etl::dynamic_extent >::take ( size_t const n)
inline

Split off and return an initial span of specified type of this span. The original span is advanced by the size of the returned span.

Template Parameters
TRetReturned span type
Parameters
nNumber of elements in returned span

The documentation for this class was generated from the following file: