tags:

views:

86

answers:

3

Given two STL sets, I want to find out the XOR of them. Is there an easy, pre-existing way to do that?

+2  A: 

You can use std::set_symmetric_difference from the C++ standard library.

James McNellis
Apparently you won the race :p
Matthieu M.
@Matthieu: By a whopping 32 seconds! (Actually, I hadn't returned to see that two others had posted the same thing, otherwise I'd have probably deleted this :-P)
James McNellis
+1  A: 

Yes: std::set_symmetric_difference

jpalecek
+1  A: 

Try std::set_symmetric_difference:

http://www.cplusplus.com/reference/algorithm/set_symmetric_difference/

George