Skip to content

initializer list constructor makes curly brace initialization fragile #1594

Description

@maddanio

Hey,

I just discovered when i convert something to json on the fly like this:
nlohmann::json{my_value}
it turns it into an array, which is highly unexpected. this is a bit like the operator T() problem: too muc magic. I would be less dangerous if array/object construction where explicit, i.e. json::array({....})/json::object({{key, value},...). one can even make json::array/object objects and lose the round braces.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions