initial: re-vendor @ c00e0fa

c00e0fa avoid converting objects twice
baafe10 fix doc comment
This commit is contained in:
Jeremy Baxter 2024-06-18 17:48:37 +12:00
parent 6bd5af01f8
commit d5cacb0401

View file

@ -218,7 +218,7 @@ struct INISection
keys = new string[string];
}
/+
/++
+ Returns the value of `k` in this section or
+ `defaultValue` if the key is not present.
+/
@ -234,10 +234,10 @@ struct INISection
+ with a message containing location information.
+/
T
keyAs(T)(string k, string defaultValue = null)
keyAs(T)(string k, T defaultValue)
{
try
return key(k, defaultValue).to!T();
return k in keys ? keys[k].to!T() : defaultValue;
catch (ConvException)
throw new INITypeException(
format!"unable to convert [%s].%s to %s"(name, k, T.stringof));