Repository: fmtlib/fmt
File: include/fmt/color.h (C/C++)

Code before:
  detail::vformat_to(buf, ts, to_string_view(format), args);
  if (detail::is_utf8()) {
    detail::print(f, basic_string_view<Char>(buf.begin(), buf.size()));
  } else {
    buf.push_back(Char(0));
    detail::fputs(buf.data(), f);
  }
}

/**
  \rst
  Formats a string and prints it to the specified file stream using ANSI
  escape sequences to specify text formatting.

  **Example**::

    fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
               "Elapsed time: {0:.2f} seconds", 1.23);
  \endrst
 */
template <typename S, typename... Args,
          FMT_ENABLE_IF(detail::is_string<S>::value)>
void print(std::FILE* f, const text_style& ts, const S& format_str,
           const Args&... args) {
  vprint(f, ts, format_str,
         fmt::make_format_args<buffer_context<type_identity_t<char_t<S>>>>(
             args...));
}

/**
  \rst
  Formats a string and prints it to stdout using ANSI escape sequences to
  specify text formatting.

  **Example**::

    fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
               "Elapsed time: {0:.2f} seconds", 1.23);
  \endrst
 */
template <typename S, typename... Args,
          FMT_ENABLE_IF(detail::is_string<S>::value)>
void print(const text_style& ts, const S& format_str, const Args&... args) {
  return print(stdout, ts, format_str, args...);
}

template <typename S, typename Char = char_t<S>>
inline std::basic_string<Char> vformat(
    const text_style& ts, const S& format_str,
    basic_format_args<buffer_context<type_identity_t<Char>>> args) {
  basic_memory_buffer<Char> buf;

Review comment (suggestion):
I don't think `type_identity_t` is needed here and in similar cases below.

Code after:
  detail::vformat_to(buf, ts, to_string_view(format), args);
  if (detail::is_utf8()) {
    detail::print(f, basic_string_view<Char>(buf.begin(), buf.size()));
  } else {
    buf.push_back(Char(0));
    detail::fputs(buf.data(), f);
  }
}

/**
  \rst
  Formats a string and prints it to the specified file stream using ANSI
  escape sequences to specify text formatting.

  **Example**::

    fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
               "Elapsed time: {0:.2f} seconds", 1.23);
  \endrst
 */
template <typename S, typename... Args,
          FMT_ENABLE_IF(detail::is_string<S>::value)>
void print(std::FILE* f, const text_style& ts, const S& format_str,
           const Args&... args) {
  vprint(f, ts, format_str,
         fmt::make_format_args<buffer_context<char_t<S>>>(args...));
}

/**
  \rst
  Formats a string and prints it to stdout using ANSI escape sequences to
  specify text formatting.

  **Example**::

    fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
               "Elapsed time: {0:.2f} seconds", 1.23);
  \endrst
 */
template <typename S, typename... Args,
          FMT_ENABLE_IF(detail::is_string<S>::value)>
void print(const text_style& ts, const S& format_str, const Args&... args) {
  return print(stdout, ts, format_str, args...);
}

template <typename S, typename Char = char_t<S>>
inline std::basic_string<Char> vformat(
    const text_style& ts, const S& format_str,
    basic_format_args<buffer_context<type_identity_t<Char>>> args) {
  basic_memory_buffer<Char> buf;
  detail::vformat_to(buf, ts, to_string_view(format_str), args);