|
7706 | 7706 | \begin{itemdescr}
|
7707 | 7707 | \pnum
|
7708 | 7708 | \effects
|
| 7709 | +Let \tcode{locksafe} be |
| 7710 | +\tcode{(enable_nonlocking_formatter_optimization<remove_cvref_t<Args>> \&\& ...)}. |
7709 | 7711 | If the ordinary literal encoding\iref{lex.charset} is UTF-8, equivalent to:
|
7710 | 7712 | \begin{codeblock}
|
7711 |
| -vprint_unicode(stream, fmt.@\exposid{str}@, make_format_args(args...)); |
| 7713 | +locksafe |
| 7714 | + ? vprint_unicode_locking(stream, fmt.str, make_format_args(args...)) |
| 7715 | + : vprint_unicode(stream, fmt.str, make_format_args(args...)); |
7712 | 7716 | \end{codeblock}
|
7713 | 7717 | Otherwise, equivalent to:
|
7714 | 7718 | \begin{codeblock}
|
7715 |
| -vprint_nonunicode(stream, fmt.@\exposid{str}@, make_format_args(args...)); |
| 7719 | +locksafe |
| 7720 | + ? vprint_nonunicode_locking(stream, fmt.str, make_format_args(args...)) |
| 7721 | + : vprint_nonunicode(stream, fmt.str, make_format_args(args...)); |
7716 | 7722 | \end{codeblock}
|
7717 | 7723 | \end{itemdescr}
|
7718 | 7724 |
|
|
7742 | 7748 | \effects
|
7743 | 7749 | Equivalent to:
|
7744 | 7750 | \begin{codeblock}
|
7745 |
| -print(stream, "{}\n", format(fmt, std::forward<Args>(args)...)); |
| 7751 | +print(stream, runtime_format(string(fmt.get()) + '\n'), std::forward<Args>(args)...); |
7746 | 7752 | \end{codeblock}
|
7747 | 7753 | \end{itemdescr}
|
7748 | 7754 |
|
|
7765 | 7771 | void vprint_unicode(FILE* stream, string_view fmt, format_args args);
|
7766 | 7772 | \end{itemdecl}
|
7767 | 7773 |
|
| 7774 | +\begin{itemdescr} |
| 7775 | +\pnum |
| 7776 | +\effects |
| 7777 | +Equivalent to: |
| 7778 | +\begin{codeblock} |
| 7779 | +string out = vformat(fmt, args); |
| 7780 | +vprint_unicode_locking(stream, "{}", make_format_args(out)); |
| 7781 | +\end{codeblock} |
| 7782 | +\end{itemdescr} |
| 7783 | + |
| 7784 | +\indexlibraryglobal{vprint_unicode_locking}% |
| 7785 | +\begin{itemdecl} |
| 7786 | +void vprint_unicode_locking(FILE* stream, string_view fmt, format_args args); |
| 7787 | +\end{itemdecl} |
| 7788 | + |
7768 | 7789 | \begin{itemdescr}
|
7769 | 7790 | \pnum
|
7770 | 7791 | \expects
|
7771 | 7792 | \tcode{stream} is a valid pointer to an output C stream.
|
7772 | 7793 |
|
7773 | 7794 | \pnum
|
7774 | 7795 | \effects
|
7775 |
| -The function initializes an automatic variable via |
7776 |
| -\begin{codeblock} |
7777 |
| -string out = vformat(fmt, args); |
7778 |
| -\end{codeblock} |
| 7796 | +Locks \tcode{stream}. |
| 7797 | +Let \tcode{out} denote the character representation of |
| 7798 | +formatting arguments provided by \tcode{args} |
| 7799 | +formatted according to specifications given in \tcode{fmt}. |
7779 | 7800 | If \tcode{stream} refers to a terminal capable of displaying Unicode,
|
7780 | 7801 | writes \tcode{out} to the terminal using the native Unicode API;
|
7781 | 7802 | if \tcode{out} contains invalid code units,
|
|
7785 | 7806 | Otherwise writes \tcode{out} to \tcode{stream} unchanged.
|
7786 | 7807 | If the native Unicode API is used,
|
7787 | 7808 | the function flushes \tcode{stream} before writing \tcode{out}.
|
| 7809 | +Unconditionally unlocks \tcode{stream} on function exit. |
| 7810 | + |
| 7811 | +\xrefc{7.21.2}. |
| 7812 | + |
7788 | 7813 | \begin{note}
|
7789 | 7814 | On POSIX and Windows, \tcode{stream} referring to a terminal means that,
|
7790 | 7815 | respectively,
|
|
7829 | 7854 | void vprint_nonunicode(FILE* stream, string_view fmt, format_args args);
|
7830 | 7855 | \end{itemdecl}
|
7831 | 7856 |
|
| 7857 | +\begin{itemdescr} |
| 7858 | +\pnum |
| 7859 | +\effects |
| 7860 | +Equivalent to: |
| 7861 | +\begin{codeblock} |
| 7862 | +string out = vformat(fmt, args); |
| 7863 | +vprint_nonunicode_locking("{}", make_format_args(out)); |
| 7864 | +\end{codeblock} |
| 7865 | +\end{itemdescr} |
| 7866 | + |
| 7867 | +\indexlibraryglobal{vprint_nonunicode_locking}% |
| 7868 | +\begin{itemdecl} |
| 7869 | +void vprint_nonunicode_locking(FILE* stream, string_view fmt, format_args args); |
| 7870 | +\end{itemdecl} |
| 7871 | + |
7832 | 7872 | \begin{itemdescr}
|
7833 | 7873 | \pnum
|
7834 | 7874 | \expects
|
7835 | 7875 | \tcode{stream} is a valid pointer to an output C stream.
|
7836 | 7876 |
|
7837 | 7877 | \pnum
|
7838 | 7878 | \effects
|
7839 |
| -Writes the result of \tcode{vformat(fmt, args)} to \tcode{stream}. |
| 7879 | +While holding the lock on \tcode{stream}, |
| 7880 | +writes the character representation of |
| 7881 | +formatting arguments provided by \tcode{args} |
| 7882 | +formatted according to specifications given in \tcode{fmt} to \tcode{stream}. |
7840 | 7883 |
|
7841 | 7884 | \pnum
|
7842 | 7885 | \throws
|
|
0 commit comments