YAML CPP: Improve read performance
@@ -95,6 +95,9 @@ Key createLeafKey (YAML::Node const & node, string const & name)
{
Key key{ name, KEY_BINARY, KEY_END };
if (!node.IsNull ())
+ {
+ auto value = node.as<string> ();
+ if (value == "true" || value == "false")
{
try
{
@@ -102,7 +105,12 @@ Key createLeafKey (YAML::Node const & node, string const & name)
}
catch (YAML::BadConversion const &)
{
- key.setString (node.as<string> ());
+ key.set<string> (value); // Save value as string, if `node` is a quoted scalar
+ }
+ }
+ else
+ {
+ key.set<string> (value);
}
}
if (node.Tag () == "tag:yaml.org,2002:binary")
