Skip to content

After iterating through the nodes, the value has changed. #1353

@Hello1M

Description

@Hello1M
field-division:
  carcontrol&system:
    skillId:
      - "2023080400000047"
      - "2023071900000110"
      - "2024103000000020"
      - "2023102400000010"
      - "2023082900000022"
      - "2023100700000021"
      - "2024051600000028"
      - "2024031100000012"
      - "2024071600000049"
      - "2024062500000017"
      - "2024120500000028"
      - "2025030500000045"
      - "2024072500000090"
  navigation:
    skillId:
     - "2023080400000034"
     - "2023072600000044"
     - "2023100700000019"
     - "2024051400000007"
YAML::Node fieldDivision = m_adapterFiledCfg["field-division"];
for (YAML::const_iterator it = fieldDivision.begin(); it != fieldDivision.end(); ++it) {
    const YAML::Node& field = it->first;
    std::cout << it->first.as<std::string>() << std::endl;
    const YAML::Node& requirement = it->second;
    for (auto& node1 : requirement) 
    {
        std::cout << node1.first.Type() << std::endl;
    }
    std::cout << field.as<std::string>() << std::endl;
}

output:

carcontrol&system
2
skillId
navigation
2
skillId

The value of it->first is correct, but the value of field is skillId. I don't see any issue, but I'm not sure what caused it. Can someone provide an explanation?

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