mirror of
https://github.com/boostorg/mpl.git
synced 2026-01-26 17:02:20 +01:00
62 lines
3.7 KiB
HTML
62 lines
3.7 KiB
HTML
<!doctype html public "-//ietf//dtd html//en">
|
|
<html><head><title>boost::mpl::Reference/insert range</title>
|
|
<link rel="stylesheet" href="../mpl_wiki.css">
|
|
</head><body bgcolor="white">
|
|
<h1><a href="../Table_of_Content.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>insert_range</h1><h3>Synopsis</h3>
|
|
<p>
|
|
<pre>
|
|
template<
|
|
typename Sequence
|
|
, typename Pos
|
|
, typename Range
|
|
>
|
|
struct insert_range
|
|
{
|
|
typedef <em>unspecified</em> type;
|
|
};
|
|
</pre>
|
|
<p>
|
|
<h3>Description</h3>
|
|
<p>
|
|
<code>insert_range</code> performs an insertion of a range of elements at an arbitrary position in the sequence. The algorithm returns a new sequence which contains all the elements of <code>Sequence</code> plus all the elements of <code>Range</code> starting at the <code>distance< begin<Sequence>::type,Pos >::type</code> position from the beginning. The result sequence preserves all the functional and performance characteristics of the original <code>Sequence</code>, except its size and identity.
|
|
<p>
|
|
<h3>Definition</h3>
|
|
<p>
|
|
<pre>
|
|
#include "<a href="../../../../../\boost/mpl/insert_range.hpp">boost/mpl/insert_range.hpp</a>"
|
|
</pre>
|
|
<p>
|
|
<h3>Parameters</h3>
|
|
<table border="1">
|
|
<tr><th> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
|
<tr><td><code>Sequence</code></td><td>A model of <a href="../Extensible_Sequence.html">Extensible Sequence</a></td><td>A sequence to handle the insert operation. </td></tr>
|
|
<tr><td><code>Pos</code></td><td>A model of <a href="../Forward_Iterator.html">Forward Iterator</a></td><td>An insert position in the <code>Sequence</code>. </td></tr>
|
|
<tr><td><code>Range</code></td><td>A model of <a href="../Sequence.html">Sequence</a></td><td>The range of elements to be inserted. </td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Expression semantics</h3>
|
|
<p>
|
|
<table border="1">
|
|
<tr><th> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
|
<tr><td><code>typedef insert<Sequence,pos,range>::type s;</code></td><td>A model of <a href="../Extensible_Sequence.html">Extensible Sequence</a></td><td><code>pos</code> is a valid iterator in <code>Sequence</code>.</td><td><code>s</code> contains all the elements from <code>range</code> starting at the <code>distance< begin<Sequence>::type,pos >::type</code> position.</td><td><code>size<s>::type::value == size<Sequence>::type::value + size<range>::type::value</code>; the relative order of the elements in <code>s</code> is the same as in <code>Sequence</code>. </td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Complexity</h3>
|
|
<p>
|
|
Linear time.
|
|
<p>
|
|
<h3>Example</h3>
|
|
<p>
|
|
<pre>
|
|
typedef <a href="../Reference/list_c.html">list_c</a><int,0,1,7,8,9> numbers;
|
|
typedef <a href="../Reference/find.html">find</a>< numbers,integral_c<int,7> >::type pos;
|
|
typedef insert_range< numbers,pos,<a href="../Reference/range_c.html">range_c</a><int,2,7> >::type range;
|
|
BOOST_STATIC_ASSERT(<a href="../Reference/size.html">size</a><range>::type::value == 10);
|
|
BOOST_STATIC_ASSERT((<a href="../Reference/equal.html">equal</a>< range,<a href="../Reference/range_c.html">range_c</a><int,0,10> >::type::value));
|
|
</pre>
|
|
<p>
|
|
<h3>See also</h3>
|
|
<p>
|
|
<a href="../Extensible_Sequence.html">Extensible Sequence</a>, <code><a href="../Reference/insert.html">insert</a></code>, <code><a href="../Reference/push_front.html">push_front</a></code>, <code><a href="../Reference/push_back.html">push_back</a></code>, <code><a href="../Reference/erase.html">erase</a></code>
|
|
<p><hr>
|
|
<a href="../Table_of_Content.html">Table of Content</a> | <a href="../Reference.html">Reference</a><br>Last edited July 22, 2002 4:32 pm</body></html> |