• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>set_symmetric_difference</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. Range 2.0">
8<link rel="up" href="../set.html" title="Set algorithms">
9<link rel="prev" href="set_difference.html" title="set_difference">
10<link rel="next" href="../heap.html" title="Heap algorithms">
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="../../../../../../../../libs/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="set_difference.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../set.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="../heap.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="range.reference.algorithms.set.set_symmetric_difference"></a><a class="link" href="set_symmetric_difference.html" title="set_symmetric_difference">set_symmetric_difference</a>
28</h5></div></div></div>
29<h6>
30<a name="range.reference.algorithms.set.set_symmetric_difference.h0"></a>
31            <span class="phrase"><a name="range.reference.algorithms.set.set_symmetric_difference.prototype"></a></span><a class="link" href="set_symmetric_difference.html#range.reference.algorithms.set.set_symmetric_difference.prototype">Prototype</a>
32          </h6>
33<p>
34</p>
35<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
36    <span class="keyword">class</span> <span class="identifier">SinglePassRange1</span><span class="special">,</span>
37    <span class="keyword">class</span> <span class="identifier">SinglePassRange2</span><span class="special">,</span>
38    <span class="keyword">class</span> <span class="identifier">OutputIterator</span>
39    <span class="special">&gt;</span>
40<span class="identifier">OutputIterator</span>
41<span class="identifier">set_symmetric_difference</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange1</span><span class="special">&amp;</span> <span class="identifier">rng1</span><span class="special">,</span>
42                         <span class="keyword">const</span> <span class="identifier">SinglePassRange2</span><span class="special">&amp;</span> <span class="identifier">rng2</span><span class="special">,</span>
43                         <span class="identifier">OutputIterator</span>          <span class="identifier">out</span><span class="special">);</span>
44
45<span class="keyword">template</span><span class="special">&lt;</span>
46    <span class="keyword">class</span> <span class="identifier">SinglePassRange1</span><span class="special">,</span>
47    <span class="keyword">class</span> <span class="identifier">SinglePassRange2</span><span class="special">,</span>
48    <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span>
49    <span class="keyword">class</span> <span class="identifier">BinaryPredicate</span>
50    <span class="special">&gt;</span>
51<span class="identifier">OutputIterator</span>
52<span class="identifier">set_symmetric_difference</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange1</span><span class="special">&amp;</span> <span class="identifier">rng1</span><span class="special">,</span>
53                         <span class="keyword">const</span> <span class="identifier">SinglePassRange2</span><span class="special">&amp;</span> <span class="identifier">rng2</span><span class="special">,</span>
54                         <span class="identifier">OutputIterator</span>          <span class="identifier">out</span><span class="special">,</span>
55                         <span class="identifier">BinaryPredicate</span>         <span class="identifier">pred</span><span class="special">);</span>
56</pre>
57<p>
58          </p>
59<h6>
60<a name="range.reference.algorithms.set.set_symmetric_difference.h1"></a>
61            <span class="phrase"><a name="range.reference.algorithms.set.set_symmetric_difference.description"></a></span><a class="link" href="set_symmetric_difference.html#range.reference.algorithms.set.set_symmetric_difference.description">Description</a>
62          </h6>
63<p>
64            <code class="computeroutput"><span class="identifier">set_symmetric_difference</span></code>
65            constructs a sorted range that is the set symmetric difference of the
66            sorted ranges <code class="computeroutput"><span class="identifier">rng1</span></code> and
67            <code class="computeroutput"><span class="identifier">rng2</span></code>. The return value
68            is the end of the output range.
69          </p>
70<p>
71            The ordering relationship is determined by using <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;</span></code> in the non-predicate versions, and
72            by evaluating <code class="computeroutput"><span class="identifier">pred</span></code> in
73            the predicate versions.
74          </p>
75<h6>
76<a name="range.reference.algorithms.set.set_symmetric_difference.h2"></a>
77            <span class="phrase"><a name="range.reference.algorithms.set.set_symmetric_difference.definition"></a></span><a class="link" href="set_symmetric_difference.html#range.reference.algorithms.set.set_symmetric_difference.definition">Definition</a>
78          </h6>
79<p>
80            Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">set_algorithm</span><span class="special">.</span><span class="identifier">hpp</span></code>
81          </p>
82<h6>
83<a name="range.reference.algorithms.set.set_symmetric_difference.h3"></a>
84            <span class="phrase"><a name="range.reference.algorithms.set.set_symmetric_difference.requirements"></a></span><a class="link" href="set_symmetric_difference.html#range.reference.algorithms.set.set_symmetric_difference.requirements">Requirements</a>
85          </h6>
86<p>
87            <span class="bold"><strong>For the non-predicate versions:</strong></span>
88          </p>
89<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
90<li class="listitem">
91                <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
92                is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
93                Pass Range</a> Concept.
94              </li>
95<li class="listitem">
96                <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
97                is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
98                Pass Range</a> Concept.
99              </li>
100<li class="listitem">
101                <code class="computeroutput"><span class="identifier">OutputIterator</span></code> is
102                a model of the <code class="computeroutput"><span class="identifier">OutputIteratorConcept</span></code>.
103              </li>
104<li class="listitem">
105                <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
106                and <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
107                have the same value type.
108              </li>
109<li class="listitem">
110                <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
111                value type is a model of the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>.
112              </li>
113<li class="listitem">
114                <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
115                value type is a model of the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>.
116              </li>
117<li class="listitem">
118                The ordering of objects of type <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
119                value type is a <span class="bold"><strong><span class="emphasis"><em>strict weak ordering</em></span></strong></span>,
120                as defined in the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>
121                requirements.
122              </li>
123<li class="listitem">
124                The ordering of objects of type <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
125                value type is a <span class="bold"><strong><span class="emphasis"><em>strict weak ordering</em></span></strong></span>,
126                as defined in the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>
127                requirements.
128              </li>
129</ul></div>
130<p>
131            <span class="bold"><strong>For the predicate versions:</strong></span>
132          </p>
133<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
134<li class="listitem">
135                <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
136                is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
137                Pass Range</a> Concept.
138              </li>
139<li class="listitem">
140                <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
141                is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
142                Pass Range</a> Concept.
143              </li>
144<li class="listitem">
145                <code class="computeroutput"><span class="identifier">OutputIterator</span></code> is
146                a model of the <code class="computeroutput"><span class="identifier">OutputIteratorConcept</span></code>.
147              </li>
148<li class="listitem">
149                <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
150                and <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
151                have the same value type.
152              </li>
153<li class="listitem">
154                <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code> is
155                a model of the <code class="computeroutput"><span class="identifier">StrictWeakOrderingConcept</span></code>.
156              </li>
157<li class="listitem">
158                <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
159                value type is convertible to <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code>'s
160                first argument type.
161              </li>
162<li class="listitem">
163                <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
164                value type is convertible to <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code>'s
165                second argument types.
166              </li>
167</ul></div>
168<h6>
169<a name="range.reference.algorithms.set.set_symmetric_difference.h4"></a>
170            <span class="phrase"><a name="range.reference.algorithms.set.set_symmetric_difference.precondition_"></a></span><a class="link" href="set_symmetric_difference.html#range.reference.algorithms.set.set_symmetric_difference.precondition_">Precondition:</a>
171          </h6>
172<p>
173            <span class="bold"><strong>For the non-predicate versions:</strong></span>
174          </p>
175<p>
176            <code class="computeroutput"><span class="identifier">rng1</span></code> and <code class="computeroutput"><span class="identifier">rng2</span></code> are sorted in ascending order
177            according to <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;</span></code>.
178          </p>
179<p>
180            <span class="bold"><strong>For the predicate versions:</strong></span>
181          </p>
182<p>
183            <code class="computeroutput"><span class="identifier">rng1</span></code> and <code class="computeroutput"><span class="identifier">rng2</span></code> are sorted in ascending order
184            according to <code class="computeroutput"><span class="identifier">pred</span></code>.
185          </p>
186<h6>
187<a name="range.reference.algorithms.set.set_symmetric_difference.h5"></a>
188            <span class="phrase"><a name="range.reference.algorithms.set.set_symmetric_difference.complexity"></a></span><a class="link" href="set_symmetric_difference.html#range.reference.algorithms.set.set_symmetric_difference.complexity">Complexity</a>
189          </h6>
190<p>
191            Linear. <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">N</span><span class="special">)</span></code>,
192            where <code class="computeroutput"><span class="identifier">N</span></code> is <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng1</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng2</span><span class="special">)</span></code>.
193          </p>
194</div>
195<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
196<td align="left"></td>
197<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
198      Neil Groves<p>
199        Distributed under the Boost Software License, Version 1.0. (See accompanying
200        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>)
201      </p>
202</div></td>
203</tr></table>
204<hr>
205<div class="spirit-nav">
206<a accesskey="p" href="set_difference.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../set.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="../heap.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
207</div>
208</body>
209</html>
210