Illustrate set_symmetric_difference : set_symmetric_difference « STL Algorithms Merge « C++ Tutorial






#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
  bool result;

  string s("abcde");
  string s2("aeiou");

  vector<char> vector1(s.begin(), s.end());
  vector<char> vector2(s2.begin(), s2.end());

  
  
  vector<char> setDifference;

  set_symmetric_difference(vector1.begin(),vector1.end(),vector2.begin(), vector2.end(),back_inserter(setDifference));

  for(int i=0;i<setDifference.size();i++){
    cout << setDifference[i];
  }

  return 0;
}
bcdiou








28.6.set_symmetric_difference
28.6.1.Illustrate set_symmetric_difference
28.6.2.Determine elements in set A that are not in set B and elements of set B that are not in set A
28.6.3.Determine difference the ranges with set_symmetric_difference()