Skip to content

Unexpected behavior with foreach for Json::arrayType #1611

@archilanfedorov

Description

@archilanfedorov

Describe the bug
bad foreach cycle for arrayValue

To Reproduce

	Json::Value j;
	j["version"] = "1.0.0";
	j["name"] = "arch";
	j["arr"] = Json::arrayValue;
	j["arr"][5] = "Hello, World!";
	for (auto it : j["arr"]) {
		std::cout << it << std::endl;
	}

in output only "Hello, World"

Expected behavior
in output: 5 null's and Hello, World!

Desktop (please complete the following information):

  • OS: Win32
  • jsoncpp Version: 1.9.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions