| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,9 +38,11 @@ struct ToStringHelper { | |||
| 38 | 38 | ||
| 39 | 39 | template <typename T, | |
| 40 | 40 | typename test_for_number = typename std:: | |
| 41 | - enable_if<std::is_arithmetic<T>::value, bool>::type, | ||
| 41 | + enable_if_t<std::is_arithmetic_v<T> || std::is_enum_v<T>, bool>, | ||
| 42 | 42 | typename dummy = bool> | |
| 43 | - static std::string Convert(const T& value) { return std::to_string(value); } | ||
| 43 | + static std::string Convert(const T& value) { | ||
| 44 | + return std::to_string(value); | ||
| 45 | + } | ||
| 44 | 46 | static std::string_view Convert(const char* value) { | |
| 45 | 47 | return value != nullptr ? value : "(null)"; | |
| 46 | 48 | } | |
@@ -58,8 +60,7 @@ struct ToStringHelper { | |||
| 58 | 60 | const char* digits = "0123456789abcdef"; | |
| 59 | 61 | do { | |
| 60 | 62 | unsigned digit = v & ((1 << BASE_BITS) - 1); | |
| 61 | - *--ptr = | ||
| 62 | - (BASE_BITS < 4 ? static_cast<char>('0' + digit) : digits[digit]); | ||
| 63 | + *--ptr = (BASE_BITS < 4 ? static_cast<char>('0' + digit) : digits[digit]); | ||
| 63 | 64 | } while ((v >>= BASE_BITS) != 0); | |
| 64 | 65 | return ptr; | |
| 65 | 66 | } | |
@@ -139,12 +140,10 @@ std::string COLD_NOINLINE SPrintFImpl( // NOLINT(runtime/string) | |||
| 139 | 140 | ret += node::ToUpper(ToBaseString<4>(arg)); | |
| 140 | 141 | break; | |
| 141 | 142 | case 'p': { | |
| 142 | - CHECK(std::is_pointer<typename std::remove_reference<Arg>::type>::value); | ||
| 143 | + CHECK(std::is_pointer_v<typename std::remove_reference_t<Arg>>); | ||
| 143 | 144 | char out[20]; | |
| 144 | - int n = snprintf(out, | ||
| 145 | - sizeof(out), | ||
| 146 | - "%p", | ||
| 147 | - *reinterpret_cast<const void* const*>(&arg)); | ||
| 145 | + int n = snprintf( | ||
| 146 | + out, sizeof(out), "%p", *reinterpret_cast<const void* const*>(&arg)); | ||
| 148 | 147 | CHECK_GE(n, 0); | |
| 149 | 148 | ret += out; | |
| 150 | 149 | break; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments