Skip to content

Commit 69c6e9e

Browse files
committed
tools/ceph-dencoder/sstring.h: use char8_t instead of unsigned char
This fixes a build failure with libc++ (clang/LLVM). This build failure is correct: there exists no specialization for `std::char_traits<unsigned char>`. The standards-compliant way to use unsigned chars in strings is to use `char8_t`. Signed-off-by: Max Kellermann <[email protected]>
1 parent 99f58a5 commit 69c6e9e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/common/sstring.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ template <typename char_type, typename Size, Size max_size>
4444
class basic_sstring {
4545
static_assert(
4646
(std::is_same<char_type, char>::value
47+
|| std::is_same<char_type, char8_t>::value
4748
|| std::is_same<char_type, signed char>::value
4849
|| std::is_same<char_type, unsigned char>::value),
4950
"basic_sstring only supports single byte char types");

src/tools/ceph-dencoder/sstring.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class sstring_wrapper {
88
using sstring16 = basic_sstring<char, uint32_t, 16>;
99
sstring16 s1;
10-
using sstring24 = basic_sstring<unsigned char, uint16_t, 24>;
10+
using sstring24 = basic_sstring<char8_t, uint16_t, 24>;
1111
sstring24 s2;
1212
public:
1313
sstring_wrapper() = default;

0 commit comments

Comments
 (0)