With a YAML config
{"x": "1.0"}
The statement
int a = node["x"].as<int>()
throws a YAML::TypedBadConversion exception. But if I add a default value,
int a = node["x"].as<int>(0),
then the variable a takes the default value of 0 quietly without throwing any errors. Why is this? I would want to see an error in this case as well.
With a YAML config exception. But if I add a default value,
{"x": "1.0"}
The statementint a = node["x"].as<int>()
throws a YAML::TypedBadConversionint a = node["x"].as<int>(0)
, then the variablea
takes the default value of 0 quietly without throwing any errors. Why is this? I would want to see an error in this case as well.