Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 <chris@cfrank.org>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant