-
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
fix: support optional<T>
with format_as(T)
(#3712)
#3713
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. Overall looks good but could you add a test case to https://github.com/fmtlib/fmt/blob/master/test/std-test.cc?
7690be8
to
a476850
Compare
I have done so now 😃 |
test/std-test.cc
Outdated
one, | ||
two, | ||
}; | ||
auto format_as(my_number number) { |
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.
Here and below a return type is needed.
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.
Here and below a return type is needed.
Added now. I am spoiled by working with C++20...
@@ -90,6 +90,34 @@ TEST(std_test, optional) { | |||
#endif | |||
} | |||
|
|||
namespace my_nso { |
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.
What does "nso" stand for?
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.
What does "nso" stand for?
I was trying to follow the naming scheme with short namespaces below, my_ns1
& my_ns2
, and added an o
for optional
, since my_ns3
before the two others didn't make sense. But I'll change to whatever you prefer.
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.
my_nso
is OK
Formatting a std::optional<T> where T had a custom format_as(T) function failed to compile with clang, due to set_debug_format being hidden by private inheritance. This fix makes the function available through a using clause.
a476850
to
75050ae
Compare
Formatting a std::optional<T> where T had a custom format_as(T) function failed to compile with clang, due to set_debug_format being hidden by private inheritance. This fix makes the function available through a using clause.
Formatting a
std::optional<T>
where T had a customformat_as(T)
function failed to compile with clang, due toset_debug_format
being hidden by private inheritance. This fix makes the function available through a using clause.This fixes #3712