• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:set_symmetric_difference set_symmetric_difference]
7
8[heading Prototype]
9
10``
11template<
12    class SinglePassRange1,
13    class SinglePassRange2,
14    class OutputIterator
15    >
16OutputIterator
17set_symmetric_difference(const SinglePassRange1& rng1,
18                         const SinglePassRange2& rng2,
19                         OutputIterator          out);
20
21template<
22    class SinglePassRange1,
23    class SinglePassRange2,
24    class OutputIterator,
25    class BinaryPredicate
26    >
27OutputIterator
28set_symmetric_difference(const SinglePassRange1& rng1,
29                         const SinglePassRange2& rng2,
30                         OutputIterator          out,
31                         BinaryPredicate         pred);
32``
33
34[heading Description]
35
36`set_symmetric_difference` constructs a sorted range that is the set symmetric difference of the sorted ranges `rng1` and `rng2`. The return value is the end of the output range.
37
38The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
39
40[heading Definition]
41
42Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
43
44[heading Requirements]
45
46[*For the non-predicate versions:]
47
48* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
49* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
50* `OutputIterator` is a model of the `OutputIteratorConcept`.
51* `SinglePassRange1` and `SinglePassRange2` have the same value type.
52* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
53* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
54* The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
55* The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
56
57[*For the predicate versions:]
58
59* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
60* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
61* `OutputIterator` is a model of the `OutputIteratorConcept`.
62* `SinglePassRange1` and `SinglePassRange2` have the same value type.
63* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
64* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
65* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
66
67[heading Precondition:]
68
69[*For the non-predicate versions:]
70
71`rng1` and `rng2` are sorted in ascending order according to `operator<`.
72
73[*For the predicate versions:]
74
75`rng1` and `rng2` are sorted in ascending order according to `pred`.
76
77[heading Complexity]
78
79Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
80
81[endsect]
82
83
84