Standard C++ Library Class Reference

set_symmetric_difference (InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
OutputIterator result, Compare comp);
Description
set_symmetric_difference constructs a sorted symmetric difference of the elements from the
two ranges. This means that the constructed range includes copies of the elements that are
present in the range [first1, last1) but not present in the range [first2, last2)and copies of the
elements that are present in the range [first2, last2) but not in the range [first1, last1). It returns
the end of the constructed range.
For example, suppose we have two sets:
1 2 3 4 5
and
3 4 5 6 7
The set_symmetric_difference of these two sets is:
1 2 6 7
The result of set_symmetric_difference is undefined if the result range overlaps with either of
the original ranges.
set_symmetric_difference assumes that the ranges are sorted using the default comparision
operator less than (<), unless an alternative comparison operator (comp) is provided.
Use the set_symmetric_difference algorithm to return a result that includes elements that are
present in the first set and not in the second.
Complexity
At most ((last1 - first1) + (last2 - first2)) * 2 -1 comparisons are performed.
Example
//
// set_s_di.cpp
//
#include<algorithm>
#include<set>
#include <istream.h>
int main()
{