fix build

This commit is contained in:
Jin S 2024-02-23 14:28:25 -05:00
parent 7a8288d3a1
commit 181dbcf0b3

View File

@ -391,6 +391,7 @@ struct range_formatter<
detail::string_literal<Char, ']'>{};
bool is_string_format = false;
bool is_debug = false;
public:
FMT_CONSTEXPR range_formatter() {}
@ -416,8 +417,7 @@ struct range_formatter<
if (it != end && *it == 'n') {
set_brackets({}, {});
++it;
}
else {
} else {
bool check_for_s = false;
if (it != end && *it == '?') {
++it;
@ -427,35 +427,36 @@ struct range_formatter<
is_debug = true;
}
if (it != end && *it == 's') {
if (!std::is_same<T,Char>::value) {
if (!std::is_same<T, Char>::value) {
report_error("invalid format specifier");
}
if (!is_debug) {
set_brackets(detail::string_literal<Char, '"'>{}, detail::string_literal<Char, '"'>{});
set_brackets(detail::string_literal<Char, '"'>{},
detail::string_literal<Char, '"'>{});
}
check_for_s = false;
is_string_format = true;
++it;
++it;
}
if (check_for_s) {
if (check_for_s) {
report_error("invalid format specifier");
}
}
}
if (it != end && *it != '}') {
if (is_string_format || *it != ':') report_error("invalid format specifier");
if (it != end && *it != '}') {
if (is_string_format || *it != ':')
report_error("invalid format specifier");
++it;
} else {
if (!is_string_format)
detail::maybe_set_debug_format(underlying_, true);
if (!is_string_format) detail::maybe_set_debug_format(underlying_, true);
}
ctx.advance_to(it);
return underlying_.parse(ctx);
}
template <typename R, typename FormatContext, typename U = T, enable_if_t<std::is_same<U,Char>::value, bool> = true>
template <typename R, typename FormatContext, typename U = T,
enable_if_t<std::is_same<U, Char>::value, bool> = true>
auto format(R&& range, FormatContext& ctx) const -> decltype(ctx.out()) {
detail::range_mapper<buffered_context<Char>> mapper;
auto out = ctx.out();
@ -472,22 +473,21 @@ struct range_formatter<
}
format_specs spec_str{};
spec_str.type = presentation_type::debug;
detail::write<Char>(out, basic_string_view(buf.data(),buf.size()), spec_str);
}
else {
detail::write<Char>(out, basic_string_view<Char>(buf.data(), buf.size()),
spec_str);
} else {
for (; it != end; ++it) {
ctx.advance_to(out);
auto&& item = *it;
out = underlying_.format(mapper.map(item), ctx);
out = underlying_.format(mapper.map(item), ctx);
}
}
}
else {
} else {
for (; it != end; ++it) {
if (i > 0) out = detail::copy<Char>(separator_, out);
ctx.advance_to(out);
auto&& item = *it;
out = underlying_.format(mapper.map(item), ctx);
out = underlying_.format(mapper.map(item), ctx);
++i;
}
}
@ -495,7 +495,8 @@ struct range_formatter<
return out;
}
template <typename R, typename FormatContext, typename U = T, enable_if_t<!(std::is_same<U,Char>::value), bool> = true>
template <typename R, typename FormatContext, typename U = T,
enable_if_t<!(std::is_same<U, Char>::value), bool> = true>
auto format(R&& range, FormatContext& ctx) const -> decltype(ctx.out()) {
detail::range_mapper<buffered_context<Char>> mapper;
auto out = ctx.out();
@ -507,7 +508,7 @@ struct range_formatter<
if (i > 0) out = detail::copy<Char>(separator_, out);
ctx.advance_to(out);
auto&& item = *it;
out = underlying_.format(mapper.map(item), ctx);
out = underlying_.format(mapper.map(item), ctx);
++i;
}
out = detail::copy<Char>(closing_bracket_, out);