Skip to content

Commit 4b4d564

Browse files
committed
Use same unsupported character type warning
1 parent 0518f10 commit 4b4d564

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/boost/decimal/format.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,12 @@ struct formatter<T>
225225
template <typename FormatContext>
226226
auto format(const T &v, FormatContext &ctx) const
227227
{
228-
using CharType = FormatContext::char_type;
229228
using namespace boost::decimal;
230229
using namespace boost::decimal::detail;
231230

231+
using CharType = FormatContext::char_type;
232+
static_assert(is_formattable_character_type_v<CharType>, "This is an unsupported character type. Only the following can be used: char, char8_t, char16_t, char32_t, or wchar_t");
233+
232234
std::array<char, 128> buffer {};
233235
auto buffer_front = buffer.data();
234236
bool has_sign {false};
@@ -339,7 +341,6 @@ struct formatter<T>
339341
}
340342
else
341343
{
342-
static_assert(std::is_same_v<CharType, char8_t>, "Unsupported wide character type");
343344
return std::format_to(ctx.out(), u8"{}", result);
344345
}
345346
}

0 commit comments

Comments
 (0)