-
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 4 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,14 @@ 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 | ||
#if __cplusplus >= 201703L // 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. Apply clang-format here, please |
||
constexpr | ||
#endif | ||
FMT_INLINE basic_string_view(const Char* s) : data_(s) { | ||
if (std::is_same<Char, char>::value && !detail::is_constant_evaluated()) | ||
FMT_INLINE | ||
basic_string_view(const Char* s) | ||
: data_(s) { | ||
Comment on lines
+398
to
+400
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. Did clang-format do this? 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. Yeah, it's: #if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr.
FMT_CONSTEXPR
#endif
FMT_INLINE
basic_string_view(const Char* s) : data_(s) { or: #if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr.
FMT_CONSTEXPR
#endif
FMT_INLINE basic_string_view(const Char* s) : data_(s) { or: #if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr.
constexpr
#endif
FMT_INLINE
basic_string_view(const Char* s)
: data_(s) { 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. LOL |
||
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.