Skip to content

puzzled implicit conversions #1692

Description

@studywithallofyou
  • evironment:

vs2017 c++17 windows7 64 develop branch

  • code:
long long lnum = 327221437;
nlohmann::json a;
a["num1"] = 327220625;
nlohmann::json b;
b["num2"] = 900000;
if (lnum - a["num1"] > b["num2"])
{
    cout << lnum << endl;
    cout << a["num1"] << endl;
    cout << b["num2"] << endl;
    cout << lnum - a["num1"] << endl;
    cout << lnum - a["num1"].get<long long>() << endl;
}
  • result:
327221437
327220625
900000
327221292
812

could you tell me why lnum - a["num1"] is not same as lnum - a["num1"].get<long long>() but cout << a["num1"] << endl; is correct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions