Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add Optional based on variantSrc::variant #806

Merged
merged 6 commits into from
Oct 29, 2020

Conversation

franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Oct 27, 2020

Adds a class template openPMD::auxiliary::Option to provide for somewhat the same functionality as C++17's std::optional and uses it in several places in the ADIOS2 backend. Close #563.

@ax3l ax3l added the internal label Oct 28, 2020
@ax3l ax3l self-assigned this Oct 28, 2020
@ax3l ax3l self-requested a review October 28, 2020 06:26
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Minor points added as comments.

Can you please add test coverage for openPMD::auxiliary::Option in test/AuxiliaryTest.cpp?

include/openPMD/auxiliary/Option.hpp Outdated Show resolved Hide resolved
include/openPMD/auxiliary/Option.hpp Outdated Show resolved Hide resolved
include/openPMD/auxiliary/Option.hpp Outdated Show resolved Hide resolved
include/openPMD/auxiliary/Option.hpp Outdated Show resolved Hide resolved
include/openPMD/auxiliary/Option.hpp Outdated Show resolved Hide resolved
@ax3l ax3l changed the title Optional Lite based on variantSrc::variant Add Optional based on variantSrc::variant Oct 28, 2020

Option<int> opt;

REQUIRE_THROWS(opt.get());
Copy link
Member

@ax3l ax3l Oct 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@ax3l ax3l Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: mpark/variant#76

Will push a work-around here and unify the variant include, to avoid potential ODR issues.

Add unit tests for `auxiliary::Option`
Enable exceptions with older GCC. See upstream PR for release
1.4.0.
@ax3l ax3l merged commit a75d00f into openPMD:dev Oct 29, 2020
@franzpoeschel franzpoeschel deleted the topic-optional-lite branch January 28, 2021 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internally Use optional-lite
2 participants