Embedded Template Library  1.0
array

Classes

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

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
 exception (string_type reason_, string_type file_, numeric_type line_)
 Constructor.
 
string_type what () const
 
string_type file_name () const
 
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
 exception (string_type reason_, string_type file_, numeric_type line_)
 Constructor.
 
string_type what () const
 
string_type file_name () const
 
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, const size_t SIZE_>
class etl::array< T, SIZE_ >

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

Public Types

enum  { SIZE = SIZE_ }
 
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

reference at (size_t i)
 
const_reference at (size_t i) const
 
reference operator[] (size_t i)
 
const_reference operator[] (size_t i) const
 
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 buffer.
 
const_pointer data () const
 Returns a const pointer to the first element of the internal buffer.
 
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.
 
bool empty () const
 Returns true if the array size is zero.
 
size_t size () const
 Returns the size of the array.
 
size_t max_size () const
 Returns the maximum possible size of the array.
 
void fill (parameter_t value)
 
void swap (array &other)
 
template<typename TIterator >
void assign (TIterator first, const TIterator last)
 
template<typename TIterator >
void 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.
 

Member Function Documentation

◆ assign() [1/2]

template<typename T , const size_t SIZE_>
template<typename TIterator >
void 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 ramge.
lastThe iterator to one past the final item in the range.

◆ assign() [2/2]

template<typename T , const size_t SIZE_>
template<typename TIterator >
void 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 ramge.
lastThe iterator to one past the final item in the range.

◆ at() [1/2]

template<typename T , const size_t SIZE_>
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.

◆ at() [2/2]

template<typename T , const size_t SIZE_>
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.

◆ erase() [1/4]

template<typename T , const 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 , const 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
positionThe iterator to the position to erase at.
valueThe value to use to overwrite the last elements in the array.

◆ erase() [3/4]

template<typename T , const 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 , const 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 , const 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 , const 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 , const 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 , const 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 , const size_t SIZE_>
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 , const 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 , const 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 , const 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 , const 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 , const size_t SIZE_>
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.

◆ operator[]() [2/2]

template<typename T , const size_t SIZE_>
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.

◆ swap()

template<typename T , const size_t SIZE_>
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.