From Jason Turner

[print.fun]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpsz73yxgz/{from.md → to.md} +121 -0
tmp/tmpsz73yxgz/{from.md → to.md} RENAMED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Print functions <a id="print.fun">[[print.fun]]</a>
2
+
3
+ ``` cpp
4
+ template<class... Args>
5
+ void print(format_string<Args...> fmt, Args&&... args);
6
+ ```
7
+
8
+ *Effects:* Equivalent to:
9
+
10
+ ``` cpp
11
+ print(stdout, fmt, std::forward<Args>(args)...);
12
+ ```
13
+
14
+ ``` cpp
15
+ template<class... Args>
16
+ void print(FILE* stream, format_string<Args...> fmt, Args&&... args);
17
+ ```
18
+
19
+ *Effects:* If the ordinary literal encoding [[lex.charset]] is UTF-8,
20
+ equivalent to:
21
+
22
+ ``` cpp
23
+ vprint_unicode(stream, fmt.str, make_format_args(std::forward<Args>(args)...));
24
+ ```
25
+
26
+ Otherwise, equivalent to:
27
+
28
+ ``` cpp
29
+ vprint_nonunicode(stream, fmt.str, make_format_args(std::forward<Args>(args)...));
30
+ ```
31
+
32
+ ``` cpp
33
+ template<class... Args>
34
+ void println(format_string<Args...> fmt, Args&&... args);
35
+ ```
36
+
37
+ *Effects:* Equivalent to:
38
+
39
+ ``` cpp
40
+ println(stdout, fmt, std::forward<Args>(args)...);
41
+ ```
42
+
43
+ ``` cpp
44
+ template<class... Args>
45
+ void println(FILE* stream, format_string<Args...> fmt, Args&&... args);
46
+ ```
47
+
48
+ *Effects:* Equivalent to:
49
+
50
+ ``` cpp
51
+ print(stream, "{}\n", format(fmt, std::forward<Args>(args)...));
52
+ ```
53
+
54
+ ``` cpp
55
+ void vprint_unicode(string_view fmt, format_args args);
56
+ ```
57
+
58
+ *Effects:* Equivalent to:
59
+
60
+ ``` cpp
61
+ vprint_unicode(stdout, fmt, args);
62
+ ```
63
+
64
+ ``` cpp
65
+ void vprint_unicode(FILE* stream, string_view fmt, format_args args);
66
+ ```
67
+
68
+ *Preconditions:* `stream` is a valid pointer to an output C stream.
69
+
70
+ *Effects:* The function initializes an automatic variable via
71
+
72
+ ``` cpp
73
+ string out = vformat(fmt, args);
74
+ ```
75
+
76
+ If `stream` refers to a terminal capable of displaying Unicode, writes
77
+ `out` to the terminal using the native Unicode API; if `out` contains
78
+ invalid code units, the behavior is undefined and implementations are
79
+ encouraged to diagnose it. Otherwise writes `out` to `stream` unchanged.
80
+ If the native Unicode API is used, the function flushes `stream` before
81
+ writing `out`.
82
+
83
+ [*Note 1*: On POSIX and Windows, `stream` referring to a terminal means
84
+ that, respectively, `isatty(fileno(stream))` and
85
+ `GetConsoleMode(_get_osfhandle(_fileno(stream)), ...)` return
86
+ nonzero. — *end note*]
87
+
88
+ [*Note 2*: On Windows, the native Unicode API is
89
+ `WriteConsoleW`. — *end note*]
90
+
91
+ *Throws:* Any exception thrown by the call to `vformat`
92
+ [[format.err.report]]. `system_error` if writing to the terminal or
93
+ `stream` fails. May throw `bad_alloc`.
94
+
95
+ *Recommended practice:* If invoking the native Unicode API requires
96
+ transcoding, implementations should substitute invalid code units with
97
+ U+fffd (replacement character) per the Unicode Standard, Chapter 3.9
98
+ ‘U+fffd‘ Substitution in Conversion.
99
+
100
+ ``` cpp
101
+ void vprint_nonunicode(string_view fmt, format_args args);
102
+ ```
103
+
104
+ *Effects:* Equivalent to:
105
+
106
+ ``` cpp
107
+ vprint_nonunicode(stdout, fmt, args);
108
+ ```
109
+
110
+ ``` cpp
111
+ void vprint_nonunicode(FILE* stream, string_view fmt, format_args args);
112
+ ```
113
+
114
+ *Preconditions:* `stream` is a valid pointer to an output C stream.
115
+
116
+ *Effects:* Writes the result of `vformat(fmt, args)` to `stream`.
117
+
118
+ *Throws:* Any exception thrown by the call to `vformat`
119
+ [[format.err.report]]. `system_error` if writing to `stream` fails. May
120
+ throw `bad_alloc`.
121
+