Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
insert
Description

Returns a new sequence with all the elements of the original, an a new element inserted the position described by a given iterator.

Synposis
template<
    typename Sequence,
    typename Pos,
    typename T
    >
unspecified insert(Sequence const& seq, Pos const& pos, T const& t);

Parameters

Parameter Requirement Description
seq A model of Forward Sequence Operation's argument
pos A model of Forward Iterator The position to insert at
t Any type The value to insert
Expression Semantics
insert(seq, p, t);

Return type: A model of Forward Sequence.

Semantics: Returns a new sequence, containing all the elements of seq, in their original order, and a new element with the type and value of t inserted at iterator pos.

Complexity

Constant. Returns a view which is lazily evaluated.

Header
#include <boost/fusion/algorithm/transformation/insert.hpp>
Example
const vector<int,int> vec(1,2);
assert(insert(vec, next(begin(vec)), 3) == make_vector(1,3,2));
Copyright © 2001-2005 Joel de Guzman, Dan Marsden

PrevUpHomeNext