3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/insert.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Intrinsic Metafunctions / insert |
template<
typename Sequence
, typename Pos
, typename T
>
struct[insert](./insert.html){
typedef_unspecified_type;
};
template<
typename Sequence
, typename T
>
struct[insert](./insert.html){
typedef_unspecified_type;
};
insert is an overloaded name:
#include <[boost/mpl/insert.hpp](../../../../boost/mpl/insert.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| Sequence | Extensible Sequence or Extensible Associative Sequence | A sequence to insert into. |
| Pos | Forward Iterator | An iterator in Sequence specifying the insertion position. |
| T | Any type | The element to be inserted. |
For any Extensible Sequence s, iterator pos in s, and arbitrary type x:
typedef[insert](./insert.html)<s,pos,x>::type r;
| Return type: |
| | Precondition: |
pos is an iterator in s.
| | Semantics: |
r is a sequence, concept-identical to s, of the following elements: [begin<s>::type, pos), x, [pos, end<s>::type).
| | Postcondition: |
The relative order of the elements in r is the same as in s.
[at](./at.html)< r,[distance](./distance.html)<[begin](./begin.html)<s>::type,pos >::type >::type
is identical to x;
[size](./size.html)<r>::value ==[size](./size.html)<s>::value + 1;
|
For any Extensible Associative Sequence s, iterator pos in s, and arbitrary type x:
typedef[insert](./insert.html)<s,x>::type r;
| Return type: | Extensible Associative Sequence | | Semantics: | r is concept-identical and equivalent to s, except that at< r, key_type<s,x>::type >::type is identical to value_type<s,x>::type. | | Postcondition: | size<r>::value == size<s>::value + 1. |
typedef[insert](./insert.html)<s,pos,x>::type r;
| Return type: | Extensible Associative Sequence | | Precondition: | pos is an iterator in s. | | Semantics: | Equivalent to typedef insert<s,x>::type r; pos is ignored. |
| Sequence archetype | Complexity |
|---|---|
| Extensible Associative Sequence | Amortized constant time. |
| Extensible Sequence | Linear in the worst case, or amortized constant time. |
typedef[vector\_c](./vector-c.html)<int,0,1,3,4,5,6,7,8,9> numbers;
typedef[find](./find.html)< numbers,[integral\_c](./integral-c.html)<int,3> >::type pos;
typedef[insert](./insert.html)< numbers,pos,[integral\_c](./integral-c.html)<int,2> >::type range;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<range>::value, ==, 10 );[BOOST\_MPL\_ASSERT](./assert.html)(([equal](./equal.html)< range,[range\_c](./range-c.html)<int,0,10> > ));
typedef[map](./map.html)< mpl::[pair](./pair.html)<int,unsigned> > m;
typedef[insert](./insert.html)<m,mpl::[pair](./pair.html)<char,long> >::type m1;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<m1>::value, ==, 2 );[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<m1,int>::type,unsigned > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<m1,char>::type,long > ));
Extensible Sequence, Extensible Associative Sequence, insert_range, push_front, push_back, erase
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |