diff --git a/include/fmt/printf.h b/include/fmt/printf.h index ae64484b..07f80dc3 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -330,40 +330,6 @@ template struct printf_formatter { } }; -namespace detail { -template -struct has_container_append : std::false_type {}; - -template -struct has_container_append< - OutputIt, - void_t()) - .append(std::declval< - const typename OutputIt::container_type::value_type*>(), - std::declval()))>> : std::true_type {}; - -template -enable_if_t::value, OutputIt> -container_aware_copy(const typename OutputIt::container_type::value_type* first, - const typename OutputIt::container_type::value_type* last, - OutputIt out) { - detail::get_container(out).append(first, last); - return out; -} - -static_assert(has_container_append>::value, - "has_container_append doesn't work"); - -template -enable_if_t::value, OutputIt> -container_aware_copy(const Char* first, const Char* last, OutputIt out) { - return std::copy(first, last, out); -} - -} // namespace detail - /** This template formats data and writes the output through an output iterator. */ @@ -514,11 +480,11 @@ OutputIt basic_printf_context::format() { } char_type c = *it++; if (it != end && *it == c) { - out = container_aware_copy(start, it, out); + out = detail::write(out, basic_string_view(start, it - start)); start = ++it; continue; } - out = container_aware_copy(start, it - 1, out); + out = detail::write(out, basic_string_view(start, it - 1 - start)); format_specs specs; specs.align = align::right; @@ -630,7 +596,7 @@ OutputIt basic_printf_context::format() { // Format argument. out = visit_format_arg(ArgFormatter(out, specs, *this), arg); } - return container_aware_copy(start, it, out); + return detail::write(out, basic_string_view(start, it - start)); } template