960 lines
40 KiB
HTML
960 lines
40 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Insertion</title>
|
|
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
|
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Icl">
|
|
<link rel="up" href="../function_reference.html" title="Function Reference">
|
|
<link rel="prev" href="subtraction.html" title="Subtraction">
|
|
<link rel="next" href="erasure.html" title="Erasure">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr>
|
|
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
|
<td align="center"><a href="../../../../../../index.html">Home</a></td>
|
|
<td align="center"><a href="../../../../../libraries.htm">Libraries</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
|
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="subtraction.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../function_reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="erasure.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section boost_icl_function_reference_insertion" lang="en">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="boost_icl.function_reference.insertion"></a><a class="link" href="insertion.html" title="Insertion">Insertion</a>
|
|
</h3></div></div></div>
|
|
<div class="toc"><dl>
|
|
<dt><span class="section"><a href="insertion.html#boost_icl.function_reference.insertion.synopsis">Synopsis</a></span></dt>
|
|
<dt><span class="section"><a href="insertion.html#boost_icl.function_reference.insertion.insertion">Insertion</a></span></dt>
|
|
<dt><span class="section"><a href="insertion.html#boost_icl.function_reference.insertion.setting_values">Setting
|
|
values</a></span></dt>
|
|
</dl></div>
|
|
<div class="section boost_icl_function_reference_insertion_synopsis" lang="en">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="boost_icl.function_reference.insertion.synopsis"></a><a class="link" href="insertion.html#boost_icl.function_reference.insertion.synopsis" title="Synopsis">Synopsis</a>
|
|
</h4></div></div></div>
|
|
<div class="informaltable"><table class="table">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
<p>
|
|
<span class="emphasis"><em><span class="bold"><strong>Insertion</strong></span></em></span>
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> sets
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> maps
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
element<br> sets
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
element<br> maps
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">V</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">insert</span><span class="special">(</span><span class="keyword">const</span>
|
|
<span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">V</span> <span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span> <span class="keyword">const</span>
|
|
<span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">J</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">J</span>
|
|
<span class="identifier">pos</span><span class="special">,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">J</span> <span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span> <span class="identifier">J</span>
|
|
<span class="identifier">pos</span><span class="special">,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#itl_set_type"><span class="bold"><strong>s</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#itl_map_type"><span class="bold"><strong>m</strong></span></a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">T</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">set_at</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
<a name="boost_icl.function_reference.insertion.synopsis.insertion"></a><h6>
|
|
<a name="id1163803"></a>
|
|
<a class="link" href="insertion.html#boost_icl.function_reference.insertion.synopsis.insertion">Insertion</a>
|
|
</h6>
|
|
<p>
|
|
The effects of <span class="emphasis"><em><span class="bold"><strong>insertion</strong></span></em></span>
|
|
implemented by <code class="computeroutput"><span class="identifier">insert</span></code> and
|
|
<span class="emphasis"><em><span class="bold"><strong>addition</strong></span></em></span> implemented
|
|
by <code class="computeroutput"><span class="identifier">add</span></code> and <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+=</span></code>
|
|
are identical for all Set-types of the <span class="bold"><strong>icl</strong></span>.
|
|
</p>
|
|
<p>
|
|
For Map-types, <code class="computeroutput"><span class="identifier">insert</span></code> provides
|
|
the <span class="bold"><strong>stl</strong></span> semantics of insertion in contrast
|
|
to <code class="computeroutput"><span class="identifier">add</span></code> and <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+=</span></code>,
|
|
that implement a generalized addition, that performs aggregations if key
|
|
values collide or key intervals overlap. <code class="computeroutput"><span class="identifier">insert</span></code>
|
|
on Maps does not alter a maps content at the points, where the keys of
|
|
the object to inserted overlap or collide with keys that are already in
|
|
the map.
|
|
</p>
|
|
<a name="boost_icl.function_reference.insertion.synopsis.setting_values"></a><h6>
|
|
<a name="id1163910"></a>
|
|
<a class="link" href="insertion.html#boost_icl.function_reference.insertion.synopsis.setting_values">Setting
|
|
values</a>
|
|
</h6>
|
|
<p>
|
|
Overwriting values using <code class="computeroutput"><span class="keyword">operator</span><span class="special">[]</span></code> like in
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">my_map</span><span class="special">[</span><span class="identifier">key</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">new_value</span><span class="special">;</span>
|
|
</pre>
|
|
<p>
|
|
is not provided for <code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>
|
|
because an <code class="computeroutput"><span class="keyword">operator</span><span class="special">[]</span></code>
|
|
is not implemented for them. As a substitute a function <code class="computeroutput"><span class="identifier">T</span><span class="special">&</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
can be used to achieve the same effect:
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">my_map</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">overwrite_this</span><span class="special">,</span> <span class="identifier">new_value</span><span class="special">));</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
</div>
|
|
<div class="section boost_icl_function_reference_insertion_insertion" lang="en">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="boost_icl.function_reference.insertion.insertion"></a><a class="link" href="insertion.html#boost_icl.function_reference.insertion.insertion" title="Insertion">Insertion</a>
|
|
</h4></div></div></div>
|
|
<p>
|
|
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">// overload table for functions T\P| e i b p
|
|
</span><span class="identifier">V</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">insert</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="special">---+--------</span>
|
|
<span class="identifier">V</span> <span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="identifier">s</span> <span class="special">|</span> <span class="identifier">s</span>
|
|
<span class="identifier">m</span> <span class="special">|</span> <span class="identifier">m</span>
|
|
<span class="identifier">S</span> <span class="special">|</span> <span class="identifier">S</span>
|
|
<span class="identifier">M</span> <span class="special">|</span> <span class="identifier">M</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
<div class="table">
|
|
<a name="id1164217"></a><p class="title"><b>Table 1.27. Time Complexity for member function insert on
|
|
icl containers</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for member function insert on
|
|
icl containers">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">T</span><span class="special">::</span><span class="identifier">insert</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain<br> mapping<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> mapping<br> type
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code> </a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::map</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code><br>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized<br> O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/split_interval_set.html" title="Class template split_interval_set">split_interval_set</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code><br>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/split_interval_map.html" title="Class template split_interval_map">split_interval_map</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(n)</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<br class="table-break"><p>
|
|
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">// overload tables for function element containers: interval containers:
|
|
</span><span class="identifier">T</span><span class="special">&</span> <span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="identifier">T</span><span class="special">\</span><span class="identifier">P</span><span class="special">|</span> <span class="identifier">e</span> <span class="identifier">b</span> <span class="identifier">s</span> <span class="identifier">m</span> <span class="identifier">T</span><span class="special">\</span><span class="identifier">P</span><span class="special">|</span> <span class="identifier">e</span> <span class="identifier">i</span> <span class="identifier">b</span> <span class="identifier">p</span> <span class="identifier">S</span> <span class="identifier">M</span>
|
|
<span class="special">---+--------</span> <span class="special">---+------------</span>
|
|
<span class="identifier">s</span> <span class="special">|</span> <span class="identifier">s</span> <span class="identifier">s</span> <span class="identifier">S</span> <span class="special">|</span> <span class="identifier">S</span> <span class="identifier">S</span> <span class="identifier">S</span>
|
|
<span class="identifier">m</span> <span class="special">|</span> <span class="identifier">m</span> <span class="identifier">m</span> <span class="identifier">M</span> <span class="special">|</span> <span class="identifier">M</span> <span class="identifier">M</span> <span class="identifier">M</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
<div class="table">
|
|
<a name="id1165381"></a><p class="title"><b>Table 1.28. Time Complexity for inplace insertion on element
|
|
containers</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for inplace insertion on element
|
|
containers">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">y</span><span class="special">,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span></code>
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain<br> mapping<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> sets
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> maps
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code> </a>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::map</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m)</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<br class="table-break"><p>
|
|
Time complexity characteristics of inplace insertion for interval containers
|
|
is given by this table.
|
|
</p>
|
|
<div class="table">
|
|
<a name="id1165618"></a><p class="title"><b>Table 1.29. Time Complexity for inplace insertion on interval
|
|
containers</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for inplace insertion on interval
|
|
containers">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">y</span><span class="special">,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span></code>
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain<br> mapping<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> mapping<br> type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> sets
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval<br> maps
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
interval_sets
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code><br>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized<br> O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m log(n+m))</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><a class="link" href="../../boost/icl/split_interval_set.html" title="Class template split_interval_set">split_interval_set</a></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m log(n+m))</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
interval_maps
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m log(n+m))</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<br class="table-break"><a name="boost_icl.function_reference.insertion.insertion.hinted_insertion"></a><h5>
|
|
<a name="id1165986"></a>
|
|
<a class="link" href="insertion.html#boost_icl.function_reference.insertion.insertion.hinted_insertion">Hinted
|
|
insertion</a>
|
|
</h5>
|
|
<p>
|
|
Function <code class="computeroutput"><span class="identifier">J</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">J</span> <span class="identifier">prior</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&</span> <span class="identifier">addend</span><span class="special">)</span></code>
|
|
allows for an insertion in <span class="emphasis"><em><span class="bold"><strong>constant time</strong></span></em></span>,
|
|
if <code class="computeroutput"><span class="identifier">addend</span></code> can be inserted
|
|
right after iterator <code class="computeroutput"><span class="identifier">prior</span></code>
|
|
without collision. If this is not possible the complexity characteristics
|
|
are as stated for the non hinted insertion above. Hinted insertion is available
|
|
for these combinations of types:
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">// overload table for insertion with hint T\P| e i b p
|
|
</span><span class="identifier">J</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">J</span> <span class="identifier">pos</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="special">---+--------</span>
|
|
<span class="identifier">J</span> <span class="identifier">insert</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span> <span class="identifier">J</span> <span class="identifier">pos</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="identifier">s</span> <span class="special">|</span> <span class="identifier">s</span>
|
|
<span class="identifier">m</span> <span class="special">|</span> <span class="identifier">m</span>
|
|
<span class="identifier">S</span> <span class="special">|</span> <span class="identifier">S</span>
|
|
<span class="identifier">M</span> <span class="special">|</span> <span class="identifier">M</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
</div>
|
|
<div class="section boost_icl_function_reference_insertion_setting_values" lang="en">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="boost_icl.function_reference.insertion.setting_values"></a><a class="link" href="insertion.html#boost_icl.function_reference.insertion.setting_values" title="Setting values">Setting
|
|
values</a>
|
|
</h4></div></div></div>
|
|
<p>
|
|
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">// overload table for member function T\P| b p
|
|
</span><span class="identifier">T</span><span class="special">&</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="special">---+----</span>
|
|
<span class="identifier">T</span><span class="special">&</span> <span class="identifier">set_at</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span> <span class="identifier">m</span> <span class="special">|</span> <span class="identifier">m</span>
|
|
<span class="identifier">M</span> <span class="special">|</span> <span class="identifier">M</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
<div class="table">
|
|
<a name="id1166368"></a><p class="title"><b>Table 1.30. Time Complexity for member function `set`</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for member function `set`">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">set</span><span class="special">(</span><span class="identifier">T</span><span class="special">&,</span>
|
|
<span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code>
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
domain_mapping_type
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
interval_mapping_type
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
icl::map
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
interval_maps
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized<br> O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<br class="table-break">
|
|
</div>
|
|
<p>
|
|
<span class="emphasis"><em><span class="bold"><strong>See also . . .</strong></span></em></span>
|
|
</p>
|
|
<div class="informaltable"><table class="table">
|
|
<colgroup><col></colgroup>
|
|
<thead><tr></tr></thead>
|
|
<tbody>
|
|
<tr><td>
|
|
<p>
|
|
<a class="link" href="addition.html" title="Addition"><span class="emphasis"><em><span class="bold"><strong>Erasure</strong></span></em></span></a>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td>
|
|
<p>
|
|
<a class="link" href="addition.html" title="Addition"><span class="emphasis"><em><span class="bold"><strong>Addition</strong></span></em></span></a>
|
|
</p>
|
|
</td></tr>
|
|
</tbody>
|
|
</table></div>
|
|
<p>
|
|
<span class="emphasis"><em><span class="bold"><strong>Back to section . . .</strong></span></em></span>
|
|
</p>
|
|
<div class="informaltable"><table class="table">
|
|
<colgroup><col></colgroup>
|
|
<thead><tr></tr></thead>
|
|
<tbody>
|
|
<tr><td>
|
|
<p>
|
|
<a class="link" href="../interface/function_synopsis.html#function_synopsis_table"><span class="emphasis"><em><span class="bold"><strong>Function
|
|
Synopsis</strong></span></em></span></a>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td>
|
|
<p>
|
|
<a class="link" href="../interface.html" title="Interface"><span class="emphasis"><em><span class="bold"><strong>Interface</strong></span></em></span></a>
|
|
</p>
|
|
</td></tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"></td>
|
|
<td align="right"><div class="copyright-footer">Copyright © 2007 -2010 Joachim Faulhaber<br>Copyright © 1999 -2006 Cortex Software GmbH<p>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
|
</p>
|
|
</div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="subtraction.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../function_reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="erasure.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|