By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,480 Members | 1,711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,480 IT Pros & Developers. It's quick & easy.

How do you compare associative data types?

P: n/a
Hi,

Is there an STL function/algorithm to compare two maps and return a map
of the differences?

I'm looking for a way to do an "exclusive or" between an old map and a
new map and then work on the differences.

Thanks,
Frank

Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
person wrote:
Hi,

Is there an STL function/algorithm to compare two maps and return a map
of the differences?

I'm looking for a way to do an "exclusive or" between an old map and a
new map and then work on the differences.


set_symmetric_difference?

Ben Pope
Nov 22 '05 #2

P: n/a
KK

Ben Pope wrote:
person wrote:
Hi,

Is there an STL function/algorithm to compare two maps and return a map
of the differences?

I'm looking for a way to do an "exclusive or" between an old map and a
new map and then work on the differences.


set_symmetric_difference?

Ben Pope

I did try set_difference (not the set_symmetric_difference tough) on
maps but did not work. I dont get any compiler errors, but the final
result was wrong. I wonder why!

Nov 22 '05 #3

P: n/a
On 2005-11-17 23:02, KK wrote:
Ben Pope wrote:
person wrote:
> Hi,
>
> Is there an STL function/algorithm to compare two maps and return a map
> of the differences?
>
> I'm looking for a way to do an "exclusive or" between an old map and a
> new map and then work on the differences.


set_symmetric_difference?

Ben Pope

I did try set_difference (not the set_symmetric_difference tough) on
maps but did not work. I dont get any compiler errors, but the final
result was wrong. I wonder why!


set_differance only returns A - B (elements in A but not in B) but does
not take into consideration elements that are unique to B.

Erik Wikström
--
"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure
out how to use my telephone" -- Bjarne Stroustrup
Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.