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

Array view. More...

#include <array_view.h>

Public Types

typedef T value_type
 
typedef size_t size_type
 
typedef const Tconst_reference
 
typedef const Tconst_pointer
 
typedef const Tconst_iterator
 
typedef ETL_OR_STD::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef const_pointer pointer
 
typedef const_reference reference
 
typedef const_pointer iterator
 
typedef const_reverse_iterator reverse_iterator
 

Public Member Functions

ETL_CONSTEXPR array_view ()
 Default constructor.
 
template<typename U , size_t N>
ETL_CONSTEXPR array_view (etl::array< U, N > &a, typename etl::enable_if< etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< U >::type >::value, void >::type *=0) ETL_NOEXCEPT
 Construct from etl::array.
 
template<typename U , size_t N>
ETL_CONSTEXPR array_view (const etl::array< U, N > &a, typename etl::enable_if< etl::is_same< typename etl::remove_cv< T >::type, typename etl::remove_cv< U >::type >::value, void >::type *=0) ETL_NOEXCEPT
 Construct from etl::array.
 
template<typename TContainer >
ETL_CONSTEXPR array_view (TContainer &a, typename etl::enable_if<!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 array_view (const TContainer &a, typename etl::enable_if<!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 TIterator >
ETL_CONSTEXPR array_view (const TIterator begin_, const TIterator end_)
 Construct from iterators.
 
template<typename TIterator , typename TSize >
ETL_CONSTEXPR array_view (const TIterator begin_, const TSize size_)
 Construct from C array.
 
template<size_t Array_Size>
ETL_CONSTEXPR array_view (T(&begin_)[Array_Size])
 Construct from C array.
 
ETL_CONSTEXPR array_view (const array_view &other)
 Copy constructor.
 
reference front ()
 Returns a reference to the first element.
 
const_reference front () const
 Returns a const reference to the first element.
 
reference back ()
 Returns a reference to the last element.
 
const_reference back () const
 Returns a const reference to the last element.
 
pointer data ()
 Returns a pointer to the first element of the internal storage.
 
const_pointer data () const
 Returns a const pointer to the first element of the internal storage.
 
iterator begin ()
 Returns an iterator to the beginning of the array.
 
const_iterator begin () const
 Returns a const iterator to the beginning of the array.
 
const_iterator cbegin () const
 Returns a const iterator to the beginning of the array.
 
iterator end ()
 Returns an iterator to the end of the array.
 
const_iterator end () const
 Returns a const iterator to the end of the array.
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 Returns a const reverse iterator to the reverse beginning of the array.
 
const_reverse_iterator crbegin () const
 Returns a const reverse iterator to the reverse beginning of the array.
 
reverse_iterator rend ()
 Returns a reverse iterator to the end of the array.
 
const_reverse_iterator rend () const
 Returns a const reverse iterator to the end of the array.
 
const_reverse_iterator crend () const
 Returns a const reverse iterator to the end of the array.
 
ETL_CONSTEXPR bool empty () const
 Returns true if the array size is zero.
 
ETL_CONSTEXPR size_t size () const
 Returns the size of the array.
 
ETL_CONSTEXPR size_t max_size () const
 Returns the maximum possible size of the array.
 
array_viewoperator= (const array_view &other)
 Assign from a view.
 
template<typename TIterator >
void assign (const TIterator begin_, const TIterator end_)
 Assign from iterators.
 
template<typename TIterator , typename TSize >
void assign (const TIterator begin_, const TSize size_)
 Assign from iterator and size.
 
const_reference operator[] (const size_t i) const
 Returns a const reference to the indexed value.
 
const_reference at (const size_t i) const
 Returns a const reference to the indexed value.
 
void swap (array_view &other)
 Swaps with another array_view.
 
void remove_prefix (const size_type n)
 Shrinks the view by moving its start forward.
 
void remove_suffix (const size_type n)
 Shrinks the view by moving its end backward.
 
void fill (const T &value)
 Fills the array.
 

Friends

bool operator== (const array_view< T > &lhs, const array_view< T > &rhs)
 Equality for array views.
 
bool operator!= (const array_view< T > &lhs, const array_view< T > &rhs)
 Inequality for array views.
 
bool operator< (const array_view< T > &lhs, const array_view< T > &rhs)
 Less-than for array views.
 
bool operator> (const array_view< T > &lhs, const array_view< T > &rhs)
 Greater-than for array views.
 
bool operator<= (const array_view< T > &lhs, const array_view< T > &rhs)
 Less-than-equal for array views.
 
bool operator>= (const array_view< T > &lhs, const array_view< T > &rhs)
 Greater-than-equal for array views.
 

Detailed Description

template<typename T>
class etl::array_view< T >

Array view.

Constructor & Destructor Documentation

◆ array_view() [1/2]

template<typename T >
template<typename TContainer >
ETL_CONSTEXPR etl::array_view< T >::array_view ( TContainer a,
typename etl::enable_if<!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.

◆ array_view() [2/2]

template<typename T >
template<typename TContainer >
ETL_CONSTEXPR etl::array_view< T >::array_view ( const TContainer a,
typename etl::enable_if<!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.


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