Thursday 15 May 2014

c++ - Compare two (non-STL) maps for equality -


A third-party library we are using is a map / dictionary that does not test the likeness of two objects against each other And we need it.

More specifically, the two maps S1 & amp; S2 is considered equal if:

  1. Every key in S1 has a key in S2
  2. Every key in S2 has a key in S1

    What is the best algorithm to do this? Pseudo C ++ is just fine because the exact API on the set class is close to std :: map i can translate.

    < Li>

  3. Re-enable the key for the first set and for each key < / P>

    • Check that the key is present in another set

    • Check that the elements of the key are the same < / Ul>

    • If at least one element is not equal, then one key in the first set is not present in another or the size is not the same, the set is unequal Are there.

No comments:

Post a Comment