• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Subtraction</title>
5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Icl">
8<link rel="up" href="../function_reference.html" title="Function Reference">
9<link rel="prev" href="addition.html" title="Addition">
10<link rel="next" href="insertion.html" title="Insertion">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="addition.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="insertion.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_icl.function_reference.subtraction"></a><a class="link" href="subtraction.html" title="Subtraction">Subtraction</a>
28</h3></div></div></div>
29<div class="toc"><dl class="toc">
30<dt><span class="section"><a href="subtraction.html#boost_icl.function_reference.subtraction.synopsis">Synopsis</a></span></dt>
31<dt><span class="section"><a href="subtraction.html#boost_icl.function_reference.subtraction.functions">Functions</a></span></dt>
32<dt><span class="section"><a href="subtraction.html#boost_icl.function_reference.subtraction.inplace_operators">Inplace
33        operators</a></span></dt>
34<dt><span class="section"><a href="subtraction.html#boost_icl.function_reference.subtraction.infix_operators">Infix
35        operators</a></span></dt>
36<dt><span class="section"><a href="subtraction.html#boost_icl.function_reference.subtraction.subtraction_on_intervals">Subtraction
37        on Intervals</a></span></dt>
38</dl></div>
39<div class="section">
40<div class="titlepage"><div><div><h4 class="title">
41<a name="boost_icl.function_reference.subtraction.synopsis"></a><a class="link" href="subtraction.html#boost_icl.function_reference.subtraction.synopsis" title="Synopsis">Synopsis</a>
42</h4></div></div></div>
43<div class="informaltable"><table class="table">
44<colgroup>
45<col>
46<col>
47<col>
48<col>
49<col>
50<col>
51</colgroup>
52<thead><tr>
53<th>
54                  <p>
55                    Subtraction
56                  </p>
57                </th>
58<th>
59                  <p>
60                    intervals
61                  </p>
62                </th>
63<th>
64                  <p>
65                    interval<br> sets
66                  </p>
67                </th>
68<th>
69                  <p>
70                    interval<br> maps
71                  </p>
72                </th>
73<th>
74                  <p>
75                    element<br> sets
76                  </p>
77                </th>
78<th>
79                  <p>
80                    element<br> maps
81                  </p>
82                </th>
83</tr></thead>
84<tbody>
85<tr>
86<td>
87                  <p>
88                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
89                    <span class="identifier">T</span><span class="special">::</span><span class="identifier">subtract</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
90                  </p>
91                </td>
92<td>
93                </td>
94<td>
95                  <p>
96                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
97                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
98                  </p>
99                </td>
100<td>
101                  <p>
102                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
103                    <a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
104                  </p>
105                </td>
106<td>
107                </td>
108<td>
109                  <p>
110                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
111                  </p>
112                </td>
113</tr>
114<tr>
115<td>
116                  <p>
117                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
118                    <span class="identifier">subtract</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp;,</span>
119                    <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
120                  </p>
121                </td>
122<td>
123                </td>
124<td>
125                  <p>
126                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
127                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
128                  </p>
129                </td>
130<td>
131                  <p>
132                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
133                    <a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
134                  </p>
135                </td>
136<td>
137                  <p>
138                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
139                  </p>
140                </td>
141<td>
142                  <p>
143                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
144                  </p>
145                </td>
146</tr>
147<tr>
148<td>
149                  <p>
150                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
151                    <span class="keyword">operator</span> <span class="special">-=(</span><span class="identifier">T</span><span class="special">&amp;,</span>
152                    <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
153                  </p>
154                </td>
155<td>
156                </td>
157<td>
158                  <p>
159                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
160                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
161                    <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
162                  </p>
163                </td>
164<td>
165                  <p>
166                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
167                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
168                    <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
169                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
170                    <a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
171                    <a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
172                  </p>
173                </td>
174<td>
175                  <p>
176                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
177                    <a class="link" href="../interface/function_synopsis.html#itl_set_type"><span class="bold"><strong>s</strong></span></a>
178                  </p>
179                </td>
180<td>
181                  <p>
182                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
183                    <a class="link" href="../interface/function_synopsis.html#itl_map_type"><span class="bold"><strong>m</strong></span></a>
184                  </p>
185                </td>
186</tr>
187<tr>
188<td>
189                  <p>
190                    <code class="computeroutput"><span class="identifier">T</span> <span class="keyword">operator</span>
191                    <span class="special">-</span> <span class="special">(</span><span class="identifier">T</span><span class="special">,</span>
192                    <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
193                  </p>
194                </td>
195<td>
196                </td>
197<td>
198                  <p>
199                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
200                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
201                    <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
202                  </p>
203                </td>
204<td>
205                  <p>
206                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
207                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
208                    <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
209                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
210                    <a class="link" href="../interface/function_synopsis.html#interval_mapping_type"><span class="bold"><strong>p</strong></span></a>
211                    <a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
212                  </p>
213                </td>
214<td>
215                  <p>
216                    <a class="link" href="../interface/function_synopsis.html#element_type"><span class="bold"><strong>e</strong></span></a>
217                    <a class="link" href="../interface/function_synopsis.html#itl_set_type"><span class="bold"><strong>s</strong></span></a>
218                  </p>
219                </td>
220<td>
221                  <p>
222                    <a class="link" href="../interface/function_synopsis.html#element_mapping_type"><span class="bold"><strong>b</strong></span></a>
223                    <a class="link" href="../interface/function_synopsis.html#itl_map_type"><span class="bold"><strong>m</strong></span></a>
224                  </p>
225                </td>
226</tr>
227<tr>
228<td>
229                  <p>
230                    <code class="computeroutput"><span class="identifier">T</span> <span class="identifier">left_subtract</span><span class="special">(</span><span class="identifier">T</span><span class="special">,</span> <span class="keyword">const</span>
231                    <span class="identifier">T</span><span class="special">&amp;)</span></code>
232                  </p>
233                </td>
234<td>
235                  <p>
236                    1
237                  </p>
238                </td>
239<td>
240                </td>
241<td>
242                </td>
243<td>
244                </td>
245<td>
246                </td>
247</tr>
248<tr>
249<td>
250                  <p>
251                    <code class="computeroutput"><span class="identifier">T</span> <span class="identifier">right_subtract</span><span class="special">(</span><span class="identifier">T</span><span class="special">,</span> <span class="keyword">const</span>
252                    <span class="identifier">T</span><span class="special">&amp;)</span></code>
253                  </p>
254                </td>
255<td>
256                  <p>
257                    1
258                  </p>
259                </td>
260<td>
261                </td>
262<td>
263                </td>
264<td>
265                </td>
266<td>
267                </td>
268</tr>
269</tbody>
270</table></div>
271<p>
272          Functions and operators that implement <span class="emphasis"><em><span class="bold"><strong>Subtraction</strong></span></em></span>
273          on <span class="bold"><strong>icl</strong></span> objects are given in the table
274          above.
275        </p>
276<div class="informaltable"><table class="table">
277<colgroup>
278<col>
279<col>
280</colgroup>
281<thead><tr>
282<th>
283                </th>
284<th>
285                  <p>
286                    Description of Subtraction
287                  </p>
288                </th>
289</tr></thead>
290<tbody>
291<tr>
292<td>
293                  <p>
294                    <code class="computeroutput"><span class="identifier">Sets</span></code>
295                  </p>
296                </td>
297<td>
298                  <p>
299                    Subtraction on Sets implements <span class="emphasis"><em><span class="bold"><strong>set
300                    difference</strong></span></em></span>
301                  </p>
302                </td>
303</tr>
304<tr>
305<td>
306                  <p>
307                    <code class="computeroutput"><span class="identifier">Maps</span></code>
308                  </p>
309                </td>
310<td>
311                  <p>
312                    Subtraction on Maps implements a <span class="emphasis"><em><span class="bold"><strong>map
313                    difference</strong></span></em></span> function similar to <span class="emphasis"><em>set
314                    difference</em></span>. If, on subtraction of an element value
315                    pair <code class="computeroutput"><span class="special">(</span><span class="identifier">k</span><span class="special">,</span><span class="identifier">v</span><span class="special">)</span></code> it's key <code class="computeroutput"><span class="identifier">k</span></code>
316                    is in the map already, the subtraction function is propagated
317                    to the associated value. On the associated value an aggregation
318                    is performed, that reverses the effect of the corresponding addition
319                    function.
320                  </p>
321                  <p>
322                    Find more on <a class="link" href="../concepts/aggrovering.html" title="Addability, Subtractability and Aggregate on Overlap"><span class="emphasis"><em>subtractability
323                    of maps</em></span></a> and related <a class="link" href="../semantics/maps.html" title="Maps"><span class="emphasis"><em>semantic
324                    issues</em></span></a> following the links.
325                  </p>
326                </td>
327</tr>
328</tbody>
329</table></div>
330</div>
331<div class="section">
332<div class="titlepage"><div><div><h4 class="title">
333<a name="boost_icl.function_reference.subtraction.functions"></a><a class="link" href="subtraction.html#boost_icl.function_reference.subtraction.functions" title="Functions">Functions</a>
334</h4></div></div></div>
335<p>
336          The admissible combinations of types for subtraction functions can be summarized
337          in the <span class="emphasis"><em><span class="bold"><strong>overload table</strong></span></em></span>
338          below:
339        </p>
340<p>
341</p>
342<pre class="programlisting"><span class="comment">// overload table for              T\P| e i b p  </span>
343<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">T</span><span class="special">::</span><span class="identifier">subtract</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span>           <span class="special">---+--------</span>
344<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">subtract</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span>           <span class="identifier">s</span> <span class="special">|</span> <span class="identifier">s</span>
345                                    <span class="identifier">m</span> <span class="special">|</span>     <span class="identifier">m</span>
346                                    <span class="identifier">S</span> <span class="special">|</span> <span class="identifier">S</span> <span class="identifier">S</span>
347                                    <span class="identifier">M</span> <span class="special">|</span>     <span class="identifier">M</span> <span class="identifier">M</span>
348</pre>
349<p>
350        </p>
351<p>
352          The next table contains complexity characteristics for <code class="computeroutput"><span class="identifier">subtract</span></code>.
353        </p>
354<div class="table">
355<a name="boost_icl.function_reference.subtraction.functions.t0"></a><p class="title"><b>Table 1.24. Time Complexity for function subtract on icl containers</b></p>
356<div class="table-contents"><table class="table" summary="Time Complexity for function subtract on icl containers">
357<colgroup>
358<col>
359<col>
360<col>
361<col>
362<col>
363</colgroup>
364<thead><tr>
365<th>
366                  <p>
367                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
368                    <span class="identifier">T</span><span class="special">::</span><span class="identifier">subtract</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code><br> <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">subtract</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
369                    <span class="identifier">P</span><span class="special">&amp;)</span></code>
370                  </p>
371                </th>
372<th>
373                  <p>
374                    domain<br> type
375                  </p>
376                </th>
377<th>
378                  <p>
379                    interval<br> type
380                  </p>
381                </th>
382<th>
383                  <p>
384                    domain<br> mapping<br> type
385                  </p>
386                </th>
387<th>
388                  <p>
389                    interval<br> mapping<br> type
390                  </p>
391                </th>
392</tr></thead>
393<tbody>
394<tr>
395<td>
396                  <p>
397                    <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>
398                  </p>
399                </td>
400<td>
401                  <p>
402                    <span class="emphasis"><em>O(log n)</em></span>
403                  </p>
404                </td>
405<td>
406                </td>
407<td>
408                </td>
409<td>
410                </td>
411</tr>
412<tr>
413<td>
414                  <p>
415                    <code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::map</a></code>
416                  </p>
417                </td>
418<td>
419                  <p>
420                    <span class="emphasis"><em>O(log n)</em></span>
421                  </p>
422                </td>
423<td>
424                </td>
425<td>
426                  <p>
427                    <span class="emphasis"><em>O(log n)</em></span>
428                  </p>
429                </td>
430<td>
431                </td>
432</tr>
433<tr>
434<td>
435                  <p>
436                    <code class="computeroutput"><a class="link" href="../../boost/icl/interval_set.html" title="Class template interval_set">interval_sets</a></code>
437                  </p>
438                </td>
439<td>
440                  <p>
441                    <span class="emphasis"><em>O(log n)</em></span>
442                  </p>
443                </td>
444<td>
445                  <p>
446                    <span class="emphasis"><em>amortized<br> O(log n)</em></span>
447                  </p>
448                </td>
449<td>
450                </td>
451<td>
452                </td>
453</tr>
454<tr>
455<td>
456                  <p>
457                    <code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>
458                  </p>
459                </td>
460<td>
461                  <p>
462                    <span class="emphasis"><em>O(log n)</em></span>
463                  </p>
464                </td>
465<td>
466                  <p>
467                    <span class="emphasis"><em>O(n)</em></span>
468                  </p>
469                </td>
470<td>
471                  <p>
472                    <span class="emphasis"><em>O(log n)</em></span>
473                  </p>
474                </td>
475<td>
476                  <p>
477                    <span class="emphasis"><em>O(n)</em></span>
478                  </p>
479                </td>
480</tr>
481</tbody>
482</table></div>
483</div>
484<br class="table-break">
485</div>
486<div class="section">
487<div class="titlepage"><div><div><h4 class="title">
488<a name="boost_icl.function_reference.subtraction.inplace_operators"></a><a class="link" href="subtraction.html#boost_icl.function_reference.subtraction.inplace_operators" title="Inplace operators">Inplace
489        operators</a>
490</h4></div></div></div>
491<p>
492          As presented in the overload tables for <code class="computeroutput"><span class="keyword">operator</span>
493          <span class="special">-=</span></code> more type combinations are provided
494          for subtraction than for addition.
495        </p>
496<p>
497</p>
498<pre class="programlisting"><span class="comment">// overload tables for             element containers:     interval containers:  </span>
499<span class="identifier">T</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span>      <span class="special">-=</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="special">-=</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>
500                                   <span class="special">---+--------</span>            <span class="special">---+------------</span>
501                                   <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>
502                                   <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>
503</pre>
504<p>
505        </p>
506<p>
507          Subtraction provides the <span class="emphasis"><em>reverse</em></span> operation of an addition
508          for these overloads,
509        </p>
510<p>
511</p>
512<pre class="programlisting"><span class="comment">// Reverse addition                -= | e b s m            -= | e i b p S M </span>
513                                   <span class="special">---+--------</span>            <span class="special">---+------------</span>
514                                   <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>
515                                   <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>
516</pre>
517<p>
518        </p>
519<p>
520          <span class="bold"><strong>and</strong></span> you can erase parts of <code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::maps</a></code> or <code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>
521          using <span class="emphasis"><em>key values</em></span>, <span class="emphasis"><em>intervals</em></span> or
522          <span class="emphasis"><em>element or interval sets</em></span> using these overloads:
523        </p>
524<p>
525</p>
526<pre class="programlisting"><span class="comment">// Erasure by key objects          -= | e b s m            -= | e i b p S M  </span>
527                                   <span class="special">---+--------</span>            <span class="special">---+------------</span>
528                                   <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>
529                                   <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>
530</pre>
531<p>
532        </p>
533<p>
534          On Sets both function groups fall together as <span class="emphasis"><em><span class="bold"><strong>set
535          difference</strong></span></em></span>.
536        </p>
537<p>
538          Complexity characteristics for inplace subtraction operations are given
539          by the next tables where
540</p>
541<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>
542<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>
543</pre>
544<p>
545        </p>
546<div class="table">
547<a name="boost_icl.function_reference.subtraction.inplace_operators.t0"></a><p class="title"><b>Table 1.25. Time Complexity for inplace Subtraction on element containers</b></p>
548<div class="table-contents"><table class="table" summary="Time Complexity for inplace Subtraction on element containers">
549<colgroup>
550<col>
551<col>
552<col>
553<col>
554<col>
555</colgroup>
556<thead><tr>
557<th>
558                  <p>
559                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
560                    <span class="keyword">operator</span> <span class="special">-=</span>
561                    <span class="special">(</span><span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
562                    <span class="identifier">P</span><span class="special">&amp;)</span></code>
563                  </p>
564                </th>
565<th>
566                  <p>
567                    domain<br> type
568                  </p>
569                </th>
570<th>
571                  <p>
572                    domain<br> mapping<br> type
573                  </p>
574                </th>
575<th>
576                  <p>
577                    std::set
578                  </p>
579                </th>
580<th>
581                  <p>
582                    icl::map
583                  </p>
584                </th>
585</tr></thead>
586<tbody>
587<tr>
588<td>
589                  <p>
590                    <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>
591                  </p>
592                </td>
593<td>
594                  <p>
595                    <span class="emphasis"><em>O(log n)</em></span>
596                  </p>
597                </td>
598<td>
599                </td>
600<td>
601                  <p>
602                    <span class="emphasis"><em>O(m log n)</em></span>
603                  </p>
604                </td>
605<td>
606                </td>
607</tr>
608<tr>
609<td>
610                  <p>
611                    <code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::map</a></code>
612                  </p>
613                </td>
614<td>
615                  <p>
616                    <span class="emphasis"><em>O(log n)</em></span>
617                  </p>
618                </td>
619<td>
620                  <p>
621                    <span class="emphasis"><em>O(log n)</em></span>
622                  </p>
623                </td>
624<td>
625                  <p>
626                    <span class="emphasis"><em>O(m log n)</em></span>
627                  </p>
628                </td>
629<td>
630                  <p>
631                    <span class="emphasis"><em>O(m log n)</em></span>
632                  </p>
633                </td>
634</tr>
635</tbody>
636</table></div>
637</div>
638<br class="table-break"><div class="table">
639<a name="boost_icl.function_reference.subtraction.inplace_operators.t1"></a><p class="title"><b>Table 1.26. Time Complexity for inplace Subtraction on interval containers</b></p>
640<div class="table-contents"><table class="table" summary="Time Complexity for inplace Subtraction on interval containers">
641<colgroup>
642<col>
643<col>
644<col>
645<col>
646<col>
647<col>
648<col>
649</colgroup>
650<thead><tr>
651<th>
652                  <p>
653                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
654                    <span class="keyword">operator</span> <span class="special">-=</span>
655                    <span class="special">(</span><span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
656                    <span class="identifier">P</span><span class="special">&amp;)</span></code>
657                  </p>
658                </th>
659<th>
660                  <p>
661                    domain<br> type
662                  </p>
663                </th>
664<th>
665                  <p>
666                    interval<br> type
667                  </p>
668                </th>
669<th>
670                  <p>
671                    domain<br> mapping<br> type
672                  </p>
673                </th>
674<th>
675                  <p>
676                    interval<br> mapping<br> type
677                  </p>
678                </th>
679<th>
680                  <p>
681                    interval<br> sets
682                  </p>
683                </th>
684<th>
685                  <p>
686                    interval<br> maps
687                  </p>
688                </th>
689</tr></thead>
690<tbody>
691<tr>
692<td>
693                  <p>
694                    interval_sets
695                  </p>
696                </td>
697<td>
698                  <p>
699                    <span class="emphasis"><em>O(log n)</em></span>
700                  </p>
701                </td>
702<td>
703                  <p>
704                    <span class="emphasis"><em>amortized<br> O(log n)</em></span>
705                  </p>
706                </td>
707<td>
708                </td>
709<td>
710                </td>
711<td>
712                  <p>
713                    <span class="emphasis"><em>O(m log(n+m))</em></span>
714                  </p>
715                </td>
716<td>
717                </td>
718</tr>
719<tr>
720<td>
721                  <p>
722                    interval_maps
723                  </p>
724                </td>
725<td>
726                  <p>
727                    <span class="emphasis"><em>O(log n)</em></span>
728                  </p>
729                </td>
730<td>
731                  <p>
732                    <span class="emphasis"><em>amortized<br> O(log n)</em></span>
733                  </p>
734                </td>
735<td>
736                  <p>
737                    <span class="emphasis"><em>O(log n)</em></span>
738                  </p>
739                </td>
740<td>
741                  <p>
742                    <span class="emphasis"><em>O(n)</em></span>
743                  </p>
744                </td>
745<td>
746                  <p>
747                    <span class="emphasis"><em>O(m log(n+m))</em></span>
748                  </p>
749                </td>
750<td>
751                  <p>
752                    <span class="emphasis"><em>O(m log(n+m))</em></span>
753                  </p>
754                </td>
755</tr>
756</tbody>
757</table></div>
758</div>
759<br class="table-break">
760</div>
761<div class="section">
762<div class="titlepage"><div><div><h4 class="title">
763<a name="boost_icl.function_reference.subtraction.infix_operators"></a><a class="link" href="subtraction.html#boost_icl.function_reference.subtraction.infix_operators" title="Infix operators">Infix
764        operators</a>
765</h4></div></div></div>
766<p>
767          The admissible overloads for the infix <span class="emphasis"><em>subtraction</em></span>
768          <code class="computeroutput"><span class="keyword">operator</span> <span class="special">-</span></code>
769          which is a non commutative operation is given by the next overload table.
770        </p>
771<p>
772</p>
773<pre class="programlisting"><span class="comment">// overload tables for         -  | e b s m      -  | e i b p S M   </span>
774<span class="identifier">T</span> <span class="keyword">operator</span> <span class="special">-</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">&amp;)</span>     <span class="special">---+--------</span>      <span class="special">---+------------</span>
775                               <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>
776                               <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>
777</pre>
778<p>
779        </p>
780</div>
781<div class="section">
782<div class="titlepage"><div><div><h4 class="title">
783<a name="boost_icl.function_reference.subtraction.subtraction_on_intervals"></a><a class="link" href="subtraction.html#boost_icl.function_reference.subtraction.subtraction_on_intervals" title="Subtraction on Intervals">Subtraction
784        on Intervals</a>
785</h4></div></div></div>
786<div class="informaltable"><table class="table">
787<colgroup>
788<col>
789<col>
790<col>
791</colgroup>
792<thead><tr>
793<th>
794                  <p>
795                    <span class="emphasis"><em><span class="bold"><strong>Subtraction</strong></span></em></span>
796                  </p>
797                </th>
798<th>
799                  <p>
800                    Types
801                  </p>
802                </th>
803<th>
804                  <p>
805                    Description
806                  </p>
807                </th>
808</tr></thead>
809<tbody>
810<tr>
811<td>
812                  <p>
813                    <code class="computeroutput"><span class="identifier">T</span> <span class="identifier">left_subtract</span><span class="special">(</span><span class="identifier">T</span>
814                    <span class="identifier">right</span><span class="special">,</span>
815                    <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">left_minuend</span><span class="special">)</span></code>
816                  </p>
817                </td>
818<td>
819                  <p>
820                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
821                  </p>
822                </td>
823<td>
824                  <p>
825                    subtract <code class="computeroutput"><span class="identifier">left_minuend</span></code>
826                    from the interval <code class="computeroutput"><span class="identifier">right</span></code>
827                    on it's left side.
828</p>
829<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">right_over</span> <span class="special">=</span> <span class="identifier">left_subtract</span><span class="special">(</span><span class="identifier">right</span><span class="special">,</span> <span class="identifier">left_minuend</span><span class="special">);</span>
830<span class="special">...</span>      <span class="identifier">d</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">right</span>
831<span class="special">...</span> <span class="identifier">c</span><span class="special">)</span>      <span class="special">:</span> <span class="identifier">left_minuend</span>
832     <span class="special">[</span><span class="identifier">c</span>  <span class="identifier">d</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">right_over</span>
833</pre>
834<p>
835                  </p>
836                </td>
837</tr>
838<tr>
839<td>
840                  <p>
841                    <code class="computeroutput"><span class="identifier">T</span> <span class="identifier">right_subtract</span><span class="special">(</span><span class="identifier">T</span>
842                    <span class="identifier">left</span><span class="special">,</span>
843                    <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">right_minuend</span><span class="special">)</span></code>
844                  </p>
845                </td>
846<td>
847                  <p>
848                    <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
849                  </p>
850                </td>
851<td>
852                  <p>
853                    subtract <code class="computeroutput"><span class="identifier">right_minuend</span></code>
854                    from the interval <code class="computeroutput"><span class="identifier">left</span></code>
855                    on it's right side.
856</p>
857<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">left_over</span> <span class="special">=</span> <span class="identifier">right_subtract</span><span class="special">(</span><span class="identifier">left</span><span class="special">,</span> <span class="identifier">right_minuend</span><span class="special">);</span>
858<span class="special">[</span><span class="identifier">a</span>      <span class="special">...</span>  <span class="special">:</span> <span class="identifier">left</span>
859     <span class="special">[</span><span class="identifier">b</span> <span class="special">...</span>  <span class="special">:</span> <span class="identifier">right_minuend</span>
860<span class="special">[</span><span class="identifier">a</span>  <span class="identifier">b</span><span class="special">)</span>       <span class="special">:</span> <span class="identifier">left_over</span>
861</pre>
862<p>
863                  </p>
864                </td>
865</tr>
866</tbody>
867</table></div>
868</div>
869<p>
870        <span class="emphasis"><em><span class="bold"><strong>See also . . .</strong></span></em></span>
871      </p>
872<div class="informaltable"><table class="table">
873<colgroup><col></colgroup>
874<thead><tr></tr></thead>
875<tbody>
876<tr><td>
877                <p>
878                  <a class="link" href="addition.html" title="Addition"><span class="emphasis"><em><span class="bold"><strong>Addition</strong></span></em></span></a>
879                </p>
880              </td></tr>
881<tr><td>
882                <p>
883                  <a class="link" href="erasure.html" title="Erasure"><span class="emphasis"><em><span class="bold"><strong>Erasure</strong></span></em></span></a>
884                </p>
885              </td></tr>
886</tbody>
887</table></div>
888<p>
889        <span class="emphasis"><em><span class="bold"><strong>Back to section . . .</strong></span></em></span>
890      </p>
891<div class="informaltable"><table class="table">
892<colgroup><col></colgroup>
893<thead><tr></tr></thead>
894<tbody>
895<tr><td>
896                <p>
897                  <a class="link" href="../interface/function_synopsis.html#function_synopsis_table"><span class="emphasis"><em><span class="bold"><strong>Function
898                  Synopsis</strong></span></em></span></a>
899                </p>
900              </td></tr>
901<tr><td>
902                <p>
903                  <a class="link" href="../interface.html" title="Interface"><span class="emphasis"><em><span class="bold"><strong>Interface</strong></span></em></span></a>
904                </p>
905              </td></tr>
906</tbody>
907</table></div>
908</div>
909<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
910<td align="left"></td>
911<td align="right"><div class="copyright-footer">Copyright © 2007-2010 Joachim
912      Faulhaber<br>Copyright © 1999-2006 Cortex Software
913      GmbH<p>
914        Distributed under the Boost Software License, Version 1.0. (See accompanying
915        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>)
916      </p>
917</div></td>
918</tr></table>
919<hr>
920<div class="spirit-nav">
921<a accesskey="p" href="addition.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="insertion.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
922</div>
923</body>
924</html>
925