Skip to content

Conversation

cfrank
Copy link

@cfrank cfrank commented Dec 15, 2018

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.

Signed-off-by: Chris Frank <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant