Closed floli closed 4 years ago
You can enable this behavior with the option Config::OptionAutoConvert, like this:
Config config;
config.setOptions(Config::OptionAutoConvert);
Turning this option on enables number auto-conversion for the configuration. When this feature is enabled, an attempt to retrieve a floating point setting’s value into an integer (or vice versa), or store an integer to a floating point setting’s value (or vice versa) will cause the library to silently perform the necessary conversion (possibly leading to loss of data), rather than reporting failure. By default this option is turned off.
Ok, thanks!
Hello,
I have experienced that a value like
myvalue = 2
in the config file, when parsed as a double produces an error, i.e., return code of 0.Example code:
Example config:
gives output
(version is 1.7.2, just downloaded and compiled)
My expectation when reading in a value like
10
is a result of10.0
.