Skip to content

more than one operator '=' matches these operands #1002

Description

@balldrix

I'm copying data into a struct. I get this warning when I copy a std::string.

// read file
	std::ifstream file(fileName);

	// parse data from file
	json data = json::parse(file);
	json animation = data["animation"];

	// iterate through data and save in animation list
	for(json::iterator it = animation.begin(); it != animation.end(); ++it)
	{
		// json of current it in array
		json j = it.value();

		// data struct
		Animation animationType;
		animationType.name = j["name"];
		animationType.spriteSheetIndex = j["index"];
		animationType.frameCount = j["frameCount"];
		animationType.framesPerSecond = j["framesPerSecond"];
		animationType.loop = j["loop"];

		// push data to list
		m_animationList.push_back(animationType);
	}

The code works as intended but would you know why this message appears? Is there a better way for me to take the json file and put the data in a vector list?

I'm using Windows 7 & Windows 10, Visual Studio 2017 v15.5.6.

Using the most recent release version of nlohmann/json.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions