-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
added formatter for std::expected #3834
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Merged, thanks! |
|
||
if (value.has_value()) { | ||
out = detail::write<Char>(out, "expected("); | ||
out = detail::write_escaped_alternative<Char>(out, value.value()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't *value
be a better call here?
Given that it was confirmed that value
has_value()
there should be no need for the 'checked retrieval' of the value?
see std::expected<T,E>::operator*
out = detail::write_escaped_alternative<Char>(out, *value);
(edit) I know this is after the fact, I am just working through the release notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, a PR to change this to use dereference would be welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR: #4040
Simple implementation of a 'std::expected' formatter.
Open for discussions :)
By submitting this pull request, you agree to license your contribution(s)
under the terms outlined in LICENSE.rst and represent that you have the right
to do so.