c++ - YAML-cpp null string parsing? -
how code parse ""
string (or recognize not acceptable string)? using this yaml-cpp library verified treats nodetype::value()
, not nodetype::null
.
std::string getfilepath() { yaml::node nodevalue = node["filepath"]; if(nodevalue.type() == yaml::nodetype::value()){ return nodevalue.as<std::string>(); //breaks here } return ""; }
in .yaml file, entry listed filepath: ""
yaml::nodetype
does not include more specific variable types value()
, null
.
here's specific error:
terminate called after throwing instance of 'yaml::typedbadconversion<std::string>' what(): bad conversion
the work-around have figured out far try-catch block.
Comments
Post a Comment