Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

array< T, SIZE_ > Class Template Reference

array< T, SIZE_ > Class Template Reference
[array]

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

#include <array.h>

Public Member Functions

reference at (size_t i)
 Returns a reference to the value at index 'i'.
const_reference at (size_t i) const
 Returns a const reference to the value at index 'i'.
reference operator[] (size_t i)
 [] operator.
const_reference operator[] (size_t i) const
 [] operator.
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_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)
 Fills the array with the specified value.
void swap (array &other)
 Swaps the contents of this array and another.
template<typename TIterator >
void assign (TIterator first, const TIterator last)
 Fills the array from the range.
template<typename TIterator >
void assign (TIterator first, const TIterator last, parameter_t value)
 Fills the array from the range.
iterator insert_at (size_t position, parameter_t value)
 Inserts a value into the array.
iterator insert (const_iterator position, parameter_t value)
 Inserts a value into the array.
template<typename TIterator >
iterator insert_at (size_t position, TIterator first, const TIterator last)
 Insert into the array from the range.
template<typename TIterator >
iterator insert (const_iterator position, TIterator first, const TIterator last)
 Insert into the array from the range.
iterator erase_at (size_t position)
 Erases a value from the array.
iterator erase (const_iterator position)
 Erases a value from the array.
iterator erase_range (size_t first, size_t last)
 Erases a range of values from the array.
iterator erase (const_iterator first, const_iterator last)
 Erases a range of values from the array.
iterator erase_at (size_t position, parameter_t value)
 Erases a value from the array.
iterator erase (const_iterator position, parameter_t value)
 Erases a value from the array.
iterator erase_range (size_t first, size_t last, parameter_t value)
 Erases a range of values from the array.
iterator erase (const_iterator first, const_iterator last, parameter_t value)
 Erases a range of values from the array.

Data Fields

_buffer [SIZE]
 The array data.

Detailed Description

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

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

Definition at line 86 of file array.h.


Member Function Documentation

void assign ( TIterator  first,
const TIterator  last 
)

Fills the array from the range.

If the range is larger than the array then the extra data is ignored. 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.

Definition at line 366 of file array.h.

void assign ( TIterator  first,
const TIterator  last,
parameter_t  value 
)

Fills the array from the range.

If the range is larger than the array then the extra data is ignored. 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.

Definition at line 379 of file array.h.

const_reference at ( size_t  i ) const

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

Parameters:
iThe index of the element to access.

Definition at line 130 of file array.h.

reference at ( size_t  i )

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

Parameters:
iThe index of the element to access.

Definition at line 119 of file array.h.

const_reference back (  ) const

Returns a const reference to the last element.

Definition at line 184 of file array.h.

reference back (  )

Returns a reference to the last element.

Definition at line 176 of file array.h.

iterator begin (  )

Returns an iterator to the beginning of the array.

Definition at line 212 of file array.h.

const_iterator begin (  ) const

Returns a const iterator to the beginning of the array.

Definition at line 220 of file array.h.

const_iterator cbegin (  ) const

Returns a const iterator to the beginning of the array.

Definition at line 228 of file array.h.

const_reverse_iterator crbegin (  ) const

Returns a const reverse iterator to the reverse beginning of the array.

Definition at line 276 of file array.h.

const_reverse_iterator crend (  ) const

Returns a const reverse iterator to the end of the array.

Definition at line 300 of file array.h.

pointer data (  )

Returns a pointer to the first element of the internal buffer.

Definition at line 192 of file array.h.

const_pointer data (  ) const

Returns a const pointer to the first element of the internal buffer.

Definition at line 200 of file array.h.

bool empty (  ) const

Returns true if the array size is zero.

Definition at line 312 of file array.h.

iterator end (  )

Returns an iterator to the end of the array.

Definition at line 236 of file array.h.

const_iterator end (  ) const

Returns a const iterator to the end of the array.

Definition at line 244 of file array.h.

iterator erase ( const_iterator  position )

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.

Definition at line 468 of file array.h.

iterator erase ( const_iterator  first,
const_iterator  last 
)

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.

Definition at line 493 of file array.h.

iterator erase ( const_iterator  first,
const_iterator  last,
parameter_t  value 
)

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.

Definition at line 541 of file array.h.

iterator erase ( const_iterator  position,
parameter_t  value 
)

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.

Definition at line 515 of file array.h.

iterator erase_at ( size_t  position )

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.

Definition at line 458 of file array.h.

iterator erase_at ( size_t  position,
parameter_t  value 
)

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.

Definition at line 505 of file array.h.

iterator erase_range ( size_t  first,
size_t  last,
parameter_t  value 
)

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.

Definition at line 531 of file array.h.

iterator erase_range ( size_t  first,
size_t  last 
)

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.

Definition at line 482 of file array.h.

void fill ( parameter_t  value )

Fills the array with the specified value.

Parameters:
valueThe value to fill the array with.

Definition at line 341 of file array.h.

const_reference front (  ) const

Returns a const reference to the first element.

Definition at line 168 of file array.h.

reference front (  )

Returns a reference to the first element.

Definition at line 160 of file array.h.

iterator insert ( const_iterator  position,
TIterator  first,
const TIterator  last 
)

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.

Definition at line 432 of file array.h.

iterator insert ( const_iterator  position,
parameter_t  value 
)

Inserts a value into the array.

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

Definition at line 403 of file array.h.

iterator insert_at ( size_t  position,
TIterator  first,
const TIterator  last 
)

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.

Definition at line 420 of file array.h.

iterator insert_at ( size_t  position,
parameter_t  value 
)

Inserts a value into the array.

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

Definition at line 393 of file array.h.

size_t max_size (  ) const

Returns the maximum possible size of the array.

Definition at line 328 of file array.h.

reference operator[] ( size_t  i )

[] operator.

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

Parameters:
iThe index of the element to access.

Definition at line 142 of file array.h.

const_reference operator[] ( size_t  i ) const

[] operator.

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

Parameters:
iThe index of the element to access.

Definition at line 152 of file array.h.

const_reverse_iterator rbegin (  ) const

Returns a const reverse iterator to the reverse beginning of the array.

Definition at line 268 of file array.h.

reverse_iterator rend (  )

Returns a reverse iterator to the end of the array.

Definition at line 284 of file array.h.

const_reverse_iterator rend (  ) const

Returns a const reverse iterator to the end of the array.

Definition at line 292 of file array.h.

size_t size (  ) const

Returns the size of the array.

Definition at line 320 of file array.h.

void swap ( array< T, SIZE_ > &  other )

Swaps the contents of this array and another.

Parameters:
otherA reference to the other array.

Definition at line 350 of file array.h.


Field Documentation

T _buffer[SIZE]

The array data.

Definition at line 552 of file array.h.