...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Returns a new sequence with all the elements of the original, an a new element inserted the position described by a given iterator.
template<
typename Sequence,
typename Pos,
typename T
>
typename result_of::insert
<Sequence const, Pos, T>::type insert(
Sequence const& seq, Pos const& pos, T const& t);
Table 1.78. Parameters
Parameter |
Requirement |
Description |
---|---|---|
|
A model of Forward Sequence |
Operation's argument |
|
A model of Forward Iterator |
The position to insert at |
|
Any type |
The value to insert |
insert
(seq, pos, t);
Return type:
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
.
Constant. Returns a view which is lazily evaluated.
#include <boost/fusion/algorithm/transformation/insert.hpp> #include <boost/fusion/include/insert.hpp>
constvector
<int,int> vec(1,2); assert(insert
(vec,next
(begin
(vec)), 3) ==make_vector
(1,3,2));