-
Notifications
You must be signed in to change notification settings - Fork 0
/
d1293r1.html
103 lines (94 loc) · 3.89 KB
/
d1293r1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0095)http://wiki.edg.com/twiki/pub/Wg21rapperswil2014/LibraryEvolutionWorkingGroup/N4007_updated.htm -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style type="text/css">
.comment { color: #999999; font-style: italic; }
.pre { color: #000099; }
.string { color: #009900; }
.char { color: #009900; }
.float { color: #996600; }
.int { color: #999900; }
.bool { color: #000000; font-weight: bold; }
.type { color: #FF6633; }
.flow { color: #FF0000; }
.keyword { color: #990000; }
.operator { color: #663300; font-weight: bold; }
.operator { color: #663300; font-weight: bold; }
pre.code {
border: 2px solid #666;
background-color: #F4F4F4;
padding-left: 10px;
padding-top: 0px;
}
code {
border: 2px solid #d0d0d0;
background-color: LightYellow;
padding: 2px;
padding-left: 10px;
display:table;
white-space:pre;
margin:2px;
margin-bottom:10px;
}
dt
{
font-weight: bold;
}
.ins {
background-color:#A0FFA0;
}
.del {
background-color:#FFA0A0;
text-decoration:line-through
}
</style>
<title>ostream_joiner</title>
<style type="text/css"></style></head>
<body>
<p>D1293R1<br>
Revision of P1293R0<br>
2018-11-07<br>
Mike Spertus, Symantec<br>
<a href="mailto:[email protected]">[email protected]</a><br>
Nathan Wilson<br>
<a href="mailto:[email protected]">[email protected]</a><br>
<br></p>
<h1><tt>ostream_joiner</tt></h1>
<h2>Summary</h2>
This paper updates the <tt>ostream_joiner</tt> proposal to reflect experience
in Library Fundamentals V2 and changes in the core language since then.
Specifically, we add a deduction guide to ensure that <tt>ostream_joiner</tt>
is constructed correctly from a C string literal and remove the now-redundant
<tt>make_ostream_joiner</tt>.
<h2>Deduction guides</h2>
With the addition of class template argument deduction in C++17, it seems desirable
to get rid of the clumsy <tt>make_ostream_joiner</tt> as we did with class templates
like <tt>boyer_moore_searcher</tt>. However, as Nathan Myers has pointed out,
without any deduction guide, the decision to take the delimiter by reference
means that<code>ostream_joiner j(cout, ", ");</code>
produces a compile time error as the delimiter type is deduced as <tt>char const[3]</tt>.
To fix this, add the following to the end of the class definition for ostream_joiner
<h3>Wording</h3>
Wording is relative to Library Fundamentals v2.
In iterator.synopsis, remove the following
<blockquote><pre> template <class DelimT, class charT = char, class traits = char_traits<charT> >
class ostream_joiner;
<span class="del">template <class charT, class traits, class DelimT>
ostream_joiner<decay_t&t;DelimT>, charT, traits>
make_ostream_joiner(basic_ostream<charT, traits>& os, DelimT&& delimiter);</span></pre></blockquote>
At the end of the definition of class <tt>ostream_joiner</tt> in iterator.ostream.joiner,
add the following.
<blockquote><pre>};
<span class="ins">template<class DelimT, class CharT, class Traits>
ostream_joiner(std::basic_ostream<CharT, Traits>, _Delim) -> ostream_joiner<Delim, CharT, Traits>;</span></pre></blockquote>
Remove the iterator.ostream.joiner.creation section
<blockquote>
<span class="del">ostream_joiner creation function [iterator.ostream.joiner.creation]
<pre>
<span class="del">template <class charT, class traits, class DelimT>
ostream_joiner<decay_t<DelimT>, charT, traits>
make_ostream_joiner(basic_ostream<charT, traits>& os, DelimT&& delimiter);
</span></pre><em>Returns</em>:
<pre> <span class="del">ostream_joiner<decay_t<DelimT>, charT, traits>(os, forward<DelimT>(delimiter));</span>
</pre></span></blockquote>
</body></html>