skystrife / cpptoml

cpptoml is a header-only library for parsing TOML
MIT License
587 stars 133 forks source link

Add a plain value method for retrieving value from option class #93

Open cfrank opened 5 years ago

cfrank commented 5 years ago

This provides a simple method to retrieve the value. It does not check if the value exists, as with the operator version.

uint32_t port = config->get_as<uint32_t>("port");

if (port) {
    exampleFunction(port.value());
} else {
    // Handle error
}

I understand this might not be a change you are interested in merging, but I just wanted to make a PR since it something that I personally would like to see in cpptoml.

If you are interested in merging this, I can update this PR with documentation.