mirror of
https://github.com/fmtlib/fmt.git
synced 2025-10-08 04:10:54 +02:00
Make char8_t a strongly-typed enum
This commit is contained in:
@@ -206,7 +206,7 @@ FMT_FUNC size_t internal::count_code_points(u8string_view s) {
|
||||
const char8_t *data = s.data();
|
||||
int num_code_points = 0;
|
||||
for (size_t i = 0, size = s.size(); i != size; ++i) {
|
||||
if ((data[i].value & 0xc0) != 0x80)
|
||||
if ((data[i] & 0xc0) != 0x80)
|
||||
++num_code_points;
|
||||
}
|
||||
return num_code_points;
|
||||
|
@@ -437,12 +437,7 @@ void basic_buffer<T>::append(const U *begin, const U *end) {
|
||||
} // namespace internal
|
||||
|
||||
// A UTF-8 code unit type.
|
||||
struct char8_t {
|
||||
char value;
|
||||
FMT_CONSTEXPR FMT_EXPLICIT operator bool() const FMT_NOEXCEPT {
|
||||
return value != 0;
|
||||
}
|
||||
};
|
||||
enum char8_t: unsigned char {};
|
||||
|
||||
// A UTF-8 string view.
|
||||
class u8string_view : public basic_string_view<char8_t> {
|
||||
|
Reference in New Issue
Block a user