user1830108 - 11 months ago 69

C++ Question

If I have two sets of data

`set<string> A;`

set<string> B;

use set_intersection I am able to obtain the data in the intersection part for the two sets.

How do I print out the data in the non-intersection part for the set A and set B, respectively?

Answer Source

Use `std::set_difference`

or `std::set_symmetric_difference`

, depending on your needs.

(I'm too tired/lazy to write an example, but hopefully it should be obvious once you've read the above links!)