-
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 #2210 #2211
fix #2210 #2211
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,11 +392,12 @@ template <typename Char> class basic_string_view { | |
the size with ``std::char_traits<Char>::length``. | ||
\endrst | ||
*/ | ||
#if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr. | ||
FMT_CONSTEXPR | ||
// C++17's char_traits::length() is constexpr. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good but please move this comment back to the next line to avoid interfering with an apidoc comment above and apply clang-format. |
||
#if __cplusplus >= 201703L | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert back |
||
constexpr | ||
#endif | ||
FMT_INLINE basic_string_view(const Char* s) : data_(s) { | ||
if (std::is_same<Char, char>::value && !detail::is_constant_evaluated()) | ||
if (detail::const_check(std::is_same<Char, char>::value && !detail::is_constant_evaluated())) | ||
size_ = std::strlen(reinterpret_cast<const char*>(s)); | ||
else | ||
size_ = std::char_traits<Char>::length(s); | ||
|
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.
And another observation, it's not about this PR, just these lines in general: probably
constexpr
can be used here, notFMT_CONSTEXPR
, since it's already under the__cplusplus >= 201703L
macro check.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.
Looks like this actually can be applied to this PR too, since it's also used in newly introduced macro definition.