Embedded Template Library 1.0
etl::front_insert_iterator< TContainer > Class Template Reference

Turns assignment into insertion. More...

#include <iterator.h>

Public Types

typedef TContainer container_type
 A nested typedef for the type of whatever container you used.
 
- Public Types inherited from etl::iterator< ETL_OR_STD::output_iterator_tag, void, void, void, void >
typedef void value_type
 
typedef void difference_type
 
typedef void pointer
 
typedef void reference
 
typedef ETL_OR_STD::output_iterator_tag iterator_category
 

Public Member Functions

ETL_CONSTEXPR14 front_insert_iterator (TContainer &c)
 
ETL_CONSTEXPR14 front_insert_iteratoroperator= (const typename TContainer::value_type &value)
 
ETL_NODISCARD ETL_CONSTEXPR14 front_insert_iteratoroperator* ()
 
ETL_CONSTEXPR14 front_insert_iteratoroperator++ ()
 
ETL_CONSTEXPR14 front_insert_iterator operator++ (int)
 

Protected Attributes

TContainer * container
 

Detailed Description

template<typename TContainer>
class etl::front_insert_iterator< TContainer >

Turns assignment into insertion.

These are output iterators, constructed from a container-of-T. Assigning a T to the iterator prepends it to the container using push_front.

Tip: Using the front_inserter function to create these iterators can save typing.

Template Parameters
TContainerThe container type.

Constructor & Destructor Documentation

◆ front_insert_iterator()

template<typename TContainer >
ETL_CONSTEXPR14 etl::front_insert_iterator< TContainer >::front_insert_iterator ( TContainer &  c)
inlineexplicit

Constructor The only way to create this iterator is with a container.

Member Function Documentation

◆ operator*()

template<typename TContainer >
ETL_NODISCARD ETL_CONSTEXPR14 front_insert_iterator & etl::front_insert_iterator< TContainer >::operator* ( )
inline

Dereference operator. Simply returns *this.

◆ operator++() [1/2]

template<typename TContainer >
ETL_CONSTEXPR14 front_insert_iterator & etl::front_insert_iterator< TContainer >::operator++ ( )
inline

Pre-increment operator. Simply returns *this. (This iterator does not move.)

◆ operator++() [2/2]

template<typename TContainer >
ETL_CONSTEXPR14 front_insert_iterator etl::front_insert_iterator< TContainer >::operator++ ( int  )
inline

Post-increment operator. Simply returns *this. (This iterator does not move.)

◆ operator=()

template<typename TContainer >
ETL_CONSTEXPR14 front_insert_iterator & etl::front_insert_iterator< TContainer >::operator= ( const typename TContainer::value_type &  value)
inline

This kind of iterator doesn't really have a position in the container (you can think of the position as being permanently at the front, if you like). Assigning a value to the iterator will always prepend the value to the front of the container.

Parameters
valueAn instance of whatever type container_type::const_reference is; presumably a reference-to-const T for container<T>.
Returns
This iterator, for chained operations.

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