Apply coding conventions

This commit is contained in:
Victor Zverovich
2025-08-17 10:59:16 -07:00
parent 8a8ff6177c
commit e719c43cc6

View File

@@ -1312,11 +1312,12 @@ template <typename WChar, typename Buffer = memory_buffer> class to_utf8 {
explicit to_utf8(basic_string_view<WChar> s,
to_utf8_error_policy policy = to_utf8_error_policy::abort) {
static_assert(sizeof(WChar) == 2 || sizeof(WChar) == 4,
"Expect utf16 or utf32");
if (!convert(s, policy))
"expected utf16 or utf32");
if (!convert(s, policy)) {
FMT_THROW(std::runtime_error(sizeof(WChar) == 2 ? "invalid utf16"
: "invalid utf32"));
}
}
operator string_view() const { return string_view(&buffer_[0], size()); }
auto size() const -> size_t { return buffer_.size() - 1; }
auto c_str() const -> const char* { return &buffer_[0]; }