Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

The MPL Reference Manual: front_inserter
Front Page / Algorithms / Inserters / front_inserter

front_inserter

Synopsis

template<
      typename Seq
    >
struct front_inserter
{
    // unspecified
    // ...
};

Description

Inserts elements at the beginning of the sequence.

Parameters

Parameter Requirement Description
Seq Front Extensible Sequence A sequence to bind the inserter to.

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Inserter.

For any Front Extensible Sequence s:

Expression Semantics
front_inserter<s>

An Inserter in, equivalent to

struct in : inserter<s,push_front<_1,_2> > {};

Complexity

Amortized constant time.

Example

typedef reverse_copy<
      range_c<int,0,5>
    , front_inserter< vector_c<int,5,6,7,8,9> >
    >::type range;

BOOST_MPL_ASSERT(( equal< range, range_c<int,0,10> > ));