-
Notifications
You must be signed in to change notification settings - Fork 46
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
nonstd::optional is not a literal type #19
Comments
Thanks for your analysis, Indeed To note: your example does compile with std::optional. I'd welcome improvements you suggest to See also:
|
See:
|
Proposal to copy the is_trivially_destructible property for the optional:
|
Thanks for your suggestion. May take a couple of weeks before i can address it. |
I am looking for C++14 optional drop-in which I can use in
constexpr
contexts. From the Readme it seems to fit my needs, because you state this implementation provides a LiteralType in that case. I tried to compilewith
std=c++14
two different compilers (gcc-8 and clang-5) and both failed to compile the code.While trying to fix the issue with custom patches I encountered following problems:
To make the type satisfy
std::is_literal_type
(deprecated, I know)optional
trivial for trivially destructible typesT
. This can be achieved by inheriting from a base class and using a template specialization.constexpr
To make the type usuable in constexpr contexts:
storage_t
is not constexpr, sononstd::optional
with this storage implementation is not going to be usable in constexpr contexts.Did i misunderstand something terribly wrong and/or do you think it would be worthwhile to provide some patches to target the above points.
The text was updated successfully, but these errors were encountered: