858 lines
38 KiB
HTML
858 lines
38 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Erasure</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="insertion.html" title="Insertion">
|
|
<link rel="next" href="intersection.html" title="Intersection">
|
|
</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="insertion.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="intersection.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section boost_icl_function_reference_erasure" lang="en">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="boost_icl.function_reference.erasure"></a><a class="link" href="erasure.html" title="Erasure">Erasure</a>
|
|
</h3></div></div></div>
|
|
<div class="toc"><dl>
|
|
<dt><span class="section"><a href="erasure.html#boost_icl.function_reference.erasure.synopsis">Synopsis</a></span></dt>
|
|
<dt><span class="section"><a href="erasure.html#boost_icl.function_reference.erasure.erasure_of_objects">Erasure
|
|
of Objects</a></span></dt>
|
|
<dt><span class="section"><a href="erasure.html#boost_icl.function_reference.erasure.erasure_by_iterators">Erasure
|
|
by Iterators</a></span></dt>
|
|
</dl></div>
|
|
<div class="section boost_icl_function_reference_erasure_synopsis" lang="en">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="boost_icl.function_reference.erasure.synopsis"></a><a class="link" href="erasure.html#boost_icl.function_reference.erasure.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>Erasure</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">T</span><span class="special">&</span>
|
|
<span class="identifier">T</span><span class="special">::</span><span class="identifier">erase</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_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#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>
|
|
<a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="identifier">T</span><span class="special">&</span>
|
|
<span class="identifier">erase</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_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>
|
|
<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="keyword">void</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="keyword">void</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">iterator</span><span class="special">,</span><span class="identifier">iterator</span><span class="special">)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
<a name="boost_icl.function_reference.erasure.synopsis.erasure"></a><h6>
|
|
<a name="id1167178"></a>
|
|
<a class="link" href="erasure.html#boost_icl.function_reference.erasure.synopsis.erasure">Erasure</a>
|
|
</h6>
|
|
<p>
|
|
The effects of <span class="emphasis"><em><span class="bold"><strong>erasure</strong></span></em></span>
|
|
implemented by <code class="computeroutput"><span class="identifier">erase</span></code> and
|
|
<span class="emphasis"><em><span class="bold"><strong>subtraction</strong></span></em></span> implemented
|
|
by <code class="computeroutput"><span class="identifier">subtract</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">erase</span></code> provides
|
|
the <span class="bold"><strong>stl</strong></span> semantics of erasure in contrast
|
|
to <code class="computeroutput"><span class="identifier">subtract</span></code> and <code class="computeroutput"><span class="keyword">operator</span> <span class="special">-=</span></code>,
|
|
that implement a generalized subtraction, that performs inverse aggregations
|
|
if key values collide or key intervals overlap.
|
|
</p>
|
|
<p>
|
|
Using iterators it is possible to erase objects or ranges of objects the
|
|
iterator is pointing at from icl Sets and Maps.
|
|
</p>
|
|
</div>
|
|
<div class="section boost_icl_function_reference_erasure_erasure_of_objects" lang="en">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="boost_icl.function_reference.erasure.erasure_of_objects"></a><a class="link" href="erasure.html#boost_icl.function_reference.erasure.erasure_of_objects" title="Erasure of Objects">Erasure
|
|
of Objects</a>
|
|
</h4></div></div></div>
|
|
<p>
|
|
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">/* overload table for */</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">T</span><span class="special">&</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">erase</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">erase</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">S</span>
|
|
<span class="identifier">M</span> <span class="special">|</span> <span class="identifier">M</span> <span class="identifier">M</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
The next table contains complexity characteristics for the <code class="computeroutput"><span class="identifier">erase</span></code> function on elements and segments.
|
|
</p>
|
|
<div class="table">
|
|
<a name="id1168579"></a><p class="title"><b>Table 1.31. Time Complexity for erasure of elements and segments
|
|
on icl containers</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for erasure of elements and segments
|
|
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">erase</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&)</span></code><br> <code class="computeroutput"><span class="identifier">T</span><span class="special">&</span> <span class="identifier">erase</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<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>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</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_sets</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/interval_map.html" title="Class template interval_map">interval_maps</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>
|
|
<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>
|
|
As presented in the overload tables for inplace function <code class="computeroutput"><span class="identifier">erase</span></code> below, more type combinations are
|
|
available for <span class="emphasis"><em>erasure</em></span> than for <span class="emphasis"><em>insertion</em></span>.
|
|
</p>
|
|
<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">erase</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="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> <span class="identifier">M</span> <span class="identifier">M</span> <span class="identifier">M</span>
|
|
</pre>
|
|
<p>
|
|
We can split up these overloads in two groups. The first group can be called
|
|
<span class="emphasis"><em>reverse insertion</em></span>.
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">/* (1) Reverse insertion */</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>
|
|
The second group can be viewed as an <span class="emphasis"><em>erasure by key objects</em></span>
|
|
|
|
</p>
|
|
<pre class="programlisting"><span class="comment">/* (2) Erasure by key objects */</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>
|
|
<p>
|
|
On Maps <span class="emphasis"><em><span class="bold"><strong>reverse insertion (1)</strong></span></em></span>
|
|
is different from <span class="bold"><strong>stl's</strong></span> erase semantics,
|
|
because value pairs are deleted only, if key <span class="emphasis"><em><span class="bold"><strong>and</strong></span></em></span>
|
|
data values are found. Only <span class="emphasis"><em><span class="bold"><strong>erasure by
|
|
key objects (2)</strong></span></em></span> works like the erase function on
|
|
<span class="bold"><strong>stl's</strong></span> std::maps, that passes a <span class="emphasis"><em><span class="bold"><strong>key value</strong></span></em></span> as argument.
|
|
</p>
|
|
<p>
|
|
On Sets both function groups fall together as <span class="emphasis"><em><span class="bold"><strong>set
|
|
difference</strong></span></em></span>.
|
|
</p>
|
|
<p>
|
|
Complexity characteristics for inplace erasure operations are given by
|
|
the next tables where
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">n</span> <span class="special">=</span> <span class="identifier">iterative_size</span><span class="special">(</span><span class="identifier">y</span><span class="special">);</span>
|
|
<span class="identifier">m</span> <span class="special">=</span> <span class="identifier">iterative_size</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">//if P is a container type
|
|
</span></pre>
|
|
<p>
|
|
</p>
|
|
<div class="table">
|
|
<a name="id1169691"></a><p class="title"><b>Table 1.32. Time Complexity for inplace erasure on element
|
|
containers</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for inplace erasure 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">erase</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>
|
|
std::set
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
icl::map
|
|
</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 log n)</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>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m log n)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(m log n)</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
</div>
|
|
<br class="table-break"><div class="table">
|
|
<a name="id1169926"></a><p class="title"><b>Table 1.33. Time Complexity for inplace erasure on
|
|
interval containers</b></p>
|
|
<div class="table-contents"><table class="table" summary="Time Complexity for inplace erasure on
|
|
interval containers">
|
|
<colgroup>
|
|
<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">erase</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>
|
|
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>
|
|
<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>
|
|
interval_maps
|
|
</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>
|
|
<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>
|
|
<span class="emphasis"><em>O(m log(n+m))</em></span>
|
|
</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">
|
|
</div>
|
|
<div class="section boost_icl_function_reference_erasure_erasure_by_iterators" lang="en">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="boost_icl.function_reference.erasure.erasure_by_iterators"></a><a class="link" href="erasure.html#boost_icl.function_reference.erasure.erasure_by_iterators" title="Erasure by Iterators">Erasure
|
|
by Iterators</a>
|
|
</h4></div></div></div>
|
|
<p>
|
|
The next table shows the <span class="bold"><strong>icl</strong></span> containers
|
|
that erasure with iterators is available for. Erase on iterators erases
|
|
always one <code class="computeroutput"><span class="identifier">value</span></code> of <code class="computeroutput"><span class="identifier">value_type</span></code> for an iterator pointing to
|
|
it. So we erase
|
|
</p>
|
|
<div class="itemizedlist"><ul type="disc">
|
|
<li>
|
|
elements from <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">sets</span></code></a>
|
|
</li>
|
|
<li>
|
|
element-value pairs from <code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::maps</a></code>
|
|
</li>
|
|
<li>
|
|
intervals from <code class="computeroutput"><a class="link" href="../../boost/icl/interval_set.html" title="Class template interval_set">interval_sets</a></code>
|
|
and
|
|
</li>
|
|
<li>
|
|
interval-value-pairs from <code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>
|
|
</li>
|
|
</ul></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>Erasure by iterators</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="keyword">void</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">iterator</span>
|
|
<span class="identifier">pos</span><span class="special">)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized O(1)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized O(1)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized O(1)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>amortized O(1)</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<code class="computeroutput"><span class="keyword">void</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">iterator</span>
|
|
<span class="identifier">first</span><span class="special">,</span>
|
|
<span class="identifier">iterator</span> <span class="identifier">past</span><span class="special">)</span></code>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(k)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(k)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(k)</em></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="emphasis"><em>O(k)</em></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
<p>
|
|
Erasing by a single iterator need only <span class="emphasis"><em><span class="bold"><strong>amortized
|
|
constant time</strong></span></em></span>. Erasing via a range of iterators
|
|
<code class="computeroutput"><span class="special">[</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">past</span><span class="special">)</span></code> is of <span class="emphasis"><em><span class="bold"><strong>linear
|
|
time</strong></span></em></span> in the number <code class="computeroutput"><span class="identifier">k</span></code>
|
|
of iterators in range <code class="computeroutput"><span class="special">[</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">past</span><span class="special">)</span></code>.
|
|
</p>
|
|
</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="insertion.html" title="Insertion"><span class="emphasis"><em><span class="bold"><strong>Insertion</strong></span></em></span></a>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td>
|
|
<p>
|
|
<a class="link" href="subtraction.html" title="Subtraction"><span class="emphasis"><em><span class="bold"><strong>Subtraction</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="insertion.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="intersection.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|