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

PrevUpHomeNext
insert_range
Description

Returns a new sequence with another sequence inserted at a specified iterator.

Synopsis
template<
    typename Sequence,
    typename Pos,
    typename Range
    >
typename result_of::insert_range<Sequence const, Pos, Range>::type insert_range(
    Sequence const& seq, Pos const& pos, Range const& range);

Table 1.79. Parameters

Parameter

Requirement

Description

seq

A model of Forward Sequence

Operation's argument

pos

A model of Forward Iterator

The position to insert at

range

A model of Forward Sequence

Range to insert


Expression Semantics
insert_range(seq, pos, range);

Return type:

Semantics: Returns a new sequence, containing all the elements of seq, and the elements of range inserted at iterator pos. All elements retaining their ordering from the original sequences.

Complexity

Constant. Returns a view which is lazily evaluated.

Header
#include <boost/fusion/algorithm/transformation/insert_range.hpp>
#include <boost/fusion/include/insert_range.hpp>
Example
const vector<int,int> vec(1,2);
assert(insert_range(vec, next(begin(vec)), make_vector(3,4)) == make_vector(1,3,4,2));

PrevUpHomeNext