optional-bare
optional-bare copied to clipboard
Exception thrown in copy constructor when copying empty optional
https://github.com/martinmoene/optional-bare/blob/0bb1d183bcee1e854c4ea196b533252c51f98b81/include/nonstd/optional.hpp#L179
May be I don't understand something, but how this line is supposed to work if method value() always checks assert(has_value())
?
As i understand it we will always get exception when trying to copy empty optional.
Thanks @Andoku , for spotting & reporting this.
Added the missing test case and corrected the behaviour.
@martinmoene I think assignment operator has the same problem
Ah thanks,will look at that too.