I am facing a problem with the new syntax. When parsing the following yaml file:
S1:
data_type: spr
guid: 1
S2:
data_type: spr
guid: 2
using the following code:
#include "yaml.h"
int main () {
YAML::Node testNode = YAML::LoadFile("data/Sprites.yaml");
std::cout<<"type "<<testNode["S1"]["data_type"].as<std::string>()<<std::endl;
std::cout<<"type "<<testNode[1]["data_type"].as<std::string>()<<std::endl;
return 0;
}
The first line works and outputs "type spr", while the second line doesn't, throwing a YAML::TypedBadConversion < std::string >.
Shouldn't them both have the same output? Or does numbered indexes work only on sequences and not on maps? What am I doing wrong?