Skip to content

Commit 45862a8

Browse files
committed
Convert static_assert in fly::Formatter to use a concept
1 parent a5514d1 commit 45862a8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

fly/types/string/formatters.hpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,9 @@ struct Formatter<T, CharType> : public detail::BasicFormatSpecifier<CharType>
228228
* @param is_negative Whether the original value was negative.
229229
* @param context The context holding the formatting state.
230230
*/
231-
template <typename U, typename FormatContext>
231+
template <fly::UnsignedIntegral U, typename FormatContext>
232232
void format(U value, bool is_negative, FormatContext &context)
233233
{
234-
static_assert(std::is_unsigned_v<U>);
235-
236234
if (m_type == FormatSpecifier::Type::Character)
237235
{
238236
format_as_character(value, is_negative, context);
@@ -359,11 +357,9 @@ struct Formatter<T, CharType> : public detail::BasicFormatSpecifier<CharType>
359357
* @param is_negative Whether the original value was negative.
360358
* @param context The context holding the formatting state.
361359
*/
362-
template <typename U, typename FormatContext>
360+
template <fly::UnsignedIntegral U, typename FormatContext>
363361
void format_as_character(U value, bool is_negative, FormatContext &context)
364362
{
365-
static_assert(std::is_unsigned_v<U>);
366-
367363
if (is_negative || (value > static_cast<U>(std::numeric_limits<CharType>::max())))
368364
{
369365
return;

0 commit comments

Comments
 (0)