user1830108 user1830108 - 2 months ago 24
C++ Question

print out data in the non-intersection for set <string> A, set<string>B

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?


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!)