Skip to content

Commit

Permalink
Unbloat chrono
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jul 22, 2024
1 parent 42d3d70 commit c5af39b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ struct formatter<std::chrono::duration<Rep, Period>, Char> {
// As a possible future optimization, we could avoid extra copying if width
// is not specified.
auto buf = basic_memory_buffer<Char>();
auto out = std::back_inserter(buf);
auto out = basic_appender<Char>(buf);
detail::handle_dynamic_spec<detail::width_checker>(specs.width, width_ref_,
ctx);
detail::handle_dynamic_spec<detail::precision_checker>(precision,
Expand Down Expand Up @@ -2388,7 +2388,7 @@ template <typename Char> struct formatter<std::tm, Char> {
const Duration* subsecs) const -> decltype(ctx.out()) {
auto specs = specs_;
auto buf = basic_memory_buffer<Char>();
auto out = std::back_inserter(buf);
auto out = basic_appender<Char>(buf);
detail::handle_dynamic_spec<detail::width_checker>(specs.width, width_ref_,
ctx);

Expand Down
8 changes: 4 additions & 4 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1314,10 +1314,10 @@ FMT_CONSTEXPR20 auto format_decimal(Char* out, UInt value, int size)
return {begin + n, end};
}

template <typename Char, typename UInt, typename Iterator,
FMT_ENABLE_IF(!std::is_pointer<remove_cvref_t<Iterator>>::value)>
FMT_CONSTEXPR inline auto format_decimal(Iterator out, UInt value, int size)
-> format_decimal_result<Iterator> {
template <typename Char, typename UInt, typename OutputIt,
FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)>
FMT_CONSTEXPR inline auto format_decimal(OutputIt out, UInt value, int size)
-> format_decimal_result<OutputIt> {
// Buffer is large enough to hold all digits (digits10 + 1).
Char buffer[digits10<UInt>() + 1] = {};
auto end = format_decimal(buffer, value, size).end;
Expand Down

0 comments on commit c5af39b

Please sign in to comment.