-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Description
Hello!
Thank you for a great library. I've been using it with great pleasure. Today I found an interesting deviation from how std::optional works, and I was wondering if it's on purpose or not: std::optional<const X>
allows emplacing with a new value, whereas nonstd::optional<const X>
seemingly does not.
This snippet fails with what I think is trying to placement-new into const memory:
nonstd::optional<const int> nonstd_opt;
nonstd_opt.emplace(0);
Godbolt link: https://godbolt.org/z/r46fccxEj
Thank you for your consideration.
Metadata
Metadata
Assignees
Labels
No labels