Skip to content

Cannot index by key of type static constexpr const char* #171

@poskadesign

Description

@poskadesign

This will not compile, error: use of overloaded operator '[]' is ambiguous (with operand types 'json' (aka 'basic_json<>') and 'const char *const'). Code:

static constexpr const char\* _VAR1 = "MyKey";
void foo() {
    nlohmann::json j;
    j[_VAR1] = 10;
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions