|
54 | 54 | #endif |
55 | 55 | #endif |
56 | 56 |
|
| 57 | +//! Determine portable __cplusplus macro |
| 58 | +#if defined(_MSC_VER) && defined(_MSVC_LANG) |
| 59 | + #define TINY_UTF8_CPLUSPLUS _MSVC_LANG |
| 60 | +#endif |
| 61 | + #define TINY_UTF8_CPLUSPLUS __cplusplus |
| 62 | +#endif |
| 63 | + |
57 | 64 | //! Determine the way to inform about fallthrough behavior |
58 | | -#if __cplusplus >= 201700L |
| 65 | +#if TINY_UTF8_CPLUSPLUS >= 201703L |
59 | 66 | #define TINY_UTF8_FALLTHROUGH [[fallthrough]]; |
60 | 67 | #elif defined(__clang__) |
61 | 68 | // Clang does not warn about implicit fallthrough |
|
81 | 88 | #endif |
82 | 89 |
|
83 | 90 | //! Create macro that yields its arguments, if C++17 or later is present (used for "if constexpr") |
84 | | -#if __cplusplus >= 201700L |
| 91 | +#if TINY_UTF8_CPLUSPLUS >= 201703L |
85 | 92 | #define TINY_UTF8_CPP17( ... ) __VA_ARGS__ |
86 | 93 | #else |
87 | 94 | #define TINY_UTF8_CPP17( ... ) |
@@ -117,12 +124,10 @@ namespace tiny_utf8 |
117 | 124 | using utf8_string = basic_string<char32_t, char>; // For backwards compatibility |
118 | 125 |
|
119 | 126 | //! Typedef of u8string (data type char8_t) |
120 | | - #if __cplusplus > 201703L |
121 | | - #if defined(__cpp_char8_t) |
122 | | - using u8string = basic_string<char32_t, char8_t>; |
123 | | - #else |
124 | | - using u8string = utf8_string; |
125 | | - #endif |
| 127 | + #if defined(__cpp_char8_t) |
| 128 | + using u8string = basic_string<char32_t, char8_t>; |
| 129 | + #else |
| 130 | + using u8string = utf8_string; |
126 | 131 | #endif |
127 | 132 |
|
128 | 133 | //! Implementation Detail |
|
0 commit comments