Loading ...
Sorry, an error occurred while loading the content.

1923Order of members and equality

Expand Messages
  • jonathan wallace
    Oct 9, 2012
    • 0 Attachment
      I received this email today:

      ===============
      I am testing out using libjson in our project and am looking for a little guidance. I expected that when comparing two JSONNode objects via operator==, it would ignore ordering. However, this does not seem to be the case.  For example:

      JSONNode node1 = libjson::parse("{\"uid\":\"mopub_id\", \"uid1\":\"mopub_id1\"}");
      JSONNode node2 = libjson::parse("{\"uid1\":\"mopub_id1\", \"uid\":\"mopub_id\"}");
      if (node1 == node2) { std::cout << "equal" << std::endl;
      } else { std::cout << "not equal" << std::endl;
      }
      I had expected that this would call node1 and node2 equal. However, it does not appear to. Is this the intended behavior? Is there anything in the code to compare JSONNode s w/o respect to order of elements?

      ===============


      Should those two nodes be considered equal to each other?  I am certain that order matters when it comes to arrays, and I am fairly certain that it is for members as well, am I wrong?

      [Non-text portions of this message have been removed]
    • Show all 5 messages in this topic