Embedded Template Library 1.0
Loading...
Searching...
No Matches
array

Classes

class  etl::array_exception
class  etl::array_out_of_range
class  etl::array< T, SIZE_ >
class  etl::array< T, 0 >

Detailed Description

A replacement for std::array if you haven't got C++0x11.

A wrapper for arrays


Class Documentation

◆ etl::array_exception

class etl::array_exception

The base class for array exceptions.

Public Member Functions

 array_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
ETL_CONSTEXPR string_type what () const
ETL_CONSTEXPR string_type file_name () const
ETL_CONSTEXPR numeric_type line_number () const

Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * string_type
typedef int numeric_type

◆ etl::array_out_of_range

class etl::array_out_of_range

The out of range exceptions.

Public Member Functions

 array_out_of_range (string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::array_exception
 array_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_CONSTEXPR exception (string_type reason_, string_type, numeric_type line_)
 Constructor.
ETL_CONSTEXPR string_type what () const
ETL_CONSTEXPR string_type file_name () const
ETL_CONSTEXPR numeric_type line_number () const

Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * string_type
typedef int numeric_type

◆ etl::array

class etl::array
template<typename T, size_t SIZE_>
class etl::array< T, SIZE_ >

A replacement for std::array if you haven't got C++0x11.

Public Types

typedef T value_type
typedef size_t size_type
typedef ptrdiff_t difference_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

Public Member Functions

ETL_NODISCARD ETL_CONSTEXPR14 reference at (size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_NODISCARD ETL_CONSTEXPR14 const_reference at (size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_NODISCARD ETL_CONSTEXPR14 reference operator[] (size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_INDEX_OPERATOR)
ETL_NODISCARD ETL_CONSTEXPR const_reference operator[] (size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_INDEX_OPERATOR)
ETL_NODISCARD ETL_CONSTEXPR14 reference front () ETL_NOEXCEPT
 Returns a reference to the first element.
ETL_NODISCARD ETL_CONSTEXPR const_reference front () const ETL_NOEXCEPT
 Returns a const reference to the first element.
ETL_NODISCARD ETL_CONSTEXPR14 reference back () ETL_NOEXCEPT
 Returns a reference to the last element.
ETL_NODISCARD ETL_CONSTEXPR const_reference back () const ETL_NOEXCEPT
 Returns a const reference to the last element.
ETL_NODISCARD ETL_CONSTEXPR14 pointer data () ETL_NOEXCEPT
 Returns a pointer to the first element of the internal buffer.
ETL_NODISCARD ETL_CONSTEXPR const_pointer data () const ETL_NOEXCEPT
 Returns a const pointer to the first element of the internal buffer.
ETL_NODISCARD ETL_CONSTEXPR14 iterator begin () ETL_NOEXCEPT
 Returns an iterator to the beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator begin () const ETL_NOEXCEPT
 Returns a const iterator to the beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator cbegin () const ETL_NOEXCEPT
 Returns a const iterator to the beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR14 iterator end () ETL_NOEXCEPT
 Returns an iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator end () const ETL_NOEXCEPT
 Returns a const iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator cend () const ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR14 reverse_iterator rbegin () ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rbegin () const ETL_NOEXCEPT
 Returns a const reverse iterator to the reverse beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crbegin () const ETL_NOEXCEPT
 Returns a const reverse iterator to the reverse beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR14 reverse_iterator rend () ETL_NOEXCEPT
 Returns a reverse iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rend () const ETL_NOEXCEPT
 Returns a const reverse iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crend () const ETL_NOEXCEPT
 Returns a const reverse iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR bool empty () const ETL_NOEXCEPT
 Returns true if the array size is zero.
ETL_NODISCARD ETL_CONSTEXPR size_t size () const ETL_NOEXCEPT
 Returns the size of the array.
ETL_NODISCARD ETL_CONSTEXPR size_t max_size () const ETL_NOEXCEPT
 Returns the maximum possible size of the array.
ETL_CONSTEXPR14 void fill (parameter_t value)
ETL_CONSTEXPR14 void swap (array &other) ETL_NOEXCEPT_FROM(ETL_OR_STD
template<typename TIterator>
iterator assign (TIterator first, const TIterator last)
template<typename TIterator>
iterator assign (TIterator first, const TIterator last, parameter_t value)
iterator insert_at (size_t position, parameter_t value)
iterator insert (const_iterator position, parameter_t value)
template<typename TIterator>
iterator insert_at (size_t position, TIterator first, const TIterator last)
template<typename TIterator>
iterator insert (const_iterator position, TIterator first, const TIterator last)
iterator erase_at (size_t position)
iterator erase (const_iterator position)
iterator erase_range (size_t first, size_t last)
iterator erase (const_iterator first, const_iterator last)
iterator erase_at (size_t position, parameter_t value)
iterator erase (const_iterator position, parameter_t value)
iterator erase_range (size_t first, size_t last, parameter_t value)
iterator erase (const_iterator first, const_iterator last, parameter_t value)

Public Attributes

_buffer [SIZE]
 The array data.

Static Public Attributes

static ETL_CONSTANT size_t SIZE = SIZE_

Member Function Documentation

◆ assign() [1/2]

template<typename T, size_t SIZE_>
template<typename TIterator>
iterator etl::array< T, SIZE_ >::assign ( TIterator first,
const TIterator last )
inline

Fills the array from the range. If the range is smaller than the array then the unused array elements are left unmodified.

Parameters
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.
Returns
An iterator to the first unassigned array element, or end().

◆ assign() [2/2]

template<typename T, size_t SIZE_>
template<typename TIterator>
iterator etl::array< T, SIZE_ >::assign ( TIterator first,
const TIterator last,
parameter_t value )
inline

Fills the array from the range. If the range is smaller than the array then the unused array elements are initialised with the supplied value.

Parameters
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.
Returns
An iterator to the first array element set to 'value', or end().

◆ at() [1/2]

template<typename T, size_t SIZE_>
ETL_NODISCARD ETL_CONSTEXPR14 const_reference etl::array< T, SIZE_ >::at ( size_t i) const
inline

Returns a const reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ at() [2/2]

template<typename T, size_t SIZE_>
ETL_NODISCARD ETL_CONSTEXPR14 reference etl::array< T, SIZE_ >::at ( size_t i)
inline

Returns a reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ erase() [1/4]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase ( const_iterator first,
const_iterator last )
inline

Erases a range of values from the array. After erase, the last values in the array will be unmodified.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.

◆ erase() [2/4]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase ( const_iterator first,
const_iterator last,
parameter_t value )
inline

Erases a range of values from the array.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.
valueThe value to use to overwrite the last elements in the array.

◆ erase() [3/4]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase ( const_iterator position)
inline

Erases a value from the array. After erase, the last value in the array will be unmodified.

Parameters
positionThe iterator to the position to erase at.

◆ erase() [4/4]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase ( const_iterator position,
parameter_t value )
inline

Erases a value from the array.

Parameters
positionThe iterator to the position to erase at.
valueThe value to use to overwrite the last element in the array.

◆ erase_at() [1/2]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase_at ( size_t position)
inline

Erases a value from the array. After erase, the last value in the array will be unmodified.

Parameters
positionThe index of the position to erase at.

◆ erase_at() [2/2]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase_at ( size_t position,
parameter_t value )
inline

Erases a value from the array.

Parameters
positionThe index of the position to erase at.
valueThe value to use to overwrite the last element in the array.

◆ erase_range() [1/2]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase_range ( size_t first,
size_t last )
inline

Erases a range of values from the array. After erase, the last values in the array will be unmodified.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.

◆ erase_range() [2/2]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::erase_range ( size_t first,
size_t last,
parameter_t value )
inline

Erases a range of values from the array.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.
valueThe value to use to overwrite the last elements in the array.

◆ fill()

template<typename T, size_t SIZE_>
ETL_CONSTEXPR14 void etl::array< T, SIZE_ >::fill ( parameter_t value)
inline

Fills the array with the specified value.

Parameters
valueThe value to fill the array with.

◆ insert() [1/2]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::insert ( const_iterator position,
parameter_t value )
inline

Inserts a value into the array.

Parameters
positionThe iterator to the position to insert at.
valueThe value to insert.

◆ insert() [2/2]

template<typename T, size_t SIZE_>
template<typename TIterator>
iterator etl::array< T, SIZE_ >::insert ( const_iterator position,
TIterator first,
const TIterator last )
inline

Insert into the array from the range.

Parameters
positionThe position to insert at.
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.

◆ insert_at() [1/2]

template<typename T, size_t SIZE_>
iterator etl::array< T, SIZE_ >::insert_at ( size_t position,
parameter_t value )
inline

Inserts a value into the array.

Parameters
positionThe index of the position to insert at.
valueThe value to insert.

◆ insert_at() [2/2]

template<typename T, size_t SIZE_>
template<typename TIterator>
iterator etl::array< T, SIZE_ >::insert_at ( size_t position,
TIterator first,
const TIterator last )
inline

Insert into the array from the range.

Parameters
positionThe position to insert at.
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.

◆ operator[]() [1/2]

template<typename T, size_t SIZE_>
ETL_NODISCARD ETL_CONSTEXPR const_reference etl::array< T, SIZE_ >::operator[] ( size_t i) const
inline

[] operator. Returns a const reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ operator[]() [2/2]

template<typename T, size_t SIZE_>
ETL_NODISCARD ETL_CONSTEXPR14 reference etl::array< T, SIZE_ >::operator[] ( size_t i)
inline

[] operator. Returns a reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ swap()

template<typename T, size_t SIZE_>
ETL_CONSTEXPR14 void etl::array< T, SIZE_ >::swap ( array< T, SIZE_ > & other)
inline

Swaps the contents of this array and another.

Parameters
otherA reference to the other array.

◆ etl::array< T, 0 >

class etl::array< T, 0 >
template<typename T>
class etl::array< T, 0 >

A replacement for std::array if you haven't got C++0x11. Specialisation for zero sized array.

Public Types

typedef T value_type
typedef size_t size_type
typedef ptrdiff_t difference_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

Public Member Functions

ETL_NODISCARD ETL_CONSTEXPR14 reference at (size_t) ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR14 const_reference at (size_t) const ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR14 reference operator[] (size_t) ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR const_reference operator[] (size_t) const ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR14 reference front () ETL_NOEXCEPT
 Returns a reference to the first element.
ETL_NODISCARD ETL_CONSTEXPR const_reference front () const ETL_NOEXCEPT
 Returns a const reference to the first element.
ETL_NODISCARD ETL_CONSTEXPR14 reference back () ETL_NOEXCEPT
 Returns a reference to the last element.
ETL_NODISCARD ETL_CONSTEXPR const_reference back () const
 Returns a const reference to the last element.
ETL_NODISCARD ETL_CONSTEXPR14 pointer data () ETL_NOEXCEPT
 Returns a pointer to the first element of the internal buffer.
ETL_NODISCARD ETL_CONSTEXPR const_pointer data () const ETL_NOEXCEPT
 Returns a const pointer to the first element of the internal buffer.
ETL_NODISCARD ETL_CONSTEXPR14 iterator begin () ETL_NOEXCEPT
 Returns an iterator to the beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator begin () const ETL_NOEXCEPT
 Returns a const iterator to the beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator cbegin () const ETL_NOEXCEPT
 Returns a const iterator to the beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR14 iterator end () ETL_NOEXCEPT
 Returns an iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator end () const ETL_NOEXCEPT
 Returns a const iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_iterator cend () const ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR14 reverse_iterator rbegin () ETL_NOEXCEPT
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rbegin () const ETL_NOEXCEPT
 Returns a const reverse iterator to the reverse beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crbegin () const ETL_NOEXCEPT
 Returns a const reverse iterator to the reverse beginning of the array.
ETL_NODISCARD ETL_CONSTEXPR14 reverse_iterator rend () ETL_NOEXCEPT
 Returns a reverse iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rend () const ETL_NOEXCEPT
 Returns a const reverse iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crend () const ETL_NOEXCEPT
 Returns a const reverse iterator to the end of the array.
ETL_NODISCARD ETL_CONSTEXPR bool empty () const ETL_NOEXCEPT
 Returns true if the array size is zero.
ETL_NODISCARD ETL_CONSTEXPR size_t size () const ETL_NOEXCEPT
 Returns the size of the array.
ETL_NODISCARD ETL_CONSTEXPR size_t max_size () const ETL_NOEXCEPT
 Returns the maximum possible size of the array.
ETL_CONSTEXPR14 void fill (parameter_t) ETL_NOEXCEPT
ETL_CONSTEXPR14 void swap (array &) ETL_NOEXCEPT
template<typename TIterator>
iterator assign (TIterator, const TIterator) ETL_NOEXCEPT
template<typename TIterator>
iterator assign (TIterator, const TIterator, parameter_t) ETL_NOEXCEPT
iterator insert_at (size_t, parameter_t) ETL_NOEXCEPT
iterator insert (const_iterator, parameter_t) ETL_NOEXCEPT
template<typename TIterator>
iterator insert_at (size_t, TIterator, const TIterator) ETL_NOEXCEPT
template<typename TIterator>
iterator insert (const_iterator, TIterator, const TIterator) ETL_NOEXCEPT
iterator erase_at (size_t) ETL_NOEXCEPT
iterator erase (const_iterator) ETL_NOEXCEPT
iterator erase_range (size_t, size_t) ETL_NOEXCEPT
iterator erase (const_iterator, const_iterator) ETL_NOEXCEPT
iterator erase_at (size_t, parameter_t) ETL_NOEXCEPT
iterator erase (const_iterator, parameter_t) ETL_NOEXCEPT
iterator erase_range (size_t, size_t, parameter_t) ETL_NOEXCEPT
iterator erase (const_iterator, const_iterator, parameter_t) ETL_NOEXCEPT

Public Attributes

_buffer [SIZE]
 The array data.

Static Public Attributes

static ETL_CONSTANT size_t SIZE = 0

Member Function Documentation

◆ assign() [1/2]

template<typename T>
template<typename TIterator>
iterator etl::array< T, 0 >::assign ( TIterator ,
const TIterator  )
inline

Fills the array from the range. If the range is smaller than the array then the unused array elements are left unmodified.

Parameters
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.
Returns
An iterator to the first unassigned array element, or end().

◆ assign() [2/2]

template<typename T>
template<typename TIterator>
iterator etl::array< T, 0 >::assign ( TIterator ,
const TIterator ,
parameter_t  )
inline

Fills the array from the range. If the range is smaller than the array then the unused array elements are initialised with the supplied value.

Parameters
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.
Returns
An iterator to the first array element set to 'value', or end().

◆ at() [1/2]

template<typename T>
ETL_NODISCARD ETL_CONSTEXPR14 const_reference etl::array< T, 0 >::at ( size_t ) const
inline

Returns a const reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ at() [2/2]

template<typename T>
ETL_NODISCARD ETL_CONSTEXPR14 reference etl::array< T, 0 >::at ( size_t )
inline

Returns a reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ erase() [1/4]

template<typename T>
iterator etl::array< T, 0 >::erase ( const_iterator )
inline

Erases a value from the array. After erase, the last value in the array will be unmodified.

Parameters
positionThe iterator to the position to erase at.

◆ erase() [2/4]

template<typename T>
iterator etl::array< T, 0 >::erase ( const_iterator ,
const_iterator  )
inline

Erases a range of values from the array. After erase, the last values in the array will be unmodified.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.

◆ erase() [3/4]

template<typename T>
iterator etl::array< T, 0 >::erase ( const_iterator ,
const_iterator ,
parameter_t  )
inline

Erases a range of values from the array.

Parameters
positionThe iterator to the position to erase at.
valueThe value to use to overwrite the last elements in the array.

◆ erase() [4/4]

template<typename T>
iterator etl::array< T, 0 >::erase ( const_iterator ,
parameter_t  )
inline

Erases a value from the array.

Parameters
positionThe iterator to the position to erase at.
valueThe value to use to overwrite the last element in the array.

◆ erase_at() [1/2]

template<typename T>
iterator etl::array< T, 0 >::erase_at ( size_t )
inline

Erases a value from the array. After erase, the last value in the array will be unmodified.

Parameters
positionThe index of the position to erase at.

◆ erase_at() [2/2]

template<typename T>
iterator etl::array< T, 0 >::erase_at ( size_t ,
parameter_t  )
inline

Erases a value from the array.

Parameters
positionThe index of the position to erase at.
valueThe value to use to overwrite the last element in the array.

◆ erase_range() [1/2]

template<typename T>
iterator etl::array< T, 0 >::erase_range ( size_t ,
size_t  )
inline

Erases a range of values from the array. After erase, the last values in the array will be unmodified.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.

◆ erase_range() [2/2]

template<typename T>
iterator etl::array< T, 0 >::erase_range ( size_t ,
size_t ,
parameter_t  )
inline

Erases a range of values from the array.

Parameters
firstThe first item to erase.
lastThe one past the last item to erase.
valueThe value to use to overwrite the last elements in the array.

◆ fill()

template<typename T>
ETL_CONSTEXPR14 void etl::array< T, 0 >::fill ( parameter_t )
inline

Fills the array with the specified value.

Parameters
valueThe value to fill the array with.

◆ insert() [1/2]

template<typename T>
iterator etl::array< T, 0 >::insert ( const_iterator ,
parameter_t  )
inline

Inserts a value into the array.

Parameters
positionThe iterator to the position to insert at.
valueThe value to insert.

◆ insert() [2/2]

template<typename T>
template<typename TIterator>
iterator etl::array< T, 0 >::insert ( const_iterator ,
TIterator ,
const TIterator  )
inline

Insert into the array from the range.

Parameters
positionThe position to insert at.
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.

◆ insert_at() [1/2]

template<typename T>
iterator etl::array< T, 0 >::insert_at ( size_t ,
parameter_t  )
inline

Inserts a value into the array.

Parameters
positionThe index of the position to insert at.
valueThe value to insert.

◆ insert_at() [2/2]

template<typename T>
template<typename TIterator>
iterator etl::array< T, 0 >::insert_at ( size_t ,
TIterator ,
const TIterator  )
inline

Insert into the array from the range.

Parameters
positionThe position to insert at.
firstThe iterator to the first item in the range.
lastThe iterator to one past the final item in the range.

◆ operator[]() [1/2]

template<typename T>
ETL_NODISCARD ETL_CONSTEXPR const_reference etl::array< T, 0 >::operator[] ( size_t ) const
inline

[] operator. Returns a const reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ operator[]() [2/2]

template<typename T>
ETL_NODISCARD ETL_CONSTEXPR14 reference etl::array< T, 0 >::operator[] ( size_t )
inline

[] operator. Returns a reference to the value at index 'i'.

Parameters
iThe index of the element to access.

◆ swap()

template<typename T>
ETL_CONSTEXPR14 void etl::array< T, 0 >::swap ( array< T, 0 > & )
inline

Swaps the contents of this array and another.

Parameters
otherA reference to the other array.