-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enable FMT_STRING() use with types other than string literals #1589
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
Conversation
c3c6c0a to
13857cf
Compare
|
Thanks for the PR. Could you explain the motivation for this change? |
|
Our coding standards use string_view and equivalent types for defining shared string constants as they are generally more type safe. This enables us to continue to use such types for use in our logging system which uses fmt. The change in the terminating null character detection is mostly just because I noticed it while working in the same area, we don't have concrete need for it currently. |
vitaut
left a comment
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.
Makes sense. Please add unit tests to test/format-test.cc and address inline comments.
13857cf to
ef1538d
Compare
|
Added unit test when building with C++17. |
6155d47 to
b28b27f
Compare
vitaut
left a comment
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.
Two more comments, otherwise looks good.
8e074a9 to
5e2476e
Compare
vitaut
left a comment
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.
There are some build failures in CI.
729032b to
45c60ad
Compare
45c60ad to
4c04162
Compare
|
Finally got the changes trimmed down to what is needed and fixed the last few niggling platform-specific build errors, so this should be good to go absent further feedback. |
|
Merged with minor tweaks in 664dd88. Thanks! |
This enables using FMT_STRING() with raw character arrays, like:
...and other string view types like:
Also fixes some
constexprevaluation build errors when building with C++17 witharg_refinternal class.I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.