]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.4/doc/html/ext/lwg-defects.html
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.4 / doc / html / ext / lwg-defects.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html><head>
3 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
4
5
6 <title>C++ Standard Library Defect Report List</title>
7 <style type="text/css">
8 p {text-align:justify}
9 li {text-align:justify}
10 ins {background-color:#A0FFA0}
11 del {background-color:#FFA0A0}
12 </style>
13 </head><body>
14 <table>
15 <tbody><tr>
16 <td align="left">Doc. no.</td>
17 <td align="left">N2728=08-0238</td>
18 </tr>
19 <tr>
20 <td align="left">Date:</td>
21 <td align="left">2008-08-24</td>
22 </tr>
23 <tr>
24 <td align="left">Project:</td>
25 <td align="left">Programming Language C++</td>
26 </tr>
27 <tr>
28 <td align="left">Reply to:</td>
29 <td align="left">Howard Hinnant &lt;<a href="mailto:howard.hinnant@gmail.com">howard.hinnant@gmail.com</a>&gt;</td>
30 </tr>
31 </tbody></table>
32 <h1>C++ Standard Library Defect Report List (Revision R59)</h1>
33
34   <p>Reference ISO/IEC IS 14882:1998(E)</p>
35   <p>Also see:</p>
36     <ul>
37       <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-toc.html">Table of Contents</a> for all library issues.</li>
38       <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html">Index by Section</a> for all library issues.</li>
39       <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html">Index by Status</a> for all library issues.</li>
40       <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html">Library Active Issues List</a></li>
41       <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html">Library Closed Issues List</a></li>
42     </ul>
43   <p>This document contains only library issues which have been closed
44   by the Library Working Group (LWG) after being found to be defects
45   in the standard.  That is, issues which have a status of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>,
46   <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>, or <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#RR">RR</a>. See the
47   <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html">Library Closed Issues List</a> for issues closed as non-defects.  See the
48   <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html">Library Active Issues List</a> for active issues and more information.  The
49   introductory material in that document also applies to this
50   document.</p>
51
52 <h2>Revision History</h2>
53 <ul>
54 <li>R59: 
55 2008-08-22 pre-San Francisco mailing.
56 <ul>
57 <li><b>Summary:</b><ul>
58 <li>192 open issues, up by 9.</li>
59 <li>686 closed issues, up by 0.</li>
60 <li>878 issues total, up by 9.</li>
61 </ul></li>
62 <li><b>Details:</b><ul>
63 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#870">870</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#871">871</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#872">872</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#873">873</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#874">874</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#875">875</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#876">876</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#877">877</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#878">878</a>.</li>
64 </ul></li>
65 </ul>
66 </li>
67 <li>R58: 
68 2008-07-28 mid-term mailing.
69 <ul>
70 <li><b>Summary:</b><ul>
71 <li>183 open issues, up by 12.</li>
72 <li>686 closed issues, down by 4.</li>
73 <li>869 issues total, up by 8.</li>
74 </ul></li>
75 <li><b>Details:</b><ul>
76 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#862">862</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#863">863</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#864">864</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#865">865</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#866">866</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#867">867</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#868">868</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#869">869</a>.</li>
77 <li>Changed the following issues from Pending NAD Editorial to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#393">393</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#557">557</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#592">592</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#754">754</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#757">757</a>.</li>
78 <li>Changed the following issues from Pending WP to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#644">644</a>.</li>
79 <li>Changed the following issues from WP to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#387">387</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#629">629</a>.</li>
80 <li>Changed the following issues from Pending NAD Editorial to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#709">709</a>.</li>
81 </ul></li>
82 </ul>
83 </li>
84 <li>R57: 
85 2008-06-27 post-Sophia Antipolis mailing.
86 <ul>
87 <li><b>Summary:</b><ul>
88 <li>171 open issues, down by 20.</li>
89 <li>690 closed issues, up by 43.</li>
90 <li>861 issues total, up by 23.</li>
91 </ul></li>
92 <li><b>Details:</b><ul>
93 <li>Added the following NAD issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#840">840</a>.</li>
94 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#841">841</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#843">843</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#845">845</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#846">846</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#847">847</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#849">849</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#853">853</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#854">854</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#855">855</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#856">856</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#857">857</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#858">858</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#859">859</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#860">860</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#861">861</a>.</li>
95 <li>Added the following Open issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#839">839</a>.</li>
96 <li>Added the following Ready issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#842">842</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#844">844</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#848">848</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#850">850</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#852">852</a>.</li>
97 <li>Added the following Review issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#851">851</a>.</li>
98 <li>Changed the following issues from New to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#826">826</a>.</li>
99 <li>Changed the following issues from Open to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#570">570</a>.</li>
100 <li>Changed the following issues from New to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#786">786</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#831">831</a>.</li>
101 <li>Changed the following issues from Open to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#756">756</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#767">767</a>.</li>
102 <li>Changed the following issues from New to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#723">723</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#726">726</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#794">794</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#815">815</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#825">825</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#830">830</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#833">833</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#834">834</a>.</li>
103 <li>Changed the following issues from Ready to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#471">471</a>.</li>
104 <li>Changed the following issues from Review to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#539">539</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#711">711</a>.</li>
105 <li>Changed the following issues from New to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#713">713</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#714">714</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#769">769</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#772">772</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#779">779</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#787">787</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#805">805</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#806">806</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#807">807</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#808">808</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#809">809</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#813">813</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#824">824</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#829">829</a>.</li>
106 <li>Changed the following issues from Open to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#180">180</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#396">396</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#522">522</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#720">720</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#762">762</a>.</li>
107 <li>Changed the following issues from Review to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#691">691</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#728">728</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#771">771</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#776">776</a>.</li>
108 <li>Changed the following issues from New to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#692">692</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#698">698</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#752">752</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#804">804</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#823">823</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#828">828</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#832">832</a>.</li>
109 <li>Changed the following issues from Open to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#23">23</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#675">675</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#734">734</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#803">803</a>.</li>
110 <li>Changed the following issues from Ready to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#758">758</a>.</li>
111 <li>Changed the following issues from Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#387">387</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#518">518</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#550">550</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#574">574</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#595">595</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#596">596</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#612">612</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#618">618</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#629">629</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#638">638</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#672">672</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#673">673</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#685">685</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#710">710</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#715">715</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#722">722</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#740">740</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#743">743</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#744">744</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#746">746</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#749">749</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#755">755</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#759">759</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#761">761</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#766">766</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#768">768</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#770">770</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#775">775</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#777">777</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#778">778</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#781">781</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#782">782</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#783">783</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#789">789</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#792">792</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#798">798</a>.</li>
112 </ul></li>
113 </ul>
114 </li>
115 <li>R56: 
116 2008-05-16 pre-Sophia Antipolis mailing.
117 <ul>
118 <li><b>Summary:</b><ul>
119 <li>191 open issues, up by 24.</li>
120 <li>647 closed issues, up by 1.</li>
121 <li>838 issues total, up by 25.</li>
122 </ul></li>
123 <li><b>Details:</b><ul>
124 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#814">814</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#815">815</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#816">816</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#817">817</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#818">818</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#819">819</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#820">820</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#821">821</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#822">822</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#823">823</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#824">824</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#825">825</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#826">826</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#827">827</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#828">828</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#829">829</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#830">830</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#831">831</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#832">832</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#833">833</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#834">834</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#835">835</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#836">836</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#837">837</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#838">838</a>.</li>
125 <li>Changed the following issues from New to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#802">802</a>.</li>
126 </ul></li>
127 </ul>
128 </li>
129 <li>R55: 
130 2008-03-14 post-Bellevue mailing.
131 <ul>
132 <li><b>Summary:</b><ul>
133 <li>167 open issues, down by 39.</li>
134 <li>646 closed issues, up by 65.</li>
135 <li>813 issues total, up by 26.</li>
136 </ul></li>
137 <li><b>Details:</b><ul>
138 <li>Added the following Dup issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#795">795</a>.</li>
139 <li>Added the following NAD issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#790">790</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#791">791</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#796">796</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#797">797</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#799">799</a>.</li>
140 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#788">788</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#794">794</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#802">802</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#804">804</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#805">805</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#806">806</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#807">807</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#808">808</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#809">809</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#810">810</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#811">811</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#812">812</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#813">813</a>.</li>
141 <li>Added the following Open issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#793">793</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#800">800</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#801">801</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#803">803</a>.</li>
142 <li>Added the following Ready issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#789">789</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#792">792</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#798">798</a>.</li>
143 <li>Changed the following issues from NAD Future to Dup: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#116">116</a>.</li>
144 <li>Changed the following issues from NAD Future to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#188">188</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#323">323</a>.</li>
145 <li>Changed the following issues from New to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#729">729</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#730">730</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#731">731</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#733">733</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#735">735</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#736">736</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#737">737</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#739">739</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#741">741</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#745">745</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#748">748</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#763">763</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#764">764</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#773">773</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#784">784</a>.</li>
146 <li>Changed the following issues from Open to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#388">388</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#462">462</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#579">579</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#627">627</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#653">653</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#686">686</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#707">707</a>.</li>
147 <li>Changed the following issues from NAD Future to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#140">140</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#390">390</a>.</li>
148 <li>Changed the following issues from Open to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#529">529</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#626">626</a>.</li>
149 <li>Changed the following issues from Review to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#645">645</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#684">684</a>.</li>
150 <li>Changed the following issues from NAD Future to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#128">128</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#180">180</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#190">190</a>.</li>
151 <li>Changed the following issues from New to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#617">617</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#718">718</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#719">719</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#720">720</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#724">724</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#732">732</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#734">734</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#742">742</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#747">747</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#750">750</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#753">753</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#756">756</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#760">760</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#762">762</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#767">767</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#774">774</a>.</li>
152 <li>Changed the following issues from Ready to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#675">675</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#676">676</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#688">688</a>.</li>
153 <li>Changed the following issues from New to Pending NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#709">709</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#717">717</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#725">725</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#738">738</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#754">754</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#757">757</a>.</li>
154 <li>Changed the following issues from Open to Pending NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#424">424</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#557">557</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#625">625</a>.</li>
155 <li>Changed the following issues from New to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#710">710</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#715">715</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#722">722</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#740">740</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#743">743</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#744">744</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#746">746</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#749">749</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#755">755</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#758">758</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#759">759</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#761">761</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#766">766</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#768">768</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#770">770</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#775">775</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#777">777</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#778">778</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#781">781</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#782">782</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#783">783</a>.</li>
156 <li>Changed the following issues from Open to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#387">387</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#471">471</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#550">550</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#612">612</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#629">629</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#673">673</a>.</li>
157 <li>Changed the following issues from Review to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#518">518</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#574">574</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#596">596</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#618">618</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#638">638</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#672">672</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#685">685</a>.</li>
158 <li>Changed the following issues from New to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#711">711</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#728">728</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#771">771</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#776">776</a>.</li>
159 <li>Changed the following issues from Open to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#539">539</a>.</li>
160 <li>Changed the following issues from Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#561">561</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#562">562</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#563">563</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#567">567</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#581">581</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#620">620</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#621">621</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#622">622</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#623">623</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#624">624</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#661">661</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#664">664</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#665">665</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#666">666</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#674">674</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#679">679</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#680">680</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#687">687</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#689">689</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#693">693</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#694">694</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#695">695</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#700">700</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#703">703</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#705">705</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#706">706</a>.</li>
161 <li>Changed the following issues from Tentatively Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#527">527</a>.</li>
162 </ul></li>
163 </ul>
164 </li>
165 <li>R54: 
166 2008-02-01 pre-Bellevue mailing.
167 <ul>
168 <li><b>Summary:</b><ul>
169 <li>206 open issues, up by 23.</li>
170 <li>581 closed issues, up by 0.</li>
171 <li>787 issues total, up by 23.</li>
172 </ul></li>
173 <li><b>Details:</b><ul>
174 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#765">765</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#766">766</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#767">767</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#768">768</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#769">769</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#770">770</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#771">771</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#772">772</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#773">773</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#774">774</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#775">775</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#776">776</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#777">777</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#778">778</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#779">779</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#780">780</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#781">781</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#782">782</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#783">783</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#784">784</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#785">785</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#786">786</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#787">787</a>.</li>
175 <li>Changed the following issues from NAD Future to Dup: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#105">105</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#348">348</a>.</li>
176 <li>Changed the following issues from NAD Future to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#353">353</a>.</li>
177 <li>Changed the following issues from New to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#697">697</a>.</li>
178 <li>Changed the following issues from NAD Future to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#388">388</a>.</li>
179 <li>Changed the following issues from Open to Tentatively Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#527">527</a>.</li>
180 </ul></li>
181 </ul>
182 </li>
183 <li>R53: 
184 2007-12-09 mid-term mailing.
185 <ul>
186 <li><b>Summary:</b><ul>
187 <li>183 open issues, up by 11.</li>
188 <li>581 closed issues, down by 1.</li>
189 <li>764 issues total, up by 10.</li>
190 </ul></li>
191 <li><b>Details:</b><ul>
192 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#755">755</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#756">756</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#757">757</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#758">758</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#759">759</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#760">760</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#761">761</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#762">762</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#763">763</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#764">764</a>.</li>
193 <li>Changed the following issues from NAD to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#463">463</a>.</li>
194 <li>Changed the following issues from Pending WP to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#607">607</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#608">608</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#654">654</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#655">655</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#677">677</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#682">682</a>.</li>
195 </ul></li>
196 </ul>
197 </li>
198 <li>R52: 
199 2007-10-19 post-Kona mailing.
200 <ul>
201 <li><b>Summary:</b><ul>
202 <li>172 open issues, up by 4.</li>
203 <li>582 closed issues, up by 27.</li>
204 <li>754 issues total, up by 31.</li>
205 </ul></li>
206 <li><b>Details:</b><ul>
207 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#724">724</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#725">725</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#726">726</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#727">727</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#728">728</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#729">729</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#730">730</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#731">731</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#732">732</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#733">733</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#734">734</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#735">735</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#736">736</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#737">737</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#738">738</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#739">739</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#740">740</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#741">741</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#742">742</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#743">743</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#744">744</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#745">745</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#746">746</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#747">747</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#748">748</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#749">749</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#750">750</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#751">751</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#752">752</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#753">753</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#754">754</a>.</li>
208 <li>Changed the following issues from NAD Future to Dup: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#77">77</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#350">350</a>.</li>
209 <li>Changed the following issues from New to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#639">639</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#657">657</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#663">663</a>.</li>
210 <li>Changed the following issues from Open to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#548">548</a>.</li>
211 <li>Changed the following issues from New to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#546">546</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#550">550</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#564">564</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#565">565</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#573">573</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#585">585</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#588">588</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#627">627</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#629">629</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#630">630</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#632">632</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#635">635</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#653">653</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#659">659</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#667">667</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#668">668</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#669">669</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#670">670</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#671">671</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#673">673</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#686">686</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#704">704</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#707">707</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#708">708</a>.</li>
212 <li>Changed the following issues from New to Pending NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#393">393</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#592">592</a>.</li>
213 <li>Changed the following issues from New to Pending WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#607">607</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#608">608</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#654">654</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#655">655</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#677">677</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#682">682</a>.</li>
214 <li>Changed the following issues from New to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#561">561</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#562">562</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#563">563</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#567">567</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#581">581</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#595">595</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#620">620</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#621">621</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#622">622</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#623">623</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#624">624</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#661">661</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#664">664</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#665">665</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#666">666</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#674">674</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#675">675</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#676">676</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#679">679</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#687">687</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#688">688</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#689">689</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#693">693</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#694">694</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#695">695</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#700">700</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#703">703</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#705">705</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#706">706</a>.</li>
215 <li>Changed the following issues from Open to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#680">680</a>.</li>
216 <li>Changed the following issues from New to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#574">574</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#596">596</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#618">618</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#638">638</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#645">645</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#672">672</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#684">684</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#685">685</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#691">691</a>.</li>
217 <li>Changed the following issues from New to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#552">552</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#634">634</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#650">650</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#651">651</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#652">652</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#678">678</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#681">681</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#699">699</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#712">712</a>.</li>
218 <li>Changed the following issues from Open to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#258">258</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#401">401</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#524">524</a>.</li>
219 <li>Changed the following issues from Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#488">488</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#577">577</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#660">660</a>.</li>
220 </ul></li>
221 </ul>
222 </li>
223 <li>R51: 
224 2007-09-09 pre-Kona mailing.
225 <ul>
226 <li><b>Summary:</b><ul>
227 <li>168 open issues, up by 15.</li>
228 <li>555 closed issues, up by 0.</li>
229 <li>723 issues total, up by 15.</li>
230 </ul></li>
231 <li><b>Details:</b><ul>
232 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#709">709</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#710">710</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#711">711</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#712">712</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#713">713</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#714">714</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#715">715</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#716">716</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#717">717</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#718">718</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#719">719</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#720">720</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#721">721</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#722">722</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#723">723</a>.</li>
233 </ul></li>
234 </ul>
235 </li>
236 <li>R50: 
237 2007-08-05 post-Toronto mailing.
238 <ul>
239 <li><b>Summary:</b><ul>
240 <li>153 open issues, down by 5.</li>
241 <li>555 closed issues, up by 17.</li>
242 <li>708 issues total, up by 12.</li>
243 </ul></li>
244 <li><b>Details:</b><ul>
245 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#697">697</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#698">698</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#699">699</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#700">700</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#701">701</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#702">702</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#703">703</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#704">704</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#705">705</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#706">706</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#707">707</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#708">708</a>.</li>
246 <li>Changed the following issues from New to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#583">583</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#584">584</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#662">662</a>.</li>
247 <li>Changed the following issues from Open to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#528">528</a>.</li>
248 <li>Changed the following issues from New to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#637">637</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#647">647</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#658">658</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#690">690</a>.</li>
249 <li>Changed the following issues from Open to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#525">525</a>.</li>
250 <li>Changed the following issues from Pending NAD Editorial to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#553">553</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#571">571</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#591">591</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#633">633</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#636">636</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#641">641</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#642">642</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#648">648</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#649">649</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#656">656</a>.</li>
251 <li>Changed the following issues from New to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#579">579</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#631">631</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#680">680</a>.</li>
252 <li>Changed the following issues from Pending WP to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#258">258</a>.</li>
253 <li>Changed the following issues from Ready to Pending WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#644">644</a>.</li>
254 <li>Changed the following issues from New to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#577">577</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#660">660</a>.</li>
255 <li>Changed the following issues from Open to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#488">488</a>.</li>
256 <li>Changed the following issues from Open to Review: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#518">518</a>.</li>
257 <li>Changed the following issues from Ready to TRDec: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#604">604</a>.</li>
258 <li>Changed the following issues from DR to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#453">453</a>.</li>
259 <li>Changed the following issues from Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#531">531</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#551">551</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#566">566</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#628">628</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#640">640</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#643">643</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#646">646</a>.</li>
260 </ul></li>
261 </ul>
262 </li>
263 <li>R49: 
264 2007-06-23 pre-Toronto mailing.
265 <ul>
266 <li><b>Summary:</b><ul>
267 <li>158 open issues, up by 13.</li>
268 <li>538 closed issues, up by 7.</li>
269 <li>696 issues total, up by 20.</li>
270 </ul></li>
271 <li><b>Details:</b><ul>
272 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#677">677</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#678">678</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#679">679</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#680">680</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#681">681</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#682">682</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#684">684</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#685">685</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#686">686</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#687">687</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#688">688</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#689">689</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#690">690</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#691">691</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#692">692</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#693">693</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#694">694</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#695">695</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#696">696</a>.</li>
273 <li>Added the following Pending NAD Editorial issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#683">683</a>.</li>
274 <li>Changed the following issues from New to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#587">587</a>.</li>
275 <li>Changed the following issues from Open to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#590">590</a>.</li>
276 <li>Changed the following issues from New to Pending NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#636">636</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#642">642</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#648">648</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#649">649</a>.</li>
277 </ul></li>
278 </ul>
279 </li>
280 <li>R48: 
281 2007-05-06 post-Oxford mailing.
282 <ul>
283 <li><b>Summary:</b><ul>
284 <li>145 open issues, down by 33.</li>
285 <li>531 closed issues, up by 53.</li>
286 <li>676 issues total, up by 20.</li>
287 </ul></li>
288 <li><b>Details:</b><ul>
289 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#657">657</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#658">658</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#659">659</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#660">660</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#661">661</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#662">662</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#663">663</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#664">664</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#665">665</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#666">666</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#667">667</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#668">668</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#669">669</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#670">670</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#671">671</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#672">672</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#673">673</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#674">674</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#675">675</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#676">676</a>.</li>
290 <li>Changed the following issues from Tentatively Ready to Dup: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#479">479</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#536">536</a>.</li>
291 <li>Changed the following issues from Tentatively Ready to NAD: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#385">385</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#463">463</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#466">466</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#470">470</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#515">515</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#526">526</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#547">547</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#560">560</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#572">572</a>.</li>
292 <li>Changed the following issues from NAD to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#351">351</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#357">357</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#368">368</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#499">499</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#504">504</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#512">512</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#513">513</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#514">514</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#516">516</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#544">544</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#549">549</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#555">555</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#558">558</a>.</li>
293 <li>Changed the following issues from Tentatively Ready to NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#482">482</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#615">615</a>.</li>
294 <li>Changed the following issues from NAD_Future to NAD Future: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#77">77</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#105">105</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#111">111</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#116">116</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#128">128</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#138">138</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#140">140</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#149">149</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#180">180</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#188">188</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#190">190</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#219">219</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#323">323</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#348">348</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#350">350</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#353">353</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#388">388</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#390">390</a>.</li>
295 <li>Changed the following issues from Tentatively Ready to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#471">471</a>.</li>
296 <li>Changed the following issues from New to Pending NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#633">633</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#641">641</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#656">656</a>.</li>
297 <li>Changed the following issues from Tentatively Ready to Pending NAD Editorial: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#532">532</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#553">553</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#571">571</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#591">591</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#594">594</a>.</li>
298 <li>Changed the following issues from Tentatively Ready to Pending WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#258">258</a>.</li>
299 <li>Changed the following issues from New to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#566">566</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#628">628</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#640">640</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#643">643</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#644">644</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#646">646</a>.</li>
300 <li>Changed the following issues from Review to Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#531">531</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#551">551</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#604">604</a>.</li>
301 <li>Changed the following issues from Ready to TRDec: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#598">598</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#599">599</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#600">600</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#601">601</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#602">602</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#603">603</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#605">605</a>.</li>
302 <li>Changed the following issues from Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#543">543</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#545">545</a>.</li>
303 <li>Changed the following issues from Tentatively Ready to WP: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#201">201</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#206">206</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#233">233</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#254">254</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#416">416</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#422">422</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#456">456</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#534">534</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#542">542</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#559">559</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#575">575</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#576">576</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#578">578</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#586">586</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#589">589</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#593">593</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#609">609</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#610">610</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#611">611</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#613">613</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#616">616</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#619">619</a>.</li>
304 </ul></li>
305 </ul>
306 </li>
307 <li>R47: 
308 2007-03-09 pre-Oxford mailing.
309 <ul>
310 <li><b>Summary:</b><ul>
311 <li>178 open issues, up by 37.</li>
312 <li>478 closed issues, up by 0.</li>
313 <li>656 issues total, up by 37.</li>
314 </ul></li>
315 <li><b>Details:</b><ul>
316 <li>Added the following New issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#620">620</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#621">621</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#622">622</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#623">623</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#624">624</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#627">627</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#628">628</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#629">629</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#630">630</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#631">631</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#632">632</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#633">633</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#634">634</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#635">635</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#636">636</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#637">637</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#638">638</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#639">639</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#640">640</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#641">641</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#642">642</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#643">643</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#644">644</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#645">645</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#646">646</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#647">647</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#648">648</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#649">649</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#650">650</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#651">651</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#652">652</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#653">653</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#654">654</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#655">655</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#656">656</a>.</li>
317 <li>Added the following Open issues: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#625">625</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#626">626</a>.</li>
318 <li>Changed the following issues from New to Open: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#570">570</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#580">580</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#582">582</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#590">590</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#612">612</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#614">614</a>.</li>
319 <li>Changed the following issues from New to Tentatively Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#547">547</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#553">553</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#560">560</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#571">571</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#572">572</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#575">575</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#576">576</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#578">578</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#586">586</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#589">589</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#591">591</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#593">593</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#594">594</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#609">609</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#610">610</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#611">611</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#613">613</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#615">615</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#616">616</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#619">619</a>.</li>
320 <li>Changed the following issues from Open to Tentatively Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#201">201</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#206">206</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#233">233</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#254">254</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#258">258</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#385">385</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#416">416</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#422">422</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#456">456</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#463">463</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#466">466</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#470">470</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#471">471</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#479">479</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#482">482</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#515">515</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#526">526</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#532">532</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#536">536</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#542">542</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#559">559</a>.</li>
321 <li>Changed the following issues from Review to Tentatively Ready: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#534">534</a>.</li>
322 </ul></li>
323 </ul>
324 </li>
325 <li>R46: 
326 2007-01-12 mid-term mailing.
327 <ul>
328 <li><b>Summary:</b><ul>
329 <li>141 open issues, up by 11.</li>
330 <li>478 closed issues, down by 1.</li>
331 <li>619 issues total, up by 10.</li>
332 </ul></li>
333 <li><b>Details:</b><ul>
334 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#610">610</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#619">619</a>.</li>
335 </ul></li>
336 </ul>
337 </li>
338 <li>R45: 
339 2006-11-03 post-Portland mailing.
340 <ul>
341 <li><b>Summary:</b><ul>
342 <li>130 open issues, up by 0.</li>
343 <li>479 closed issues, up by 17.</li>
344 <li>609 issues total, up by 17.</li>
345 </ul></li>
346 <li><b>Details:</b><ul>
347 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#520">520</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#521">521</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#530">530</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#535">535</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#537">537</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#538">538</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#540">540</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#541">541</a> to WP.</li>
348 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#504">504</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#512">512</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#516">516</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#544">544</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#549">549</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#554">554</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#555">555</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#558">558</a> to NAD.</li>
349 <li>Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#569">569</a> to Dup.</li>
350 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#518">518</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#523">523</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#524">524</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#542">542</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#556">556</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#557">557</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#559">559</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#597">597</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#606">606</a> to Open.</li>
351 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#543">543</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#545">545</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#549">549</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#549">549</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#598">598</a> - <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#603">603</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#605">605</a> to Ready.</li>
352 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#531">531</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#551">551</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#604">604</a> to Review.</li>
353 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#593">593</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#609">609</a>.</li>
354 </ul></li>
355 </ul>
356 </li>
357 <li>R44: 
358 2006-09-08 pre-Portland mailing.
359 <ul>
360 <li><b>Summary:</b><ul>
361 <li>130 open issues, up by 6.</li>
362 <li>462 closed issues, down by 1.</li>
363 <li>592 issues total, up by 5.</li>
364 </ul></li>
365 <li><b>Details:</b><ul>
366 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#583">583</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#592">592</a>.</li>
367 </ul></li>
368 </ul>
369 </li>
370 <li>R43: 
371 2006-06-23 mid-term mailing.
372 <ul>
373 <li><b>Summary:</b><ul>
374 <li>124 open issues, up by 14.</li>
375 <li>463 closed issues, down by 1.</li>
376 <li>587 issues total, up by 13.</li>
377 </ul></li>
378 <li><b>Details:</b><ul>
379 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#575">575</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#582">582</a>.</li>
380 <li>Reopened <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#255">255</a>.</li>
381 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#520">520</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#541">541</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#544">544</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#569">569</a> to Tentatively Ready.</li>
382 </ul></li>
383 </ul>
384 </li>
385 <li>R42: 
386 2006-04-21 post-Berlin mailing.
387 <ul>
388 <li><b>Summary:</b><ul>
389 <li>110 open issues, down by 16.</li>
390 <li>464 closed issues, up by 24.</li>
391 <li>574 issues total, up by 8.</li>
392 </ul></li>
393 <li><b>Details:</b><ul>
394 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#567">567</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#572">572</a>.</li>
395 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#499">499</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#501">501</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#506">506</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#509">509</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#511">511</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#513">513</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#514">514</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#517">517</a> to NAD.</li>
396 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#502">502</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#503">503</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#515">515</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#516">516</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#522">522</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#525">525</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#529">529</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#532">532</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#536">536</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#539">539</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#548">548</a> to Open.</li>
397 <li>Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#504">504</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#512">512</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#521">521</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#530">530</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#531">531</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#535">535</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#537">537</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#538">538</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#540">540</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#549">549</a> to Ready.</li>
398 <li>Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#247">247</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#294">294</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#362">362</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#369">369</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#371">371</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#376">376</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#384">384</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#475">475</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#478">478</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#495">495</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#497">497</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#505">505</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#507">507</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#508">508</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#519">519</a> to WP.</li>
399 <li>Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#534">534</a> to Review.</li>
400 </ul></li>
401 </ul>
402 </li>
403 <li>R41: 
404 2006-02-24 pre-Berlin mailing.
405 <ul>
406 <li><b>Summary:</b><ul>
407 <li>126 open issues, up by 31.</li>
408 <li>440 closed issues, up by 0.</li>
409 <li>566 issues total, up by 31.</li>
410 </ul></li>
411 <li><b>Details:</b><ul>
412 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#536">536</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#566">566</a>.</li>
413 <li>Moved <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#342">342</a> from Ready to Open.</li>
414 <li>Reopened <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#309">309</a>.</li>
415 </ul></li>
416 </ul>
417 </li>
418 <li>R40: 
419 2005-12-16 mid-term mailing.
420 <ul>
421 <li><b>Summary:</b><ul>
422 <li>95 open issues.</li>
423 <li>440 closed issues.</li>
424 <li>535 issues total.</li>
425 </ul></li>
426 <li><b>Details:</b><ul>
427 <li>Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#529">529</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#535">535</a>.</li>
428 </ul></li>
429 </ul>
430 </li>
431 <li>R39: 
432 2005-10-14 post-Mont Tremblant mailing.
433 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#526">526</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#528">528</a>.
434 Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#280">280</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#461">461</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#464">464</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#465">465</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#467">467</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#468">468</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#474">474</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#496">496</a> from Ready to WP as per the vote from Mont Tremblant.
435 Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#247">247</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#294">294</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#342">342</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#362">362</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#369">369</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#371">371</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#376">376</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#384">384</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#475">475</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#478">478</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#495">495</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#497">497</a> from Review to Ready.
436 Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#498">498</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#504">504</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#506">506</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#509">509</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#510">510</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#511">511</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#512">512</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#513">513</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#514">514</a> from New to Open.
437 Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#505">505</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#507">507</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#508">508</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#519">519</a> from New to Ready.
438 Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#500">500</a> from New to NAD.
439 Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#518">518</a> from New to Review.
440 </li>
441 <li>R38: 
442 2005-07-03 pre-Mont Tremblant mailing.
443 Merged open TR1 issues in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#504">504</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#522">522</a>.
444 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#523">523</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#523">523</a>
445 </li>
446 <li>R37: 
447 2005-06 mid-term mailing.
448 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#498">498</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#503">503</a>.
449 </li>
450 <li>R36: 
451 2005-04 post-Lillehammer mailing. All issues in "ready" status except
452 for <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#454">454</a> were moved to "DR" status, and all issues
453 previously in "DR" status were moved to "WP".
454 </li>
455 <li>R35: 
456 2005-03 pre-Lillehammer mailing.
457 </li>
458 <li>R34: 
459 2005-01 mid-term mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#488">488</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#494">494</a>.
460 </li>
461 <li>R33: 
462 2004-11 post-Redmond mailing. Reflects actions taken in Redmond.
463 </li>
464 <li>R32: 
465 2004-09 pre-Redmond mailing: reflects new proposed resolutions and
466 new issues received after the 2004-07 mailing.  Added
467 new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#479">479</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#481">481</a>.
468 </li>
469 <li>R31: 
470 2004-07 mid-term mailing: reflects new proposed resolutions and
471 new issues received after the post-Sydney mailing.  Added
472 new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#463">463</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#478">478</a>.
473 </li>
474 <li>R30: 
475 Post-Sydney mailing: reflects decisions made at the Sydney meeting.
476 Voted all "Ready" issues from R29 into the working paper.
477 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#460">460</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#462">462</a>.
478 </li>
479 <li>R29: 
480 Pre-Sydney mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#441">441</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#457">457</a>.
481 </li>
482 <li>R28: 
483 Post-Kona mailing: reflects decisions made at the Kona meeting.
484 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#432">432</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#440">440</a>.
485 </li>
486 <li>R27: 
487 Pre-Kona mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#404">404</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#431">431</a>.
488 </li>
489 <li>R26: 
490 Post-Oxford mailing: reflects decisions made at the Oxford meeting.
491 All issues in Ready status were voted into DR status.  All issues in
492 DR status were voted into WP status.
493 </li>
494 <li>R25: 
495 Pre-Oxford mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#390">390</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#402">402</a>.
496 </li>
497 <li>R24: 
498 Post-Santa Cruz mailing: reflects decisions made at the Santa Cruz
499 meeting.  All Ready issues from R23 with the exception of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#253">253</a>, which has been given a new proposed resolution, were
500 moved to DR status.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#383">383</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#389">389</a>.  (Issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#387">387</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#389">389</a> were discussed
501 at the meeting.)  Made progress on issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#225">225</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#226">226</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#229">229</a>: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#225">225</a> and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#229">229</a> have been moved to Ready status, and the only remaining
502 concerns with <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#226">226</a> involve wording.
503 </li>
504 <li>R23: 
505 Pre-Santa Cruz mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#367">367</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#382">382</a>.
506 Moved issues in the TC to TC status.
507 </li>
508 <li>R22: 
509 Post-Curaçao mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#362">362</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#366">366</a>.
510 </li>
511 <li>R21: 
512 Pre-Curaçao mailing.  Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#351">351</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#361">361</a>.
513 </li>
514 <li>R20: 
515 Post-Redmond mailing; reflects actions taken in Redmond.  Added
516 new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#336">336</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#350">350</a>, of which issues 
517 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#347">347</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#350">350</a> were added since Redmond, hence
518 not discussed at the meeting.  
519
520 All Ready issues were moved to DR status, with the exception of issues
521 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#284">284</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#241">241</a>, and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#267">267</a>.
522
523 Noteworthy issues discussed at Redmond include 
524 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#120">120</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#202">202</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#226">226</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#233">233</a>, 
525 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#270">270</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#253">253</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#254">254</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#323">323</a>.
526 </li>
527 <li>R19: 
528 Pre-Redmond mailing.  Added new issues 
529 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#323">323</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#335">335</a>.
530 </li>
531 <li>R18: 
532 Post-Copenhagen mailing; reflects actions taken in Copenhagen.
533 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#312">312</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#317">317</a>, and discussed
534 new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#271">271</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#314">314</a>.
535
536 Changed status of issues
537 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#103">103</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#118">118</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#136">136</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#153">153</a>
538 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#165">165</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#171">171</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#183">183</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#184">184</a>
539 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#185">185</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#186">186</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#214">214</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#221">221</a>
540 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#234">234</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#237">237</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#243">243</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#248">248</a>
541 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#251">251</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#252">252</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#256">256</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#260">260</a>
542 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#261">261</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#262">262</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#263">263</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#265">265</a>
543 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#268">268</a>
544 to DR.
545
546 Changed status of issues
547 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#49">49</a>  <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#109">109</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#117">117</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#182">182</a>
548 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#228">228</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#230">230</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#232">232</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#235">235</a>
549 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#238">238</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#241">241</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#242">242</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#250">250</a>
550 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#259">259</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#264">264</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#266">266</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#267">267</a>
551 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#271">271</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#272">272</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#273">273</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#275">275</a>
552 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#281">281</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#284">284</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#285">285</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#286">286</a>
553 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#288">288</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#292">292</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#295">295</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#297">297</a>
554 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#298">298</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#301">301</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#303">303</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#306">306</a>
555 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#307">307</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#308">308</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#312">312</a>
556 to Ready.
557
558 Closed issues 
559 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#111">111</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#277">277</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#279">279</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#287">287</a>
560 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#289">289</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#293">293</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#302">302</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#313">313</a>
561 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#314">314</a>
562 as NAD.
563
564 </li>
565 <li>R17: 
566 Pre-Copenhagen mailing.  Converted issues list to XML.  Added proposed
567 resolutions for issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#49">49</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#76">76</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#91">91</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#235">235</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#250">250</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#267">267</a>.
568 Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#278">278</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#311">311</a>.
569 </li>
570 <li>R16:  
571 post-Toronto mailing; reflects actions taken in Toronto. Added new
572 issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#265">265</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#277">277</a>.  Changed status of issues
573 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#3">3</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#8">8</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#9">9</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#19">19</a>,
574 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#26">26</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#31">31</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#61">61</a>,
575 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#63">63</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#86">86</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#108">108</a>,
576 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#112">112</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#114">114</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#115">115</a>,
577 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#122">122</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#127">127</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#129">129</a>,
578 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#134">134</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#137">137</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#142">142</a>,
579 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#144">144</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#146">146</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#147">147</a>,
580 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#159">159</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#164">164</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#170">170</a>,
581 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#181">181</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#199">199</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#208">208</a>,
582 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#209">209</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#210">210</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#211">211</a>,
583 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#212">212</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#217">217</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#220">220</a>,
584 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#222">222</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#223">223</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#224">224</a>,
585 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#227">227</a> to "DR".  Reopened issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#23">23</a>. Reopened
586 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#187">187</a>. Changed issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#2">2</a> and
587 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#4">4</a> to NAD. Fixed a typo in issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#17">17</a>. Fixed
588 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#70">70</a>: signature should be changed both places it
589 appears. Fixed issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#160">160</a>: previous version didn't fix
590 the bug in enough places.
591 </li>
592 <li>R15: 
593 pre-Toronto mailing. Added issues
594 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#233">233</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#264">264</a>. Some small HTML formatting
595 changes so that we pass Weblint tests.
596 </li>
597 <li>R14: 
598 post-Tokyo II mailing; reflects committee actions taken in
599 Tokyo. Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#228">228</a> to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#232">232</a>. (00-0019R1/N1242)
600 </li>
601 <li>R13: 
602 pre-Tokyo II updated: Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#212">212</a> to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#227">227</a>.
603 </li>
604 <li>R12: 
605 pre-Tokyo II mailing: Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#199">199</a> to
606 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#211">211</a>. Added "and paragraph 5" to the proposed resolution
607 of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#29">29</a>.  Add further rationale to issue
608 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#178">178</a>.
609 </li>
610 <li>R11: 
611 post-Kona mailing: Updated to reflect LWG and full committee actions
612 in Kona (99-0048/N1224). Note changed resolution of issues
613 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#4">4</a> and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#38">38</a>. Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#196">196</a>
614 to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198">198</a>. Closed issues list split into "defects" and
615 "closed" documents.  Changed the proposed resolution of issue
616 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#4">4</a> to NAD, and changed the wording of proposed resolution
617 of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#38">38</a>.
618 </li>
619 <li>R10: 
620 pre-Kona updated.  Added proposed resolutions <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#83">83</a>,
621 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#86">86</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#91">91</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#92">92</a>,
622 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#109">109</a>. Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#190">190</a> to
623 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#195">195</a>. (99-0033/D1209, 14 Oct 99)
624 </li>
625 <li>R9: 
626 pre-Kona mailing.  Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#140">140</a> to
627 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#189">189</a>. Issues list split into separate "active" and
628 "closed" documents. (99-0030/N1206, 25 Aug 99)
629 </li>
630 <li>R8: 
631 post-Dublin mailing. Updated to reflect LWG and full committee actions
632 in Dublin. (99-0016/N1193, 21 Apr 99)
633 </li>
634 <li>R7: 
635 pre-Dublin updated: Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#130">130</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#131">131</a>,
636 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#132">132</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#133">133</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#134">134</a>,
637 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#135">135</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#136">136</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#137">137</a>,
638 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#138">138</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#139">139</a> (31 Mar 99)
639 </li>
640 <li>R6: 
641 pre-Dublin mailing. Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#127">127</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#128">128</a>,
642 and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#129">129</a>.  (99-0007/N1194, 22 Feb 99)
643 </li>
644 <li>R5: 
645 update issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#103">103</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#112">112</a>; added issues
646 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#114">114</a> to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#126">126</a>. Format revisions to prepare
647 for making list public. (30 Dec 98)
648 </li>
649 <li>R4: 
650 post-Santa Cruz II updated: Issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#110">110</a>,
651 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#111">111</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#112">112</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#113">113</a> added, several
652 issues corrected. (22 Oct 98)
653 </li>
654 <li>R3: 
655 post-Santa Cruz II: Issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#94">94</a> to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#109">109</a>
656 added, many issues updated to reflect LWG consensus (12 Oct 98)
657 </li>
658 <li>R2: 
659 pre-Santa Cruz II: Issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#73">73</a> to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#93">93</a> added,
660 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#17">17</a> updated. (29 Sep 98)
661 </li>
662 <li>R1: 
663 Correction to issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#55">55</a> resolution, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#60">60</a> code
664 format, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#64">64</a> title. (17 Sep 98)
665 </li>
666 </ul>
667
668 <h2>Defect Reports</h2>
669 <hr>
670 <h3><a name="1"></a>1. C library linkage editing oversight</h3>
671 <p><b>Section:</b> 17.4.2.2 [using.linkage] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
672  <b>Submitter:</b> Beman Dawes <b>Date:</b> 1997-11-16</p>
673 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
674 <p><b>Discussion:</b></p>
675 <p>The change specified in the proposed resolution below did not make
676 it into the Standard. This change was accepted in principle at the
677 London meeting, and the exact wording below was accepted at the
678 Morristown meeting.</p>
679
680
681 <p><b>Proposed resolution:</b></p>
682 <p>Change 17.4.2.2 [using.linkage] paragraph 2
683 from:</p>
684
685 <blockquote>
686   <p>It is unspecified whether a name from the Standard C library
687   declared with external linkage has either extern "C" or
688   extern "C++" linkage.</p>
689 </blockquote>
690
691 <p>to:</p>
692
693 <blockquote>
694   <p>Whether a name from the Standard C library declared with external
695   linkage has extern "C" or extern "C++" linkage
696   is implementation defined. It is recommended that an implementation
697   use extern "C++" linkage for this purpose.</p>
698 </blockquote>
699
700
701
702
703
704 <hr>
705 <h3><a name="3"></a>3. Atexit registration during atexit() call is not described</h3>
706 <p><b>Section:</b> 18.4 [support.start.term] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
707  <b>Submitter:</b> Steve Clamage <b>Date:</b> 1997-12-12</p>
708 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
709 <p><b>Discussion:</b></p>
710 <p>We appear not to have covered all the possibilities of
711  exit processing with respect to
712 atexit registration. <br>
713 <br>
714 Example 1: (C and C++)</p>
715
716 <pre>    #include &lt;stdlib.h&gt;
717     void f1() { }
718     void f2() { atexit(f1); }
719     
720     int main()
721     {
722         atexit(f2); // the only use of f2
723         return 0; // for C compatibility
724     }</pre>
725
726 <p>At program exit, f2 gets called due to its registration in
727 main. Running f2 causes f1 to be newly registered during the exit
728 processing. Is this a valid program? If so, what are its
729 semantics?</p>
730
731 <p>
732 Interestingly, neither the C standard, nor the C++ draft standard nor
733 the forthcoming C9X Committee Draft says directly whether you can
734 register a function with atexit during exit processing.</p>
735
736 <p>
737 All 3 standards say that functions are run in reverse order of their
738 registration. Since f1 is registered last, it ought to be run first,
739 but by the time it is registered, it is too late to be first.</p>
740
741 <p>If the program is valid, the standards are self-contradictory about
742 its semantics.</p>
743
744 <p>Example 2: (C++ only)</p>
745
746 <pre>    
747     void F() { static T t; } // type T has a destructor
748
749     int main()
750     {
751         atexit(F); // the only use of F
752     }
753 </pre>
754
755 <p>Function F registered with atexit has a local static variable t,
756 and F is called for the first time during exit processing. A local
757 static object is initialized the first time control flow passes
758 through its definition, and all static objects are destroyed during
759 exit processing. Is the code valid? If so, what are its semantics?</p>
760
761 <p>
762 Section 18.3 "Start and termination" says that if a function
763 F is registered with atexit before a static object t is initialized, F
764 will not be called until after t's destructor completes.</p>
765
766 <p>
767 In example 2, function F is registered with atexit before its local
768 static object O could possibly be initialized. On that basis, it must
769 not be called by exit processing until after O's destructor
770 completes. But the destructor cannot be run until after F is called,
771 since otherwise the object could not be constructed in the first
772 place.</p>
773
774 <p>If the program is valid, the standard is self-contradictory about
775 its semantics.</p>
776
777 <p>I plan to submit Example 1 as a public comment on the C9X CD, with
778 a recommendation that the results be undefined. (Alternative: make it
779 unspecified. I don't think it is worthwhile to specify the case where
780 f1 itself registers additional functions, each of which registers
781 still more functions.)</p>
782
783 <p>I think we should resolve the situation in the whatever way the C
784 committee decides. </p>
785
786 <p>For Example 2, I recommend we declare the results undefined.</p>
787
788 <p><i>[See reflector message lib-6500 for further discussion.]</i></p>
789
790
791
792
793 <p><b>Proposed resolution:</b></p>
794 <p>Change section 18.3/8 from:</p>
795 <blockquote><p>
796   First, objects with static storage duration are destroyed and
797   functions registered by calling atexit are called. Objects with
798   static storage duration are destroyed in the reverse order of the
799   completion of their constructor.  (Automatic objects are not
800   destroyed as a result of calling exit().) Functions registered with
801   atexit are called in the reverse order of their registration.  A
802   function registered with atexit before an object obj1 of static
803   storage duration is initialized will not be called until obj1's
804   destruction has completed. A function registered with atexit after
805   an object obj2 of static storage duration is initialized will be
806   called before obj2's destruction starts.
807 </p></blockquote>
808 <p>to:</p>
809 <blockquote><p>
810   First, objects with static storage duration are destroyed and
811   functions registered by calling atexit are called. Non-local objects
812   with static storage duration are destroyed in the reverse order of
813   the completion of their constructor. (Automatic objects are not
814   destroyed as a result of calling exit().) Functions registered with
815   atexit are called in the reverse order of their registration, except
816   that a function is called after any previously registered functions
817   that had already been called at the time it was registered. A
818   function registered with atexit before a non-local object obj1 of
819   static storage duration is initialized will not be called until
820   obj1's destruction has completed. A function registered with atexit
821   after a non-local object obj2 of static storage duration is
822   initialized will be called before obj2's destruction starts. A local
823   static object obj3 is destroyed at the same time it would be if a
824   function calling the obj3 destructor were registered with atexit at
825   the completion of the obj3 constructor.
826 </p></blockquote>
827
828
829 <p><b>Rationale:</b></p>
830 <p>See 99-0039/N1215, October 22, 1999, by Stephen D. Clamage for the analysis
831 supporting to the proposed resolution.</p>
832
833
834
835
836
837 <hr>
838 <h3><a name="5"></a>5. String::compare specification questionable</h3>
839 <p><b>Section:</b> 21.3.6.8 [string::swap] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
840  <b>Submitter:</b> Jack Reeves <b>Date:</b> 1997-12-11</p>
841 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string::swap">issues</a> in [string::swap].</p>
842 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
843 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#87">87</a></p>
844 <p><b>Discussion:</b></p>
845 <p>At the very end of the basic_string class definition is the signature: int
846 compare(size_type pos1, size_type n1, const charT* s, size_type n2 = npos) const; In the
847 following text this is defined as: returns
848 basic_string&lt;charT,traits,Allocator&gt;(*this,pos1,n1).compare(
849 basic_string&lt;charT,traits,Allocator&gt;(s,n2); </p>
850
851 <p>Since the constructor basic_string(const charT* s, size_type n, const Allocator&amp; a
852 = Allocator()) clearly requires that s != NULL and n &lt; npos and further states that it
853 throws length_error if n == npos, it appears the compare() signature above should always
854 throw length error if invoked like so: str.compare(1, str.size()-1, s); where 's' is some
855 null terminated character array. </p>
856
857 <p>This appears to be a typo since the obvious intent is to allow either the call above or
858 something like: str.compare(1, str.size()-1, s, strlen(s)-1); </p>
859
860 <p>This would imply that what was really intended was two signatures int compare(size_type
861 pos1, size_type n1, const charT* s) const int compare(size_type pos1, size_type n1, const
862 charT* s, size_type n2) const; each defined in terms of the corresponding constructor. </p>
863
864
865 <p><b>Proposed resolution:</b></p>
866 <p>Replace the compare signature in 21.3 [basic.string]
867 (at the very end of the basic_string synopsis) which reads:</p>
868
869 <blockquote>
870   <p><tt>int compare(size_type pos1, size_type n1,<br>
871   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const charT* s,
872   size_type n2 = npos) const;</tt></p>
873 </blockquote>
874
875 <p>with:</p>
876
877 <blockquote>
878   <p><tt>int compare(size_type pos1, size_type n1,<br>
879   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const charT* s) const;<br>
880   int compare(size_type pos1, size_type n1,<br>
881   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const charT* s,
882   size_type n2) const;</tt></p>
883 </blockquote>
884
885 <p>Replace the portion of 21.3.6.8 [string::swap]
886 paragraphs 5 and 6 which read:</p>
887
888 <blockquote>
889   <p><tt>int compare(size_type pos, size_type n1,<br>
890   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; charT * s, size_type n2
891   = npos) const;<br>
892   </tt>Returns:<tt><br>
893   basic_string&lt;charT,traits,Allocator&gt;(*this, pos, n1).compare(<br>
894   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
895   basic_string&lt;charT,traits,Allocator&gt;( s, n2))</tt></p>
896 </blockquote>
897
898 <p>with:</p>
899
900 <blockquote>
901   <p><tt>int compare(size_type pos, size_type n1,<br>
902   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const charT * s) const;<br>
903   </tt>Returns:<tt><br>
904   basic_string&lt;charT,traits,Allocator&gt;(*this, pos, n1).compare(<br>
905   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
906   basic_string&lt;charT,traits,Allocator&gt;( s ))<br>
907   <br>
908   int compare(size_type pos, size_type n1,<br>
909   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const charT * s,
910   size_type n2) const;<br>
911   </tt>Returns:<tt><br>
912   basic_string&lt;charT,traits,Allocator&gt;(*this, pos, n1).compare(<br>
913   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
914   basic_string&lt;charT,traits,Allocator&gt;( s, n2))</tt></p>
915 </blockquote>
916
917 <p>Editors please note that in addition to splitting the signature, the third argument
918 becomes const, matching the existing synopsis.</p>
919
920
921 <p><b>Rationale:</b></p>
922 <p>While the LWG dislikes adding signatures, this is a clear defect in
923 the Standard which must be fixed.&nbsp; The same problem was also
924 identified in issues 7 (item 5) and 87.</p>
925
926
927
928
929
930 <hr>
931 <h3><a name="7"></a>7. String clause minor problems</h3>
932 <p><b>Section:</b> 21 [strings] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
933  <b>Submitter:</b> Matt Austern <b>Date:</b> 1997-12-15</p>
934 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#strings">issues</a> in [strings].</p>
935 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
936 <p><b>Discussion:</b></p>
937 <p>(1) In 21.3.6.4 [string::insert], the description of template
938 &lt;class InputIterator&gt; insert(iterator, InputIterator,
939 InputIterator) makes no sense. It refers to a member function that
940 doesn't exist. It also talks about the return value of a void
941 function. </p>
942
943 <p>(2) Several versions of basic_string::replace don't appear in the
944 class synopsis. </p>
945
946 <p>(3) basic_string::push_back appears in the synopsis, but is never
947 described elsewhere.  In the synopsis its argument is const charT,
948 which doesn't makes much sense; it should probably be charT, or
949 possible const charT&amp;. </p>
950
951 <p>(4) basic_string::pop_back is missing. </p>
952
953 <p>(5) int compare(size_type pos, size_type n1, charT* s, size_type n2
954 = npos) make no sense. First, it's const charT* in the synopsis and
955 charT* in the description. Second, given what it says in RETURNS,
956 leaving out the final argument will always result in an exception
957 getting thrown. This is paragraphs 5 and 6 of 
958 21.3.6.8 [string::swap]</p>
959
960 <p>(6) In table 37, in section 21.1.1 [char.traits.require],
961 there's a note for X::move(s, p, n). It says "Copies correctly
962 even where p is in [s, s+n)". This is correct as far as it goes,
963 but it doesn't go far enough; it should also guarantee that the copy
964 is correct even where s in in [p, p+n). These are two orthogonal
965 guarantees, and neither one follows from the other. Both guarantees
966 are necessary if X::move is supposed to have the same sort of
967 semantics as memmove (which was clearly the intent), and both
968 guarantees are necessary if X::move is actually supposed to be
969 useful. </p>
970
971
972 <p><b>Proposed resolution:</b></p>
973 <p>ITEM 1: In 21.3.5.4 [lib.string::insert], change paragraph 16 to <br>
974 <br>
975 &nbsp;&nbsp;&nbsp; EFFECTS: Equivalent to insert(p - begin(), basic_string(first, last)).<br>
976 <br>
977 ITEM 2:&nbsp; Not a defect; the Standard is clear.. There are ten versions of replace() in
978 the synopsis, and ten versions in 21.3.5.6 [lib.string::replace].<br>
979 <br>
980 ITEM 3: Change the declaration of push_back in the string synopsis (21.3,
981 [lib.basic.string]) from:</p>
982
983 <p>&nbsp;&nbsp;&nbsp;&nbsp; void push_back(const charT)<br>
984 <br>
985 to<br>
986 <br>
987 &nbsp;&nbsp;&nbsp;&nbsp; void push_back(charT)<br>
988 <br>
989 Add the following text immediately after 21.3.5.2 [lib.string::append], paragraph 10.<br>
990 <br>
991 &nbsp;&nbsp;&nbsp; void basic_string::push_back(charT c);<br>
992 &nbsp;&nbsp;&nbsp; EFFECTS: Equivalent to append(static_cast&lt;size_type&gt;(1), c);<br>
993 <br>
994 ITEM 4: Not a defect. The omission appears to have been deliberate.<br>
995 <br>
996 ITEM 5: Duplicate; see issue 5 (and 87).<br>
997 <br>
998 ITEM 6: In table 37, Replace:<br>
999 <br>
1000 &nbsp;&nbsp;&nbsp; "Copies correctly even where p is in [s, s+n)."<br>
1001 <br>
1002 with:<br>
1003 <br>
1004 &nbsp;&nbsp;&nbsp;&nbsp; "Copies correctly even where the ranges [p, p+n) and [s,
1005 s+n) overlap."</p>
1006
1007
1008
1009
1010
1011 <hr>
1012 <h3><a name="8"></a>8. Locale::global lacks guarantee</h3>
1013 <p><b>Section:</b> 22.1.1.5 [locale.statics] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1014  <b>Submitter:</b> Matt Austern <b>Date:</b> 1997-12-24</p>
1015 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1016 <p><b>Discussion:</b></p>
1017 <p>It appears there's an important guarantee missing from clause
1018 22. We're told that invoking locale::global(L) sets the C locale if L
1019 has a name. However, we're not told whether or not invoking
1020 setlocale(s) sets the global C++ locale. </p>
1021
1022 <p>The intent, I think, is that it should not, but I can't find any
1023 such words anywhere. </p>
1024
1025
1026 <p><b>Proposed resolution:</b></p>
1027 <p>Add a sentence at the end of 22.1.1.5 [locale.statics],
1028 paragraph 2:&nbsp; </p>
1029
1030 <blockquote>
1031   <p>No library function other than <tt>locale::global()</tt> shall affect 
1032   the value returned by <tt>locale()</tt>. </p>
1033
1034 </blockquote>
1035
1036
1037
1038
1039
1040 <hr>
1041 <h3><a name="9"></a>9. Operator new(0) calls should not yield the same pointer</h3>
1042 <p><b>Section:</b> 18.5.1 [new.delete] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1043  <b>Submitter:</b> Steve Clamage <b>Date:</b> 1998-01-04</p>
1044 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1045 <p><b>Discussion:</b></p>
1046 <p>Scott Meyers, in a comp.std.c++ posting: I just noticed that
1047 section 3.7.3.1 of CD2 seems to allow for the possibility that all
1048 calls to operator new(0) yield the same pointer, an implementation
1049 technique specifically prohibited by ARM 5.3.3.Was this prohibition
1050 really lifted? Does the FDIS agree with CD2 in the regard? [Issues
1051 list maintainer's note: the IS is the same.]</p>
1052
1053
1054 <p><b>Proposed resolution:</b></p>
1055 <p>Change the last paragraph of 3.7.3 from:</p>
1056 <blockquote>
1057   <p>Any allocation and/or deallocation functions defined in a C++ program shall
1058   conform to the semantics specified in 3.7.3.1 and 3.7.3.2.</p>
1059 </blockquote>
1060 <p>to:</p>
1061 <blockquote>
1062   <p>Any allocation and/or deallocation functions defined in a C++ program,
1063   including the default versions in the library, shall conform to the semantics
1064   specified in 3.7.3.1 and 3.7.3.2.</p>
1065 </blockquote>
1066 <p>Change 3.7.3.1/2, next-to-last sentence, from :</p>
1067 <blockquote>
1068   <p>If the size of the space requested is zero, the value returned shall not be
1069   a null pointer value (4.10).</p>
1070 </blockquote>
1071 <p>to:</p>
1072 <blockquote>
1073   <p>Even if the size of the space requested is zero, the request can fail. If
1074   the request succeeds, the value returned shall be a non-null pointer value
1075   (4.10) p0 different from any previously returned value p1, unless that value
1076   p1 was since passed to an operator delete.</p>
1077 </blockquote>
1078 <p>5.3.4/7 currently reads:</p>
1079 <blockquote>
1080   <p>When the value of the expression in a direct-new-declarator is zero, the
1081   allocation function is called to allocate an array with no elements. The
1082   pointer returned by the new-expression is non-null. [Note: If the library
1083   allocation function is called, the pointer returned is distinct from the
1084   pointer to any other object.]</p>
1085 </blockquote>
1086 <p>Retain the first sentence, and delete the remainder.</p>
1087 <p>18.5.1 currently has no text. Add the following:</p>
1088 <blockquote>
1089   <p>Except where otherwise specified, the provisions of 3.7.3 apply to the
1090   library versions of operator new and operator delete.</p>
1091 </blockquote>
1092 <p>To 18.5.1.3, add the following text:</p>
1093 <blockquote>
1094   <p>The provisions of 3.7.3 do not apply to these reserved placement forms of
1095   operator new and operator delete.</p>
1096 </blockquote>
1097
1098
1099 <p><b>Rationale:</b></p>
1100 <p>See 99-0040/N1216, October 22, 1999, by Stephen D. Clamage for the analysis
1101 supporting to the proposed resolution.</p>
1102
1103
1104
1105
1106
1107 <hr>
1108 <h3><a name="11"></a>11. Bitset minor problems</h3>
1109 <p><b>Section:</b> 23.3.5 [template.bitset] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1110  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-01-22</p>
1111 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#template.bitset">issues</a> in [template.bitset].</p>
1112 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1113 <p><b>Discussion:</b></p>
1114 <p>(1) bitset&lt;&gt;::operator[] is mentioned in the class synopsis (23.3.5), but it is
1115 not documented in 23.3.5.2. </p>
1116
1117 <p>(2) The class synopsis only gives a single signature for bitset&lt;&gt;::operator[],
1118 reference operator[](size_t pos). This doesn't make much sense. It ought to be overloaded
1119 on const. reference operator[](size_t pos); bool operator[](size_t pos) const. </p>
1120
1121 <p>(3) Bitset's stream input function (23.3.5.3) ought to skip all whitespace before
1122 trying to extract 0s and 1s. The standard doesn't explicitly say that, though. This should
1123 go in the Effects clause.</p>
1124
1125
1126 <p><b>Proposed resolution:</b></p>
1127 <p>ITEMS 1 AND 2:<br>
1128 <br>
1129 In the bitset synopsis (23.3.5 [template.bitset]), 
1130 replace the member function <br>
1131 <br>
1132 <tt>&nbsp;&nbsp;&nbsp; reference operator[](size_t pos);<br>
1133 </tt><br>
1134 with the two member functions<br>
1135 <br>
1136 <tt>&nbsp;&nbsp;&nbsp; bool operator[](size_t pos) const; <br>
1137 &nbsp;&nbsp;&nbsp; reference operator[](size_t pos); <br>
1138 </tt><br>
1139 Add the following text at the end of 23.3.5.2 [bitset.members], 
1140 immediately after paragraph 45:</p>
1141
1142 <blockquote>
1143   <p><tt>bool operator[](size_t pos) const;</tt><br>
1144   Requires: pos is valid<br>
1145   Throws: nothing<br>
1146   Returns: <tt>test(pos)</tt><br>
1147   <br>
1148   <tt>bitset&lt;N&gt;::reference operator[](size_t pos);</tt> <br>
1149   Requires: pos is valid<br>
1150   Throws: nothing<br>
1151   Returns: An object of type <tt>bitset&lt;N&gt;::reference</tt> such that <tt>(*this)[pos]
1152   == this-&gt;test(pos)</tt>, and such that <tt>(*this)[pos] = val</tt> is equivalent to <tt>this-&gt;set(pos,
1153   val);</tt></p>
1154 </blockquote>
1155
1156
1157 <p><b>Rationale:</b></p>
1158 <p>The LWG believes Item 3 is not a defect. "Formatted
1159 input" implies the desired semantics. See 27.6.1.2 [istream.formatted].
1160 </p>
1161
1162
1163
1164
1165
1166 <hr>
1167 <h3><a name="13"></a>13. Eos refuses to die</h3>
1168 <p><b>Section:</b> 27.6.1.2.3 [istream::extractors] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1169  <b>Submitter:</b> William M. Miller <b>Date:</b> 1998-03-03</p>
1170 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream::extractors">issues</a> in [istream::extractors].</p>
1171 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1172 <p><b>Discussion:</b></p>
1173 <p>In 27.6.1.2.3, there is a reference to "eos", which is
1174 the only one in the whole draft (at least using Acrobat search), so
1175 it's undefined. </p>
1176
1177
1178 <p><b>Proposed resolution:</b></p>
1179 <p>In 27.6.1.2.3 [istream::extractors], replace "eos" with
1180 "charT()"</p>
1181
1182
1183
1184
1185
1186 <hr>
1187 <h3><a name="14"></a>14. Locale::combine should be const</h3>
1188 <p><b>Section:</b> 22.1.1.3 [locale.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1189  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1190 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.members">issues</a> in [locale.members].</p>
1191 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1192 <p><b>Discussion:</b></p>
1193 <p>locale::combine is the only member function of locale (other than constructors and
1194 destructor) that is not const. There is no reason for it not to be const, and good reasons
1195 why it should have been const. Furthermore, leaving it non-const conflicts with 22.1.1
1196 paragraph 6: "An instance of a locale is immutable." </p>
1197
1198 <p>History: this member function originally was a constructor. it happened that the
1199 interface it specified had no corresponding language syntax, so it was changed to a member
1200 function. As constructors are never const, there was no "const" in the interface
1201 which was transformed into member "combine". It should have been added at that
1202 time, but the omission was not noticed. </p>
1203
1204
1205 <p><b>Proposed resolution:</b></p>
1206 <p>In 22.1.1 [locale] and also in 22.1.1.3 [locale.members], add 
1207 "const" to the declaration of member combine: </p>
1208 <blockquote>
1209   <pre>template &lt;class Facet&gt; locale combine(const locale&amp; other) const; </pre>
1210 </blockquote>
1211
1212
1213
1214
1215
1216 <hr>
1217 <h3><a name="15"></a>15. Locale::name requirement inconsistent</h3>
1218 <p><b>Section:</b> 22.1.1.3 [locale.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1219  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1220 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.members">issues</a> in [locale.members].</p>
1221 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1222 <p><b>Discussion:</b></p>
1223 <p>locale::name() is described as returning a string that can be passed to a locale
1224 constructor, but there is no matching constructor. </p>
1225
1226
1227 <p><b>Proposed resolution:</b></p>
1228 <p>In 22.1.1.3 [locale.members], paragraph 5, replace
1229 "<tt>locale(name())</tt>" with
1230 "<tt>locale(name().c_str())</tt>".
1231 </p>
1232
1233
1234
1235
1236
1237 <hr>
1238 <h3><a name="16"></a>16. Bad ctype_byname&lt;char&gt; decl</h3>
1239 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1240  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1241 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
1242 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1243 <p><b>Discussion:</b></p>
1244 <p>The new virtual members ctype_byname&lt;char&gt;::do_widen and do_narrow did not get
1245 edited in properly. Instead, the member do_widen appears four times, with wrong argument
1246 lists. </p>
1247
1248
1249 <p><b>Proposed resolution:</b></p>
1250 <p>The correct declarations for the overloaded members
1251 <tt>do_narrow</tt> and <tt>do_widen</tt> should be copied 
1252 from 22.2.1.3 [facet.ctype.special].</p>
1253
1254
1255
1256
1257
1258 <hr>
1259 <h3><a name="17"></a>17. Bad bool parsing</h3>
1260 <p><b>Section:</b> 22.2.2.1.2 [facet.num.get.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1261  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1262 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#facet.num.get.virtuals">active issues</a> in [facet.num.get.virtuals].</p>
1263 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.virtuals">issues</a> in [facet.num.get.virtuals].</p>
1264 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1265 <p><b>Discussion:</b></p>
1266 <p>This section describes the process of parsing a text boolean value from the input
1267 stream. It does not say it recognizes either of the sequences "true" or
1268 "false" and returns the corresponding bool value; instead, it says it recognizes
1269 only one of those sequences, and chooses which according to the received value of a
1270 reference argument intended for returning the result, and reports an error if the other
1271 sequence is found. (!) Furthermore, it claims to get the names from the ctype&lt;&gt;
1272 facet rather than the numpunct&lt;&gt; facet, and it examines the "boolalpha"
1273 flag wrongly; it doesn't define the value "loc"; and finally, it computes
1274 wrongly whether to use numeric or "alpha" parsing.<br>
1275 <br>
1276 I believe the correct algorithm is "as if": </p>
1277
1278 <pre>  // in, err, val, and str are arguments.
1279   err = 0;
1280   const numpunct&lt;charT&gt;&amp; np = use_facet&lt;numpunct&lt;charT&gt; &gt;(str.getloc());
1281   const string_type t = np.truename(), f = np.falsename();
1282   bool tm = true, fm = true;
1283   size_t pos = 0;
1284   while (tm &amp;&amp; pos &lt; t.size() || fm &amp;&amp; pos &lt; f.size()) {
1285     if (in == end) { err = str.eofbit; }
1286     bool matched = false;
1287     if (tm &amp;&amp; pos &lt; t.size()) {
1288       if (!err &amp;&amp; t[pos] == *in) matched = true;
1289       else tm = false;
1290     }
1291     if (fm &amp;&amp; pos &lt; f.size()) {
1292       if (!err &amp;&amp; f[pos] == *in) matched = true;
1293       else fm = false;
1294     }
1295     if (matched) { ++in; ++pos; }
1296     if (pos &gt; t.size()) tm = false;
1297     if (pos &gt; f.size()) fm = false;
1298   }
1299   if (tm == fm || pos == 0) { err |= str.failbit; }
1300   else                      { val = tm; }
1301   return in;</pre>
1302
1303 <p>Notice this works reasonably when the candidate strings are both empty, or equal, or
1304 when one is a substring of the other. The proposed text below captures the logic of the
1305 code above.</p>
1306
1307
1308 <p><b>Proposed resolution:</b></p>
1309 <p>In 22.2.2.1.2 [facet.num.get.virtuals], in the first line of paragraph 14,
1310 change "&amp;&amp;" to "&amp;".</p>
1311
1312 <p>Then, replace paragraphs 15 and 16 as follows:</p>
1313
1314 <blockquote>
1315
1316   <p>Otherwise target sequences are determined "as if" by
1317   calling the members <tt>falsename()</tt> and
1318   <tt>truename()</tt> of the facet obtained by
1319   <tt>use_facet&lt;numpunct&lt;charT&gt;&nbsp;&gt;(str.getloc())</tt>.  
1320   Successive characters in the range <tt>[in,end)</tt> (see
1321   [lib.sequence.reqmts]) are obtained and matched against
1322   corresponding positions in the target sequences only as necessary to
1323   identify a unique match. The input iterator <tt>in</tt> is
1324   compared to <tt>end</tt> only when necessary to obtain a
1325   character. If and only if a target sequence is uniquely matched,
1326   <tt>val</tt> is set to the corresponding value.</p>
1327
1328 </blockquote>
1329
1330 <blockquote>
1331   <p>The <tt>in</tt> iterator is always left pointing one position beyond the last character
1332   successfully matched. If <tt>val</tt> is set, then err is set to <tt>str.goodbit</tt>; or to
1333   <tt>str.eofbit</tt> if, when seeking another character to match, it is found that
1334   <tt>(in==end)</tt>. If <tt>val</tt> is not set, then <i>err</i> is set to <tt>str.failbit</tt>; or to
1335   <tt>(str.failbit|str.eofbit)</tt>if
1336   the reason for the failure was that <tt>(in==end)</tt>. [Example: for targets
1337   <tt>true</tt>:"a" and <tt>false</tt>:"abb", the input sequence "a" yields
1338   <tt>val==true</tt> and <tt>err==str.eofbit</tt>; the input sequence "abc" yields
1339   <tt>err=str.failbit</tt>, with <tt>in</tt> ending at the 'c' element. For targets
1340   <tt>true</tt>:"1"
1341   and <tt>false</tt>:"0", the input sequence "1" yields <tt>val==true</tt>
1342   and <tt>err=str.goodbit</tt>. For empty targets (""), any input sequence yields
1343   <tt>err==str.failbit</tt>. --end example]</p>
1344 </blockquote>
1345
1346
1347
1348
1349
1350 <hr>
1351 <h3><a name="18"></a>18. Get(...bool&amp;) omitted</h3>
1352 <p><b>Section:</b> 22.2.2.1.1 [facet.num.get.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1353  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1354 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.members">issues</a> in [facet.num.get.members].</p>
1355 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1356 <p><b>Discussion:</b></p>
1357 <p>In the list of num_get&lt;&gt; non-virtual members on page 22-23, the member
1358 that parses bool values was omitted from the list of definitions of non-virtual
1359 members, though it is listed in the class definition and the corresponding
1360 virtual is listed everywhere appropriate. </p>
1361
1362
1363 <p><b>Proposed resolution:</b></p>
1364 <p>Add at the beginning of 22.2.2.1.1 [facet.num.get.members]
1365 another get member for bool&amp;, copied from the entry in 
1366 22.2.2.1 [locale.num.get].</p>
1367
1368
1369
1370
1371
1372 <hr>
1373 <h3><a name="19"></a>19. "Noconv" definition too vague</h3>
1374 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1375  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1376 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
1377 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1378 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#10">10</a></p>
1379 <p><b>Discussion:</b></p>
1380 <p>
1381 In the definitions of codecvt&lt;&gt;::do_out and do_in, they are
1382 specified to return noconv if "no conversion is
1383 needed". This definition is too vague, and does not say
1384 normatively what is done with the buffers.
1385 </p>
1386
1387
1388 <p><b>Proposed resolution:</b></p>
1389 <p>
1390 Change the entry for noconv in the table under paragraph 4 in section 
1391 22.2.1.4.2 [locale.codecvt.virtuals] to read:
1392 </p>
1393 <blockquote>
1394   <p><tt>noconv</tt>: <tt>internT</tt> and <tt>externT</tt> are the same type,
1395   and input sequence is identical to converted sequence.</p>
1396 </blockquote>
1397 <p>Change the Note in paragraph 2 to normative text as follows:</p>
1398 <blockquote>
1399   <p>If returns <tt>noconv</tt>, <tt>internT</tt> and <tt>externT</tt> are the
1400   same type and the converted sequence is identical to the input sequence <tt>[from,from_next)</tt>.
1401   <tt>to_next</tt> is set equal to <tt>to</tt>, the value of <tt>state</tt> is
1402   unchanged, and there are no changes to the values in <tt>[to, to_limit)</tt>.</p>
1403 </blockquote>
1404
1405
1406
1407
1408
1409 <hr>
1410 <h3><a name="20"></a>20. Thousands_sep returns wrong type</h3>
1411 <p><b>Section:</b> 22.2.3.1.2 [facet.numpunct.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1412  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1413 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1414 <p><b>Discussion:</b></p>
1415 <p>The synopsis for numpunct&lt;&gt;::do_thousands_sep, and the
1416 definition of numpunct&lt;&gt;::thousands_sep which calls it, specify
1417 that it returns a value of type char_type. Here it is erroneously
1418 described as returning a "string_type". </p>
1419
1420
1421 <p><b>Proposed resolution:</b></p>
1422 <p>In 22.2.3.1.2 [facet.numpunct.virtuals], above paragraph 2, change 
1423 "string_type" to "char_type". </p>
1424
1425
1426
1427
1428
1429 <hr>
1430 <h3><a name="21"></a>21. Codecvt_byname&lt;&gt; instantiations</h3>
1431 <p><b>Section:</b> 22.1.1.1.1 [locale.category] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1432  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1433 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.category">issues</a> in [locale.category].</p>
1434 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1435 <p><b>Discussion:</b></p>
1436 <p>In the second table in the section, captioned "Required
1437 instantiations", the instantiations for codecvt_byname&lt;&gt;
1438 have been omitted. These are necessary to allow users to construct a
1439 locale by name from facets. </p>
1440
1441
1442 <p><b>Proposed resolution:</b></p>
1443 <p>Add in 22.1.1.1.1 [locale.category] to the table captioned
1444 "Required instantiations", in the category "ctype"
1445 the lines </p>
1446
1447 <blockquote>
1448   <pre>codecvt_byname&lt;char,char,mbstate_t&gt;,
1449 codecvt_byname&lt;wchar_t,char,mbstate_t&gt; </pre>
1450 </blockquote>
1451
1452
1453
1454
1455
1456 <hr>
1457 <h3><a name="22"></a>22. Member open vs. flags</h3>
1458 <p><b>Section:</b> 27.8.1.9 [ifstream.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1459  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1460 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ifstream.members">issues</a> in [ifstream.members].</p>
1461 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1462 <p><b>Discussion:</b></p>
1463 <p>The description of basic_istream&lt;&gt;::open leaves unanswered questions about how it
1464 responds to or changes flags in the error status for the stream. A strict reading
1465 indicates that it ignores the bits and does not change them, which confuses users who do
1466 not expect eofbit and failbit to remain set after a successful open. There are three
1467 reasonable resolutions: 1) status quo 2) fail if fail(), ignore eofbit 3) clear failbit
1468 and eofbit on call to open(). </p>
1469
1470
1471 <p><b>Proposed resolution:</b></p>
1472 <p>In 27.8.1.9 [ifstream.members] paragraph 3, <i>and</i> in 27.8.1.13 [ofstream.members] paragraph 3, under open() effects, add a footnote:
1473 </p>
1474
1475 <blockquote>
1476   <p>A successful open does not change the error state.</p>
1477 </blockquote>
1478
1479
1480 <p><b>Rationale:</b></p>
1481 <p>This may seem surprising to some users, but it's just an instance
1482 of a general rule: error flags are never cleared by the
1483 implementation. The only way error flags are are ever cleared is if
1484 the user explicitly clears them by hand.</p>
1485
1486 <p>The LWG believed that preserving this general rule was
1487 important enough so that an exception shouldn't be made just for this
1488 one case.  The resolution of this issue clarifies what the LWG
1489 believes to have been the original intent.</p>
1490
1491
1492
1493
1494
1495
1496 <hr>
1497 <h3><a name="24"></a>24. "do_convert" doesn't exist</h3>
1498 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1499  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1500 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
1501 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1502 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#72">72</a></p>
1503 <p><b>Discussion:</b></p>
1504 <p>The description of codecvt&lt;&gt;::do_out and do_in mentions a
1505 symbol "do_convert" which is not defined in the
1506 standard. This is a leftover from an edit, and should be "do_in
1507 and do_out". </p>
1508
1509
1510 <p><b>Proposed resolution:</b></p>
1511 <p>In 22.2.1.4 [locale.codecvt], paragraph 3, change
1512 "do_convert" to "do_in or do_out". Also, in 22.2.1.4.2 [locale.codecvt.virtuals], change "do_convert()" to "do_in
1513 or do_out". </p>
1514
1515
1516
1517
1518
1519 <hr>
1520 <h3><a name="25"></a>25. String operator&lt;&lt; uses width() value wrong</h3>
1521 <p><b>Section:</b> 21.3.8.9 [string.io] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1522  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1523 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.io">issues</a> in [string.io].</p>
1524 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1525 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#67">67</a></p>
1526 <p><b>Discussion:</b></p>
1527 <p>In the description of operator&lt;&lt; applied to strings, the standard says that uses
1528 the smaller of os.width() and str.size(), to pad "as described in stage 3"
1529 elsewhere; but this is inconsistent, as this allows no possibility of space for padding. </p>
1530
1531
1532 <p><b>Proposed resolution:</b></p>
1533 <p>Change 21.3.8.9 [string.io]  paragraph 4 from:<br>
1534 <br>
1535 &nbsp;&nbsp;&nbsp; "... where <tt>n</tt> is the smaller of <tt>os.width()</tt> and <tt>str.size()</tt>;
1536 ..."<br>
1537 <br>
1538 to: <br>
1539 <br>
1540 &nbsp;&nbsp;&nbsp; "... where <tt>n</tt> is the larger of <tt>os.width()</tt> and <tt>str.size()</tt>;
1541 ..."</p>
1542
1543
1544
1545
1546
1547 <hr>
1548 <h3><a name="26"></a>26. Bad sentry example</h3>
1549 <p><b>Section:</b> 27.6.1.1.3 [istream::sentry] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1550  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1551 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream::sentry">issues</a> in [istream::sentry].</p>
1552 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1553 <p><b>Discussion:</b></p>
1554 <p>In paragraph 6, the code in the example: </p>
1555
1556 <pre>  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
1557   basic_istream&lt;charT,traits&gt;::sentry(
1558            basic_istream&lt;charT,traits&gt;&amp; is, bool noskipws = false) {
1559       ...
1560       int_type c;
1561       typedef ctype&lt;charT&gt; ctype_type;
1562       const ctype_type&amp; ctype = use_facet&lt;ctype_type&gt;(is.getloc());
1563       while ((c = is.rdbuf()-&gt;snextc()) != traits::eof()) {
1564         if (ctype.is(ctype.space,c)==0) {
1565           is.rdbuf()-&gt;sputbackc (c);
1566           break;
1567         }
1568       }
1569       ...
1570    }</pre>
1571
1572 <p>fails to demonstrate correct use of the facilities described. In
1573 particular, it fails to use traits operators, and specifies incorrect
1574 semantics. (E.g. it specifies skipping over the first character in the
1575 sequence without examining it.) </p>
1576
1577
1578 <p><b>Proposed resolution:</b></p>
1579 <p>Remove the example above from 27.6.1.1.3 [istream::sentry]
1580 paragraph 6.</p>
1581
1582
1583 <p><b>Rationale:</b></p>
1584 <p>The originally proposed replacement code for the example was not
1585 correct. The LWG tried in Kona and again in Tokyo to correct it
1586 without success. In Tokyo, an implementor reported that actual working
1587 code ran over one page in length and was quite complicated. The LWG
1588 decided that it would be counter-productive to include such a lengthy
1589 example, which might well still contain errors.</p>
1590
1591
1592
1593
1594
1595 <hr>
1596 <h3><a name="27"></a>27. String::erase(range) yields wrong iterator</h3>
1597 <p><b>Section:</b> 21.3.6.5 [string::erase] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1598  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1599 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string::erase">issues</a> in [string::erase].</p>
1600 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1601 <p><b>Discussion:</b></p>
1602 <p>The string::erase(iterator first, iterator last) is specified to return an element one
1603 place beyond the next element after the last one erased. E.g. for the string
1604 "abcde", erasing the range ['b'..'d') would yield an iterator for element 'e',
1605 while 'd' has not been erased. </p>
1606
1607
1608 <p><b>Proposed resolution:</b></p>
1609 <p>In 21.3.6.5 [string::erase], paragraph 10, change: </p>
1610
1611 <blockquote>
1612   <p>Returns: an iterator which points to the element immediately following _last_ prior to
1613   the element being erased. </p>
1614 </blockquote>
1615
1616 <p>to read </p>
1617
1618 <blockquote>
1619   <p>Returns: an iterator which points to the element pointed to by _last_ prior to the
1620   other elements being erased. </p>
1621 </blockquote>
1622
1623
1624
1625
1626
1627 <hr>
1628 <h3><a name="28"></a>28. Ctype&lt;char&gt;is ambiguous</h3>
1629 <p><b>Section:</b> 22.2.1.3.2 [facet.ctype.char.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1630  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1631 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.ctype.char.members">issues</a> in [facet.ctype.char.members].</p>
1632 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1633 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#236">236</a></p>
1634 <p><b>Discussion:</b></p>
1635 <p>The description of the vector form of ctype&lt;char&gt;::is can be interpreted to mean
1636 something very different from what was intended. Paragraph 4 says </p>
1637
1638 <blockquote>
1639   <p>Effects: The second form, for all *p in the range [low, high), assigns vec[p-low] to
1640   table()[(unsigned char)*p]. </p>
1641 </blockquote>
1642
1643 <p>This is intended to copy the value indexed from table()[] into the place identified in
1644 vec[]. </p>
1645
1646
1647 <p><b>Proposed resolution:</b></p>
1648 <p>Change 22.2.1.3.2 [facet.ctype.char.members], paragraph 4, to read </p>
1649
1650 <blockquote>
1651   <p>Effects: The second form, for all *p in the range [low, high), assigns into vec[p-low]
1652   the value table()[(unsigned char)*p]. </p>
1653 </blockquote>
1654
1655
1656
1657
1658
1659 <hr>
1660 <h3><a name="29"></a>29. Ios_base::init doesn't exist</h3>
1661 <p><b>Section:</b> 27.3.1 [narrow.stream.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1662  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1663 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#narrow.stream.objects">issues</a> in [narrow.stream.objects].</p>
1664 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1665 <p><b>Discussion:</b></p>
1666 <p>Sections 27.3.1 [narrow.stream.objects] and 27.3.2 [wide.stream.objects] mention
1667 a function ios_base::init, which is not defined. Probably they mean
1668 basic_ios&lt;&gt;::init, defined in 27.4.4.1 [basic.ios.cons],
1669 paragraph 3. </p>
1670
1671
1672 <p><b>Proposed resolution:</b></p>
1673 <p>[R12: modified to include paragraph 5.]</p>
1674
1675 <p>In 27.3.1 [narrow.stream.objects] paragraph 2 and 5, change </p>
1676
1677 <blockquote>
1678   <p>ios_base::init </p>
1679 </blockquote>
1680
1681 <p>to </p>
1682
1683 <blockquote>
1684   <p>basic_ios&lt;char&gt;::init </p>
1685 </blockquote>
1686
1687 <p>Also, make a similar change in 27.3.2 [wide.stream.objects] except it
1688 should read </p>
1689
1690 <blockquote>
1691   <p>basic_ios&lt;wchar_t&gt;::init </p>
1692 </blockquote>
1693
1694
1695
1696
1697
1698 <hr>
1699 <h3><a name="30"></a>30. Wrong header for LC_*</h3>
1700 <p><b>Section:</b> 22.1.1.1.1 [locale.category] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1701  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1702 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.category">issues</a> in [locale.category].</p>
1703 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1704 <p><b>Discussion:</b></p>
1705 <p>Paragraph 2 implies that the C macros LC_CTYPE etc. are defined in &lt;cctype&gt;,
1706 where they are in fact defined elsewhere to appear in &lt;clocale&gt;. </p>
1707
1708
1709 <p><b>Proposed resolution:</b></p>
1710 <p>In 22.1.1.1.1 [locale.category], paragraph 2, change
1711 "&lt;cctype&gt;" to read "&lt;clocale&gt;". </p>
1712
1713
1714
1715
1716
1717 <hr>
1718 <h3><a name="31"></a>31. Immutable locale values</h3>
1719 <p><b>Section:</b> 22.1.1 [locale] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1720  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1721 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale">issues</a> in [locale].</p>
1722 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1723 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#378">378</a></p>
1724 <p><b>Discussion:</b></p>
1725 <p>Paragraph 6, says "An instance of <tt>locale</tt> is
1726 <i>immutable</i>; once a facet reference is obtained from it,
1727 ...". This has caused some confusion, because locale variables
1728 are manifestly assignable. </p>
1729
1730
1731 <p><b>Proposed resolution:</b></p>
1732 <p>In 22.1.1 [locale] replace paragraph 6</p>
1733
1734 <blockquote>
1735   <p>An instance of <tt>locale</tt> is immutable; once a facet
1736   reference is obtained from it, that reference remains usable as long
1737   as the locale value itself exists.</p>
1738 </blockquote>
1739
1740 <p>with</p>
1741
1742 <blockquote>
1743   <p>Once a facet reference is obtained from a locale object by
1744   calling use_facet&lt;&gt;, that reference remains usable, and the
1745   results from member functions of it may be cached and re-used, as
1746   long as some locale object refers to that facet.</p>
1747 </blockquote>
1748
1749
1750
1751
1752
1753 <hr>
1754 <h3><a name="32"></a>32. Pbackfail description inconsistent</h3>
1755 <p><b>Section:</b> 27.5.2.4.4 [streambuf.virt.pback] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1756  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1757 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1758 <p><b>Discussion:</b></p>
1759 <p>The description of the required state before calling virtual member
1760 basic_streambuf&lt;&gt;::pbackfail requirements is inconsistent with the conditions
1761 described in 27.5.2.2.4 [lib.streambuf.pub.pback] where member sputbackc calls it.
1762 Specifically, the latter says it calls pbackfail if: </p>
1763
1764 <p>&nbsp;&nbsp;&nbsp; traits::eq(c,gptr()[-1]) is false </p>
1765
1766 <p>where pbackfail claims to require: </p>
1767
1768 <p>&nbsp;&nbsp;&nbsp; traits::eq(*gptr(),traits::to_char_type(c)) returns false </p>
1769
1770 <p>It appears that the pbackfail description is wrong. </p>
1771
1772
1773 <p><b>Proposed resolution:</b></p>
1774 <p>In 27.5.2.4.4 [streambuf.virt.pback], paragraph 1, change:</p>
1775
1776 <blockquote>
1777   <p>"<tt>traits::eq(*gptr(),traits::to_char_type( c))</tt>"</p>
1778 </blockquote>
1779
1780 <p>to </p>
1781
1782 <blockquote>
1783   <p>"<tt>traits::eq(traits::to_char_type(c),gptr()[-1])</tt>"
1784   </p>
1785 </blockquote>
1786
1787
1788 <p><b>Rationale:</b></p>
1789 <p>Note deliberate reordering of arguments for clarity in addition to the correction of
1790 the argument value.</p>
1791
1792
1793
1794
1795
1796 <hr>
1797 <h3><a name="33"></a>33. Codecvt&lt;&gt; mentions from_type</h3>
1798 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1799  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1800 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
1801 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1802 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#43">43</a></p>
1803 <p><b>Discussion:</b></p>
1804 <p>In the table defining the results from do_out and do_in, the specification for the
1805 result <i>error</i> says </p>
1806
1807 <blockquote>
1808   <p>encountered a from_type character it could not convert </p>
1809 </blockquote>
1810
1811 <p>but from_type is not defined. This clearly is intended to be an externT for do_in, or
1812 an internT for do_out. </p>
1813
1814
1815 <p><b>Proposed resolution:</b></p>
1816 <p>In 22.2.1.4.2 [locale.codecvt.virtuals] paragraph 4, replace the definition
1817 in the table for the case of _error_ with </p>
1818
1819 <blockquote>
1820   <p>encountered a character in <tt>[from,from_end)</tt> that it could not convert. </p>
1821 </blockquote>
1822
1823
1824
1825
1826
1827 <hr>
1828 <h3><a name="34"></a>34. True/falsename() not in ctype&lt;&gt;</h3>
1829 <p><b>Section:</b> 22.2.2.2.2 [facet.num.put.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1830  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1831 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.put.virtuals">issues</a> in [facet.num.put.virtuals].</p>
1832 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1833 <p><b>Discussion:</b></p>
1834 <p>In paragraph 19, Effects:, members truename() and falsename are used from facet
1835 ctype&lt;charT&gt;, but it has no such members. Note that this is also a problem in
1836 22.2.2.1.2, addressed in (4). </p>
1837
1838
1839 <p><b>Proposed resolution:</b></p>
1840 <p>In 22.2.2.2.2 [facet.num.put.virtuals], paragraph 19, in the Effects:
1841 clause for member put(...., bool), replace the initialization of the
1842 string_type value s as follows: </p>
1843
1844 <blockquote>
1845   <pre>const numpunct&amp; np = use_facet&lt;numpunct&lt;charT&gt; &gt;(loc);
1846 string_type s = val ? np.truename() : np.falsename(); </pre>
1847 </blockquote>
1848
1849
1850
1851
1852
1853 <hr>
1854 <h3><a name="35"></a>35. No manipulator unitbuf in synopsis</h3>
1855 <p><b>Section:</b> 27.4 [iostreams.base] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1856  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1857 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1858 <p><b>Discussion:</b></p>
1859 <p>In 27.4.5.1 [fmtflags.manip], we have a definition for a manipulator
1860 named "unitbuf". Unlike other manipulators, it's not listed
1861 in synopsis. Similarly for "nounitbuf". </p>
1862
1863
1864 <p><b>Proposed resolution:</b></p>
1865 <p>Add to the synopsis for &lt;ios&gt; in 27.4 [iostreams.base], after
1866 the entry for "nouppercase", the prototypes: </p>
1867
1868 <blockquote>
1869   <pre>ios_base&amp; unitbuf(ios_base&amp; str);
1870 ios_base&amp; nounitbuf(ios_base&amp; str); </pre>
1871 </blockquote>
1872
1873
1874
1875
1876
1877 <hr>
1878 <h3><a name="36"></a>36. Iword &amp; pword storage lifetime omitted</h3>
1879 <p><b>Section:</b> 27.4.2.5 [ios.base.storage] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1880  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1881 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios.base.storage">issues</a> in [ios.base.storage].</p>
1882 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1883 <p><b>Discussion:</b></p>
1884 <p>In the definitions for ios_base::iword and pword, the lifetime of the storage is
1885 specified badly, so that an implementation which only keeps the last value stored appears
1886 to conform. In particular, it says: </p>
1887
1888 <p>The reference returned may become invalid after another call to the object's iword
1889 member with a different index ... </p>
1890
1891 <p>This is not idle speculation; at least one implementation was done this way. </p>
1892
1893
1894 <p><b>Proposed resolution:</b></p>
1895 <p>Add in 27.4.2.5 [ios.base.storage], in both paragraph 2 and also in
1896 paragraph 4, replace the sentence: </p>
1897
1898 <blockquote>
1899   <p>The reference returned may become invalid after another call to the object's iword
1900   [pword] member with a different index, after a call to its copyfmt member, or when the
1901   object is destroyed. </p>
1902 </blockquote>
1903
1904 <p>with: </p>
1905
1906 <blockquote>
1907   <p>The reference returned is invalid after any other operations on the object. However,
1908   the value of the storage referred to is retained, so that until the next call to copyfmt,
1909   calling iword [pword] with the same index yields another reference to the same value. </p>
1910 </blockquote>
1911
1912 <p>substituting "iword" or "pword" as appropriate. </p>
1913
1914
1915
1916
1917
1918 <hr>
1919 <h3><a name="37"></a>37. Leftover "global" reference</h3>
1920 <p><b>Section:</b> 22.1.1 [locale] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1921  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1922 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale">issues</a> in [locale].</p>
1923 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1924 <p><b>Discussion:</b></p>
1925 <p>In the overview of locale semantics, paragraph 4, is the sentence </p>
1926
1927 <blockquote>
1928   <p>If Facet is not present in a locale (or, failing that, in the global locale), it throws
1929   the standard exception bad_cast. </p>
1930 </blockquote>
1931
1932 <p>This is not supported by the definition of use_facet&lt;&gt;, and represents semantics
1933 from an old draft. </p>
1934
1935
1936 <p><b>Proposed resolution:</b></p>
1937 <p>In 22.1.1 [locale], paragraph 4, delete the parenthesized
1938 expression </p>
1939
1940 <blockquote>
1941   <p>(or, failing that, in the global locale) </p>
1942 </blockquote>
1943
1944
1945
1946
1947
1948 <hr>
1949 <h3><a name="38"></a>38. Facet definition incomplete</h3>
1950 <p><b>Section:</b> 22.1.2 [locale.global.templates] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1951  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1952 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1953 <p><b>Discussion:</b></p>
1954 <p>It has been noticed by Esa Pulkkinen that the definition of
1955 "facet" is incomplete. In particular, a class derived from
1956 another facet, but which does not define a member <i>id</i>, cannot
1957 safely serve as the argument <i>F</i> to use_facet&lt;F&gt;(loc),
1958 because there is no guarantee that a reference to the facet instance
1959 stored in <i>loc</i> is safely convertible to <i>F</i>. </p>
1960
1961
1962 <p><b>Proposed resolution:</b></p>
1963 <p>In the definition of std::use_facet&lt;&gt;(), replace the text in paragraph 1 which
1964 reads: </p>
1965
1966 <blockquote>
1967   <p>Get a reference to a facet of a locale. </p>
1968 </blockquote>
1969
1970 <p>with: </p>
1971
1972 <blockquote>
1973   <p>Requires: <tt>Facet</tt> is a facet class whose definition
1974   contains the public static member <tt>id</tt> as defined in 22.1.1.1.2 [locale.facet]. </p>
1975 </blockquote>
1976
1977 <p><i>[
1978 Kona: strike as overspecification the text "(not inherits)"
1979 from the original resolution, which read "... whose definition
1980 contains (not inherits) the public static member
1981 <tt>id</tt>..."
1982 ]</i></p>
1983
1984
1985
1986
1987
1988
1989
1990 <hr>
1991 <h3><a name="39"></a>39. istreambuf_iterator&lt;&gt;::operator++(int) definition garbled</h3>
1992 <p><b>Section:</b> 24.5.3.4 [istreambuf.iterator::op++] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
1993  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
1994 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
1995 <p><b>Discussion:</b></p>
1996 <p>Following the definition of istreambuf_iterator&lt;&gt;::operator++(int) in paragraph
1997 3, the standard contains three lines of garbage text left over from a previous edit. </p>
1998
1999 <blockquote>
2000   <pre>istreambuf_iterator&lt;charT,traits&gt; tmp = *this;
2001 sbuf_-&gt;sbumpc();
2002 return(tmp); </pre>
2003 </blockquote>
2004
2005
2006 <p><b>Proposed resolution:</b></p>
2007 <p>In 24.5.3.4 [istreambuf.iterator::op++], delete the three lines of code at the
2008 end of paragraph 3. </p>
2009
2010
2011
2012
2013
2014 <hr>
2015 <h3><a name="40"></a>40. Meaningless normative paragraph in examples</h3>
2016 <p><b>Section:</b> 22.2.8 [facets.examples] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2017  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
2018 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facets.examples">issues</a> in [facets.examples].</p>
2019 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2020 <p><b>Discussion:</b></p>
2021 <p>Paragraph 3 of the locale examples is a description of part of an
2022 implementation technique that has lost its referent, and doesn't mean
2023 anything. </p>
2024
2025
2026 <p><b>Proposed resolution:</b></p>
2027 <p>Delete 22.2.8 [facets.examples] paragraph 3 which begins "This
2028 initialization/identification system depends...", or (at the
2029 editor's option) replace it with a place-holder to keep the paragraph
2030 numbering the same. </p>
2031
2032
2033
2034
2035
2036 <hr>
2037 <h3><a name="41"></a>41. Ios_base needs clear(), exceptions()</h3>
2038 <p><b>Section:</b> 27.4.2 [ios.base] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2039  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
2040 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios.base">issues</a> in [ios.base].</p>
2041 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2042 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#157">157</a></p>
2043 <p><b>Discussion:</b></p>
2044 <p>The description of ios_base::iword() and pword() in 27.4.2.4 [ios.members.static], say that if they fail, they "set badbit,
2045 which may throw an exception". However, ios_base offers no
2046 interface to set or to test badbit; those interfaces are defined in
2047 basic_ios&lt;&gt;. </p>
2048
2049
2050 <p><b>Proposed resolution:</b></p>
2051 <p>Change the description in 27.4.2.5 [ios.base.storage] in
2052 paragraph 2, and also in paragraph 4, as follows. Replace</p>
2053
2054 <blockquote>
2055   <p>If the function fails it sets badbit, which may throw an exception.</p>
2056 </blockquote>
2057
2058 <p>with</p>
2059
2060 <blockquote>
2061   <p>If the function fails, and <tt>*this</tt> is a base sub-object of
2062   a <tt>basic_ios&lt;&gt;</tt> object or sub-object, the effect is
2063   equivalent to calling <tt>basic_ios&lt;&gt;::setstate(badbit)</tt>
2064   on the derived object (which may throw <tt>failure</tt>).</p>
2065 </blockquote>
2066
2067 <p><i>[Kona: LWG reviewed wording; setstate(failbit) changed to
2068 setstate(badbit).]</i></p>
2069
2070
2071
2072
2073
2074
2075
2076 <hr>
2077 <h3><a name="42"></a>42. String ctors specify wrong default allocator</h3>
2078 <p><b>Section:</b> 21.3 [basic.string] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2079  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
2080 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
2081 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.string">issues</a> in [basic.string].</p>
2082 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2083 <p><b>Discussion:</b></p>
2084 <p>The basic_string&lt;&gt; copy constructor: </p>
2085
2086 <pre>basic_string(const basic_string&amp; str, size_type pos = 0,
2087              size_type n = npos, const Allocator&amp; a = Allocator()); </pre>
2088
2089 <p>specifies an Allocator argument default value that is
2090 counter-intuitive. The natural choice for a the allocator to copy from
2091 is str.get_allocator(). Though this cannot be expressed in
2092 default-argument notation, overloading suffices. </p>
2093
2094 <p>Alternatively, the other containers in Clause 23 (deque, list,
2095 vector) do not have this form of constructor, so it is inconsistent,
2096 and an evident source of confusion, for basic_string&lt;&gt; to have
2097 it, so it might better be removed. </p>
2098
2099
2100 <p><b>Proposed resolution:</b></p>
2101 <p> In 21.3 [basic.string], replace the declaration of the copy
2102 constructor as follows: </p>
2103
2104 <blockquote>
2105   <pre>basic_string(const basic_string&amp; str);
2106 basic_string(const basic_string&amp; str, size_type pos, size_type n = npos,
2107              const Allocator&amp; a = Allocator());</pre>
2108 </blockquote>
2109
2110 <p>In 21.3.1 [string.require], replace the copy constructor declaration
2111 as above. Add to paragraph 5, Effects:</p>
2112
2113 <blockquote>
2114   <p>In the first form, the Allocator value used is copied from
2115   <tt>str.get_allocator()</tt>.</p>
2116 </blockquote>
2117
2118
2119 <p><b>Rationale:</b></p>
2120 <p>The LWG believes the constructor is actually broken, rather than
2121 just an unfortunate design choice.</p>
2122
2123 <p>The LWG considered two other possible resolutions:</p>
2124
2125 <p>A. In 21.3 [basic.string], replace the declaration of the copy
2126 constructor as follows:</p>
2127
2128 <blockquote>
2129   <pre>basic_string(const basic_string&amp; str, size_type pos = 0,
2130              size_type n = npos);
2131 basic_string(const basic_string&amp; str, size_type pos,
2132              size_type n, const Allocator&amp; a); </pre>
2133 </blockquote>
2134
2135 <p>In 21.3.1 [string.require], replace the copy constructor declaration
2136 as above. Add to paragraph 5, Effects: </p>
2137
2138 <blockquote>
2139   <p>When no <tt>Allocator</tt> argument is provided, the string is constructed using the
2140   value <tt>str.get_allocator()</tt>. </p>
2141 </blockquote>
2142
2143 <p>B. In 21.3 [basic.string], and also in 21.3.1 [string.require], replace
2144 the declaration of the copy constructor as follows: </p>
2145
2146 <blockquote>
2147   <pre>basic_string(const basic_string&amp; str, size_type pos = 0,
2148              size_type n = npos); </pre>
2149 </blockquote>
2150
2151 <p>The proposed resolution reflects the original intent of the LWG. It
2152 was also noted by Pete Becker that this fix "will cause
2153 a small amount of existing code to now work correctly."</p>
2154
2155 <p><i>[
2156 Kona: issue editing snafu fixed - the proposed resolution now correctly
2157 reflects the LWG consensus.
2158 ]</i></p>
2159
2160
2161
2162
2163
2164
2165 <hr>
2166 <h3><a name="44"></a>44. Iostreams use operator== on int_type values</h3>
2167 <p><b>Section:</b> 27 [input.output] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
2168  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-06</p>
2169 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#input.output">issues</a> in [input.output].</p>
2170 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
2171 <p><b>Discussion:</b></p>
2172 <p>Many of the specifications for iostreams specify that character
2173 values or their int_type equivalents are compared using operators ==
2174 or !=, though in other places traits::eq() or traits::eq_int_type is
2175 specified to be used throughout. This is an inconsistency; we should
2176 change uses of == and != to use the traits members instead. </p>
2177
2178
2179 <p><b>Proposed resolution:</b></p>
2180
2181 <p><i>[Pre-Kona: Dietmar supplied wording]</i></p>
2182
2183
2184 <p>List of changes to clause 27:</p>
2185 <ol>
2186 <li>
2187    In lib.basic.ios.members paragraph 13 (postcondition clause for
2188    'fill(cT)') change
2189
2190 <blockquote><pre>     fillch == fill()
2191 </pre></blockquote>
2192
2193    to
2194
2195 <blockquote><pre>     traits::eq(fillch, fill())
2196 </pre></blockquote>
2197
2198
2199 </li>
2200 <li>
2201    In lib.istream.unformatted paragraph 7 (effects clause for
2202    'get(cT,streamsize,cT)'), third bullet, change
2203
2204 <blockquote><pre>     c == delim for the next available input character c
2205 </pre></blockquote>
2206
2207    to
2208
2209 <blockquote><pre>     traits::eq(c, delim) for the next available input character c
2210 </pre></blockquote>
2211
2212 </li>
2213 <li>
2214    In lib.istream.unformatted paragraph 12 (effects clause for
2215    'get(basic_streambuf&lt;cT,Tr&gt;&amp;,cT)'), third bullet, change
2216
2217 <blockquote><pre>     c == delim for the next available input character c
2218 </pre></blockquote>
2219
2220    to
2221
2222 <blockquote><pre>     traits::eq(c, delim) for the next available input character c
2223 </pre></blockquote>
2224
2225 </li>
2226 <li>
2227    In lib.istream.unformatted paragraph 17 (effects clause for
2228    'getline(cT,streamsize,cT)'), second bullet, change
2229
2230 <blockquote><pre>     c == delim for the next available input character c
2231 </pre></blockquote>
2232
2233    to
2234
2235 <blockquote><pre>     traits::eq(c, delim) for the next available input character c
2236   </pre></blockquote>
2237
2238 </li>
2239 <li>
2240    In lib.istream.unformatted paragraph 24 (effects clause for
2241    'ignore(int,int_type)'), second bullet, change
2242
2243 <blockquote><pre>     c == delim for the next available input character c
2244 </pre></blockquote>
2245
2246    to
2247
2248 <blockquote><pre>     traits::eq_int_type(c, delim) for the next available input
2249      character c
2250 </pre></blockquote>
2251   
2252 </li>
2253 <li>
2254    In lib.istream.unformatted paragraph 25 (notes clause for
2255    'ignore(int,int_type)'), second bullet, change
2256
2257 <blockquote><pre>     The last condition will never occur if delim == traits::eof()
2258 </pre></blockquote>
2259
2260    to
2261
2262 <blockquote><pre>     The last condition will never occur if
2263      traits::eq_int_type(delim, traits::eof()).
2264 </pre></blockquote>
2265
2266 </li>
2267 <li>
2268    In lib.istream.sentry paragraph 6 (example implementation for the
2269    sentry constructor) change
2270
2271 <blockquote><pre>     while ((c = is.rdbuf()-&gt;snextc()) != traits::eof()) {
2272 </pre></blockquote>
2273
2274    to
2275
2276 <blockquote><pre>     while (!traits::eq_int_type(c = is.rdbuf()-&gt;snextc(), traits::eof())) {
2277 </pre></blockquote>
2278
2279 </li>
2280 </ol>
2281
2282 <p>List of changes to Chapter 21:</p>
2283
2284 <ol>
2285 <li>
2286    In lib.string::find paragraph 1 (effects clause for find()),
2287    second bullet, change
2288
2289 <blockquote><pre>     at(xpos+I) == str.at(I) for all elements ...
2290 </pre></blockquote>
2291
2292    to
2293
2294 <blockquote><pre>     traits::eq(at(xpos+I), str.at(I)) for all elements ...
2295 </pre></blockquote>
2296
2297 </li>
2298 <li>
2299    In lib.string::rfind paragraph 1 (effects clause for rfind()),
2300    second bullet, change
2301
2302 <blockquote><pre>     at(xpos+I) == str.at(I) for all elements ...
2303 </pre></blockquote>
2304
2305    to
2306
2307 <blockquote><pre>     traits::eq(at(xpos+I), str.at(I)) for all elements ...
2308 </pre></blockquote>
2309
2310 </li>
2311 <li>
2312    In lib.string::find.first.of paragraph 1 (effects clause for
2313    find_first_of()), second bullet, change
2314
2315 <blockquote><pre>     at(xpos+I) == str.at(I) for all elements ...
2316 </pre></blockquote>
2317
2318    to
2319
2320 <blockquote><pre>     traits::eq(at(xpos+I), str.at(I)) for all elements ...
2321 </pre></blockquote>
2322
2323 </li>
2324 <li>
2325    In lib.string::find.last.of paragraph 1 (effects clause for
2326    find_last_of()), second bullet, change
2327
2328 <blockquote><pre>     at(xpos+I) == str.at(I) for all elements ...
2329 </pre></blockquote>
2330
2331    to
2332
2333 <blockquote><pre>     traits::eq(at(xpos+I), str.at(I)) for all elements ...
2334 </pre></blockquote>
2335
2336 </li>
2337 <li>
2338    In lib.string::find.first.not.of paragraph 1 (effects clause for
2339    find_first_not_of()), second bullet, change
2340
2341 <blockquote><pre>     at(xpos+I) == str.at(I) for all elements ...
2342 </pre></blockquote>
2343
2344    to
2345
2346 <blockquote><pre>     traits::eq(at(xpos+I), str.at(I)) for all elements ...
2347 </pre></blockquote>
2348 </li>
2349
2350 <li>
2351    In lib.string::find.last.not.of paragraph 1 (effects clause for
2352    find_last_not_of()), second bullet, change
2353
2354 <blockquote><pre>     at(xpos+I) == str.at(I) for all elements ...
2355 </pre></blockquote>
2356
2357    to
2358
2359 <blockquote><pre>     traits::eq(at(xpos+I), str.at(I)) for all elements ...
2360 </pre></blockquote>
2361 </li>
2362
2363 <li>
2364    In lib.string.ios paragraph 5 (effects clause for getline()),
2365    second bullet, change
2366
2367 <blockquote><pre>     c == delim for the next available input character c 
2368 </pre></blockquote>
2369
2370    to
2371
2372 <blockquote><pre>     traits::eq(c, delim) for the next available input character c 
2373 </pre></blockquote>
2374 </li>
2375
2376 </ol>
2377
2378 <p>Notes:</p>
2379 <ul>
2380 <li>
2381   Fixing this issue highlights another sloppyness in
2382   lib.istream.unformatted paragraph 24: this clause mentions a "character"
2383   which is then compared to an 'int_type' (see item 5. in the list
2384   below). It is not clear whether this requires explicit words and
2385   if so what these words are supposed to be. A similar issue exists,
2386   BTW, for operator*() of istreambuf_iterator which returns the result
2387   of sgetc() as a character type (see lib.istreambuf.iterator::op*
2388   paragraph 1), and for operator++() of istreambuf_iterator which
2389   passes the result of sbumpc() to a constructor taking a char_type
2390   (see lib.istreambuf.iterator::operator++ paragraph 3). Similarily, the
2391   assignment operator ostreambuf_iterator passes a char_type to a function
2392   taking an int_type (see lib.ostreambuf.iter.ops paragraph 1).
2393 </li>
2394 <li>
2395   It is inconsistent to use comparisons using the traits functions in
2396   Chapter 27 while not using them in Chapter 21, especially as some
2397   of the inconsistent uses actually involve streams (eg. getline() on
2398   streams). To avoid leaving this issue open still longer due to this
2399   inconsistency (it is open since 1998), a list of changes to Chapter
2400   21 is below.
2401 </li>
2402 <li>
2403   In Chapter 24 there are several places with statements like "the end
2404   of stream is reached (streambuf_type::sgetc() returns traits::eof())"
2405   (lib.istreambuf.iterator paragraph 1, lib.ostreambuf.iter.ops
2406   paragraph 5). It is unclear whether these should be clarified to use
2407   traits::eq_int_type() for detecting traits::eof().
2408 </li>
2409 </ul>
2410
2411
2412
2413
2414
2415
2416 <hr>
2417 <h3><a name="46"></a>46. Minor Annex D errors</h3>
2418 <p><b>Section:</b> D.7 [depr.str.strstreams] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2419  <b>Submitter:</b> Brendan Kehoe <b>Date:</b> 1998-06-01</p>
2420 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2421 <p><b>Discussion:</b></p><p>See lib-6522 and edit-814.</p>
2422
2423 <p><b>Proposed resolution:</b></p>
2424 <p>Change D.7.1 [depr.strstreambuf] (since streambuf is a typedef of
2425 basic_streambuf&lt;char&gt;) from:</p>
2426
2427 <pre>         virtual streambuf&lt;char&gt;* setbuf(char* s, streamsize n);</pre>
2428
2429 <p>to:</p>
2430
2431 <pre>         virtual streambuf* setbuf(char* s, streamsize n);</pre>
2432
2433 <p>In D.7.4 [depr.strstream] insert the semicolon now missing after
2434 int_type:</p>
2435
2436 <pre>     namespace std {
2437        class strstream
2438          : public basic_iostream&lt;char&gt; {
2439        public:
2440          // Types
2441          typedef char                                char_type;
2442          typedef typename char_traits&lt;char&gt;::int_type int_type
2443          typedef typename char_traits&lt;char&gt;::pos_type pos_type;</pre>
2444
2445
2446
2447
2448
2449 <hr>
2450 <h3><a name="47"></a>47. Imbue() and getloc() Returns clauses swapped</h3>
2451 <p><b>Section:</b> 27.4.2.3 [ios.base.locales] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2452  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-21</p>
2453 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios.base.locales">issues</a> in [ios.base.locales].</p>
2454 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2455 <p><b>Discussion:</b></p>
2456 <p>Section 27.4.2.3 specifies how imbue() and getloc() work. That
2457 section has two RETURNS clauses, and they make no sense as
2458 stated. They make perfect sense, though, if you swap them. Am I
2459 correct in thinking that paragraphs 2 and 4 just got mixed up by
2460 accident?</p>
2461
2462
2463 <p><b>Proposed resolution:</b></p>
2464 <p>In 27.4.2.3 [ios.base.locales] swap paragraphs 2 and 4.</p>
2465
2466
2467
2468
2469
2470 <hr>
2471 <h3><a name="48"></a>48. Use of non-existent exception constructor</h3>
2472 <p><b>Section:</b> 27.4.2.1.1 [ios::failure] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2473  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-21</p>
2474 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios::failure">issues</a> in [ios::failure].</p>
2475 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2476 <p><b>Discussion:</b></p>
2477 <p>27.4.2.1.1, paragraph 2, says that class failure initializes the
2478 base class, exception, with exception(msg). Class exception (see
2479 18.6.1) has no such constructor.</p>
2480
2481
2482 <p><b>Proposed resolution:</b></p>
2483 <p>Replace 27.4.2.1.1 [ios::failure], paragraph 2, with</p>
2484
2485 <blockquote>
2486   <p>EFFECTS: Constructs an object of class <tt>failure</tt>.</p>
2487 </blockquote>
2488
2489
2490
2491
2492
2493 <hr>
2494 <h3><a name="49"></a>49. Underspecification of ios_base::sync_with_stdio</h3>
2495 <p><b>Section:</b> 27.4.2.4 [ios.members.static] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
2496  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-21</p>
2497 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
2498 <p><b>Discussion:</b></p>
2499 <p>Two problems</p>
2500
2501 <p>(1) 27.4.2.4 doesn't say what ios_base::sync_with_stdio(f)
2502 returns. Does it return f, or does it return the previous
2503 synchronization state? My guess is the latter, but the standard
2504 doesn't say so.</p>
2505
2506 <p>(2) 27.4.2.4 doesn't say what it means for streams to be
2507 synchronized with stdio.  Again, of course, I can make some
2508 guesses. (And I'm unhappy about the performance implications of those
2509 guesses, but that's another matter.)</p>
2510
2511
2512 <p><b>Proposed resolution:</b></p>
2513 <p>Change the following sentence in 27.4.2.4 [ios.members.static]
2514 returns clause from:</p>
2515
2516 <blockquote>
2517   <p><tt>true</tt> if the standard iostream objects (27.3) are
2518   synchronized and otherwise returns <tt>false</tt>.</p>
2519 </blockquote>
2520
2521 <p>to:</p>
2522
2523 <blockquote>
2524   <p><tt>true</tt> if the previous state of the standard iostream
2525   objects (27.3) was synchronized and otherwise returns
2526   <tt>false</tt>.</p>
2527 </blockquote>
2528
2529 <p>Add the following immediately after 27.4.2.4 [ios.members.static],
2530 paragraph 2:</p>
2531
2532 <blockquote>
2533 <p>When a standard iostream object str is <i>synchronized</i> with a
2534 standard stdio stream f, the effect of inserting a character c by</p>
2535 <pre>  fputc(f, c);
2536 </pre>
2537
2538 <p>is the same as the effect of</p>
2539 <pre>  str.rdbuf()-&gt;sputc(c);
2540 </pre>
2541
2542 <p>for any sequence of characters; the effect of extracting a
2543 character c by</p>
2544 <pre>  c = fgetc(f);
2545 </pre>
2546
2547 <p>is the same as the effect of:</p>
2548 <pre>  c = str.rdbuf()-&gt;sbumpc(c);
2549 </pre>
2550
2551 <p>for any sequences of characters; and the effect of pushing
2552 back a character c by</p>
2553 <pre>  ungetc(c, f);
2554 </pre>
2555
2556 <p>is the same as the effect of</p>
2557 <pre>  str.rdbuf()-&gt;sputbackc(c);
2558 </pre>
2559
2560 <p>for any sequence of characters.  [<i>Footnote</i>: This implies
2561 that operations on a standard iostream object can be mixed arbitrarily
2562 with operations on the corresponding stdio stream.  In practical
2563 terms, synchronization usually means that a standard iostream object
2564 and a standard stdio object share a buffer. <i>--End Footnote</i>]</p>
2565 </blockquote>
2566
2567 <p><i>[pre-Copenhagen: PJP and Matt contributed the definition
2568 of "synchronization"]</i></p>
2569
2570
2571 <p><i>[post-Copenhagen: proposed resolution was revised slightly:
2572 text was added in the non-normative footnote to say that operations
2573 on the two streams can be mixed arbitrarily.]</i></p>
2574
2575
2576
2577
2578
2579
2580 <hr>
2581 <h3><a name="50"></a>50. Copy constructor and assignment operator of ios_base</h3>
2582 <p><b>Section:</b> 27.4.2 [ios.base] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2583  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-21</p>
2584 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios.base">issues</a> in [ios.base].</p>
2585 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2586 <p><b>Discussion:</b></p>
2587 <p>As written, ios_base has a copy constructor and an assignment
2588 operator. (Nothing in the standard says it doesn't have one, and all
2589 classes have copy constructors and assignment operators unless you
2590 take specific steps to avoid them.) However, nothing in 27.4.2 says
2591 what the copy constructor and assignment operator do. </p>
2592
2593 <p>My guess is that this was an oversight, that ios_base is, like
2594 basic_ios, not supposed to have a copy constructor or an assignment
2595 operator.</p>
2596
2597 <p>
2598 Jerry Schwarz comments: Yes, its an oversight, but in the opposite
2599 sense to what you're suggesting. At one point there was a definite
2600 intention that you could copy ios_base. It's an easy way to save the
2601 entire state of a stream for future use. As you note, to carry out
2602 that intention would have required a explicit description of the
2603 semantics (e.g. what happens to the iarray and parray stuff).
2604 </p>
2605
2606
2607 <p><b>Proposed resolution:</b></p>
2608 <p>In 27.4.2 [ios.base], class ios_base, specify the copy
2609 constructor and operator= members as being private.</p>
2610
2611
2612 <p><b>Rationale:</b></p>
2613 <p>The LWG believes the difficulty of specifying correct semantics
2614 outweighs any benefit of allowing ios_base objects to be copyable.</p>
2615
2616
2617
2618
2619
2620 <hr>
2621 <h3><a name="51"></a>51. Requirement to not invalidate iterators missing</h3>
2622 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2623  <b>Submitter:</b> David Vandevoorde <b>Date:</b> 1998-06-23</p>
2624 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
2625 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
2626 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2627 <p><b>Discussion:</b></p>
2628 <p>The std::sort algorithm can in general only sort a given sequence
2629 by moving around values. The list&lt;&gt;::sort() member on the other
2630 hand could move around values or just update internal pointers. Either
2631 method can leave iterators into the list&lt;&gt; dereferencable, but
2632 they would point to different things. </p>
2633
2634 <p>Does the FDIS mandate anywhere which method should be used for
2635 list&lt;&gt;::sort()?</p>
2636
2637 <p>Matt Austern comments:</p>
2638
2639 <p>I think you've found an omission in the standard. </p>
2640
2641 <p>The library working group discussed this point, and there was
2642 supposed to be a general requirement saying that list, set, map,
2643 multiset, and multimap may not invalidate iterators, or change the
2644 values that iterators point to, except when an operation does it
2645 explicitly. So, for example, insert() doesn't invalidate any iterators
2646 and erase() and remove() only invalidate iterators pointing to the
2647 elements that are being erased. </p>
2648
2649 <p>I looked for that general requirement in the FDIS, and, while I
2650 found a limited form of it for the sorted associative containers, I
2651 didn't find it for list. It looks like it just got omitted. </p>
2652
2653 <p>The intention, though, is that list&lt;&gt;::sort does not
2654 invalidate any iterators and does not change the values that any
2655 iterator points to. There would be no reason to have the member
2656 function otherwise.</p>
2657
2658
2659 <p><b>Proposed resolution:</b></p>
2660 <p>Add a new paragraph at the end of 23.1:</p>
2661
2662 <blockquote>
2663   <p>Unless otherwise specified (either explicitly or by defining a function in terms of
2664   other functions), invoking a container member function or passing a container as an
2665   argument to a library function shall not invalidate iterators to, or change the values of,
2666   objects within that container. </p>
2667 </blockquote>
2668
2669
2670 <p><b>Rationale:</b></p>
2671 <p>This was US issue CD2-23-011; it was accepted in London but the
2672 change was not made due to an editing oversight. The wording in the
2673 proposed resolution below is somewhat updated from CD2-23-011,
2674 particularly the addition of the phrase "or change the values
2675 of"</p>
2676
2677
2678
2679
2680
2681 <hr>
2682 <h3><a name="52"></a>52. Small I/O problems</h3>
2683 <p><b>Section:</b> 27.4.3.2 [fpos.operations] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2684  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-23</p>
2685 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2686 <p><b>Discussion:</b></p>
2687 <p>First, 27.4.4.1 [basic.ios.cons], table 89. This is pretty obvious:
2688 it should be titled "basic_ios&lt;&gt;() effects", not
2689 "ios_base() effects". </p>
2690
2691 <p>[The second item is a duplicate; see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#6">6</a> for
2692 resolution.]</p>
2693
2694 <p>Second, 27.4.3.2 [fpos.operations] table 88 . There are a couple
2695 different things wrong with it, some of which I've already discussed
2696 with Jerry, but the most obvious mechanical sort of error is that it
2697 uses expressions like P(i) and p(i), without ever defining what sort
2698 of thing "i" is.
2699 </p>
2700
2701 <p>(The other problem is that it requires support for streampos
2702 arithmetic. This is impossible on some systems, i.e. ones where file
2703 position is a complicated structure rather than just a number. Jerry
2704 tells me that the intention was to require syntactic support for
2705 streampos arithmetic, but that it wasn't actually supposed to do
2706 anything meaningful except on platforms, like Unix, where genuine
2707 arithmetic is possible.) </p>
2708
2709
2710 <p><b>Proposed resolution:</b></p>
2711 <p>Change 27.4.4.1 [basic.ios.cons] table 89 title from
2712 "ios_base() effects" to "basic_ios&lt;&gt;()
2713 effects". </p>
2714
2715
2716
2717
2718
2719 <hr>
2720 <h3><a name="53"></a>53. Basic_ios destructor unspecified</h3>
2721 <p><b>Section:</b> 27.4.4.1 [basic.ios.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2722  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-23</p>
2723 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.ios.cons">issues</a> in [basic.ios.cons].</p>
2724 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2725 <p><b>Discussion:</b></p>
2726 <p>There's nothing in 27.4.4 saying what basic_ios's destructor does.
2727 The important question is whether basic_ios::~basic_ios() destroys
2728 rdbuf().</p>
2729
2730
2731 <p><b>Proposed resolution:</b></p>
2732 <p>Add after 27.4.4.1 [basic.ios.cons] paragraph 2:</p>
2733
2734 <blockquote>
2735   <p><tt>virtual ~basic_ios();</tt></p>
2736   <p><b>Notes</b>: The destructor does not destroy <tt>rdbuf()</tt>.</p>
2737 </blockquote>
2738
2739
2740 <p><b>Rationale:</b></p> 
2741 <p>The LWG reviewed the additional question of whether or not
2742 <tt>rdbuf(0)</tt> may set <tt>badbit</tt>.  The answer is
2743 clearly yes; it may be set via <tt>clear()</tt>.  See 27.4.4.2 [basic.ios.members], paragraph 6.  This issue was reviewed at length
2744 by the LWG, which removed from the original proposed resolution a
2745 footnote which incorrectly said "<tt>rdbuf(0)</tt> does not set
2746 <tt>badbit</tt>".</p>
2747
2748
2749
2750
2751
2752 <hr>
2753 <h3><a name="54"></a>54. Basic_streambuf's destructor</h3>
2754 <p><b>Section:</b> 27.5.2.1 [streambuf.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2755  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-25</p>
2756 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#streambuf.cons">issues</a> in [streambuf.cons].</p>
2757 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2758 <p><b>Discussion:</b></p>
2759 <p>The class synopsis for basic_streambuf shows a (virtual)
2760 destructor, but the standard doesn't say what that destructor does. My
2761 assumption is that it does nothing, but the standard should say so
2762 explicitly. </p>
2763
2764
2765 <p><b>Proposed resolution:</b></p>
2766 <p>Add after 27.5.2.1 [streambuf.cons] paragraph 2:</p>
2767
2768 <blockquote>
2769   <p><tt>virtual&nbsp; ~basic_streambuf();</tt></p>
2770   <p><b>Effects</b>: None.</p>
2771 </blockquote>
2772
2773
2774
2775
2776
2777 <hr>
2778 <h3><a name="55"></a>55. Invalid stream position is undefined</h3>
2779 <p><b>Section:</b> 27 [input.output] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2780  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-26</p>
2781 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#input.output">issues</a> in [input.output].</p>
2782 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2783 <p><b>Discussion:</b></p>
2784 <p>Several member functions in clause 27 are defined in certain
2785 circumstances to return an "invalid stream position", a term
2786 that is defined nowhere in the standard. Two places (27.5.2.4.2,
2787 paragraph 4, and 27.8.1.4, paragraph 15) contain a cross-reference to
2788 a definition in _lib.iostreams.definitions_, a nonexistent
2789 section. </p>
2790
2791 <p>I suspect that the invalid stream position is just supposed to be
2792 pos_type(-1).  Probably best to say explicitly in (for example)
2793 27.5.2.4.2 that the return value is pos_type(-1), rather than to use
2794 the term "invalid stream position", define that term
2795 somewhere, and then put in a cross-reference. </p>
2796
2797 <p>The phrase "invalid stream position" appears ten times in
2798 the C++ Standard.  In seven places it refers to a return value, and it
2799 should be changed. In three places it refers to an argument, and it
2800 should not be changed. Here are the three places where "invalid
2801 stream position" should not be changed:</p>
2802
2803 <blockquote>
2804   <p>27.7.1.4 [stringbuf.virtuals], paragraph 14<br>
2805   27.8.1.5 [filebuf.virtuals], paragraph 14<br>
2806   D.7.1.3 [depr.strstreambuf.virtuals], paragraph 17
2807   </p>
2808 </blockquote>
2809
2810
2811 <p><b>Proposed resolution:</b></p>
2812 <p>In 27.5.2.4.2 [streambuf.virt.buffer], paragraph 4, change "Returns an
2813 object of class pos_type that stores an invalid stream position
2814 (_lib.iostreams.definitions_)" to "Returns
2815 <tt>pos_type(off_type(-1))</tt>".
2816 </p>
2817
2818 <p>In 27.5.2.4.2 [streambuf.virt.buffer], paragraph 6, change "Returns
2819 an object of class pos_type that stores an invalid stream
2820 position" to "Returns <tt>pos_type(off_type(-1))</tt>".</p>
2821
2822 <p>In 27.7.1.4 [stringbuf.virtuals], paragraph 13, change "the object
2823 stores an invalid stream position" to "the return value is
2824 <tt>pos_type(off_type(-1))</tt>". </p>
2825
2826 <p>In 27.8.1.5 [filebuf.virtuals], paragraph 13, change "returns an
2827 invalid stream position (27.4.3)" to "returns
2828 <tt>pos_type(off_type(-1))</tt>" </p>
2829
2830 <p>In 27.8.1.5 [filebuf.virtuals], paragraph 15, change "Otherwise
2831 returns an invalid stream position (_lib.iostreams.definitions_)"
2832 to "Otherwise returns <tt>pos_type(off_type(-1))</tt>"
2833 </p>
2834
2835 <p>In D.7.1.3 [depr.strstreambuf.virtuals], paragraph 15, change "the object
2836 stores an invalid stream position" to "the return value is
2837 <tt>pos_type(off_type(-1))</tt>" </p>
2838
2839 <p>In D.7.1.3 [depr.strstreambuf.virtuals], paragraph 18, change "the object
2840 stores an invalid stream position" to "the return value is
2841 <tt>pos_type(off_type(-1))</tt>"</p>
2842
2843
2844
2845
2846
2847 <hr>
2848 <h3><a name="56"></a>56. Showmanyc's return type</h3>
2849 <p><b>Section:</b> 27.5.2 [streambuf] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2850  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-06-29</p>
2851 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#streambuf">issues</a> in [streambuf].</p>
2852 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2853 <p><b>Discussion:</b></p>
2854 <p>The class summary for basic_streambuf&lt;&gt;, in 27.5.2, says that
2855 showmanyc has return type int. However, 27.5.2.4.3 says that its
2856 return type is streamsize. </p>
2857
2858
2859 <p><b>Proposed resolution:</b></p>
2860 <p>Change <tt>showmanyc</tt>'s return type in the
2861 27.5.2 [streambuf] class summary to <tt>streamsize</tt>.</p>
2862
2863
2864
2865
2866
2867 <hr>
2868 <h3><a name="57"></a>57. Mistake in char_traits</h3>
2869 <p><b>Section:</b> 21.1.3.4 [char.traits.specializations.wchar.t] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2870  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-07-01</p>
2871 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2872 <p><b>Discussion:</b></p>
2873 <p>21.1.3.2, paragraph 3, says "The types streampos and
2874 wstreampos may be different if the implementation supports no shift
2875 encoding in narrow-oriented iostreams but supports one or more shift
2876 encodings in wide-oriented streams". </p>
2877
2878 <p>That's wrong: the two are the same type. The &lt;iosfwd&gt; summary
2879 in 27.2 says that streampos and wstreampos are, respectively, synonyms
2880 for fpos&lt;char_traits&lt;char&gt;::state_type&gt; and
2881 fpos&lt;char_traits&lt;wchar_t&gt;::state_type&gt;, and, flipping back
2882 to clause 21, we see in 21.1.3.1 and 21.1.3.2 that
2883 char_traits&lt;char&gt;::state_type and
2884 char_traits&lt;wchar_t&gt;::state_type must both be mbstate_t. </p>
2885
2886
2887 <p><b>Proposed resolution:</b></p>
2888 <p>Remove the sentence in 21.1.3.4 [char.traits.specializations.wchar.t] paragraph 3 which
2889 begins "The types streampos and wstreampos may be
2890 different..." . </p>
2891
2892
2893
2894
2895
2896 <hr>
2897 <h3><a name="59"></a>59. Ambiguity in specification of gbump</h3>
2898 <p><b>Section:</b> 27.5.2.3.2 [streambuf.get.area] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2899  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-07-28</p>
2900 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2901 <p><b>Discussion:</b></p>
2902 <p>27.5.2.3.1 says that basic_streambuf::gbump() "Advances the
2903 next pointer for the input sequence by n." </p>
2904
2905 <p>The straightforward interpretation is that it is just gptr() +=
2906 n. An alternative interpretation, though, is that it behaves as if it
2907 calls sbumpc n times. (The issue, of course, is whether it might ever
2908 call underflow.) There is a similar ambiguity in the case of
2909 pbump. </p>
2910
2911 <p>(The "classic" AT&amp;T implementation used the
2912 former interpretation.)</p>
2913
2914
2915 <p><b>Proposed resolution:</b></p>
2916 <p>Change 27.5.2.3.2 [streambuf.get.area] paragraph 4 gbump effects from:</p>
2917
2918 <blockquote>
2919   <p>Effects: Advances the next pointer for the input sequence by n.</p>
2920 </blockquote>
2921
2922 <p>to:</p>
2923
2924 <blockquote>
2925   <p>Effects: Adds <tt>n</tt> to the next pointer for the input sequence.</p>
2926 </blockquote>
2927
2928 <p>Make the same change to 27.5.2.3.3 [streambuf.put.area] paragraph 4 pbump
2929 effects.</p>
2930
2931
2932
2933
2934
2935 <hr>
2936 <h3><a name="60"></a>60. What is a formatted input function?</h3>
2937 <p><b>Section:</b> 27.6.1.2.1 [istream.formatted.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
2938  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-08-03</p>
2939 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.formatted.reqmts">issues</a> in [istream.formatted.reqmts].</p>
2940 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
2941 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#162">162</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#163">163</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#166">166</a></p>
2942 <p><b>Discussion:</b></p>
2943 <p>Paragraph 1 of 27.6.1.2.1 contains general requirements for all
2944 formatted input functions. Some of the functions defined in section
2945 27.6.1.2 explicitly say that those requirements apply ("Behaves
2946 like a formatted input member (as described in 27.6.1.2.1)"), but
2947 others don't. The question: is 27.6.1.2.1 supposed to apply to
2948 everything in 27.6.1.2, or only to those member functions that
2949 explicitly say "behaves like a formatted input member"? Or
2950 to put it differently: are we to assume that everything that appears
2951 in a section called "Formatted input functions" really is a
2952 formatted input function? I assume that 27.6.1.2.1 is intended to
2953 apply to the arithmetic extractors (27.6.1.2.2), but I assume that it
2954 is not intended to apply to extractors like </p>
2955
2956 <pre>    basic_istream&amp; operator&gt;&gt;(basic_istream&amp; (*pf)(basic_istream&amp;));</pre>
2957
2958 <p>and </p>
2959
2960 <pre>    basic_istream&amp; operator&gt;&gt;(basic_streammbuf*);</pre>
2961
2962 <p>There is a similar ambiguity for unformatted input, formatted output, and unformatted
2963 output. </p>
2964
2965 <p>Comments from Judy Ward: It seems like the problem is that the
2966 basic_istream and basic_ostream operator &lt;&lt;()'s that are used
2967 for the manipulators and streambuf* are in the wrong section and
2968 should have their own separate section or be modified to make it clear
2969 that the "Common requirements" listed in section 27.6.1.2.1
2970 (for basic_istream) and section 27.6.2.5.1 (for basic_ostream) do not
2971 apply to them. </p>
2972
2973 <p>Additional comments from Dietmar Kühl: It appears to be somewhat
2974 nonsensical to consider the functions defined in 27.6.1.2.3
2975 [istream::extractors] paragraphs 1 to 5 to be "Formatted input
2976 function" but since these functions are defined in a section
2977 labeled "Formatted input functions" it is unclear to me
2978 whether these operators are considered formatted input functions which
2979 have to conform to the "common requirements" from 27.6.1.2.1
2980 [istream.formatted.reqmts]: If this is the case, all manipulators, not
2981 just <tt>ws</tt>, would skip whitespace unless <tt>noskipws</tt> is
2982 set (... but setting <tt>noskipws</tt> using the manipulator syntax
2983 would also skip whitespace :-)</p> <p>It is not clear which functions
2984 are to be considered unformatted input functions. As written, it seems
2985 that all functions in 27.6.1.3 [istream.unformatted] are unformatted input
2986 functions. However, it does not really make much sense to construct a
2987 sentry object for <tt>gcount()</tt>, <tt>sync()</tt>, ... Also it is
2988 unclear what happens to the <tt>gcount()</tt> if
2989 eg. <tt>gcount()</tt>, <tt>putback()</tt>, <tt>unget()</tt>, or
2990 <tt>sync()</tt> is called: These functions don't extract characters,
2991 some of them even "unextract" a character. Should this still
2992 be reflected in <tt>gcount()</tt>? Of course, it could be read as if
2993 after a call to <tt>gcount()</tt> <tt>gcount()</tt> return <tt>0</tt>
2994 (the last unformatted input function, <tt>gcount()</tt>, didn't
2995 extract any character) and after a call to <tt>putback()</tt>
2996 <tt>gcount()</tt> returns <tt>-1</tt> (the last unformatted input
2997 function <tt>putback()</tt> did "extract" back into the
2998 stream). Correspondingly for <tt>unget()</tt>. Is this what is
2999 intended?  If so, this should be clarified. Otherwise, a corresponding
3000 clarification should be used.</p>
3001
3002
3003 <p><b>Proposed resolution:</b></p>
3004 <p>
3005 In 27.6.1.2.2 [lib.istream.formatted.arithmetic], paragraph 1.
3006 Change the beginning of the second sentence from "The conversion
3007 occurs" to "These extractors behave as formatted input functions (as
3008 described in 27.6.1.2.1).  After a sentry object is constructed,
3009 the conversion occurs"
3010 </p>
3011
3012 <p>
3013 In 27.6.1.2.3, [lib.istream::extractors], before paragraph 1.
3014 Add an effects clause.  "Effects: None.  This extractor does
3015 not behave as a formatted input function (as described in
3016 27.6.1.2.1).
3017 </p>
3018
3019 <p>
3020 In 27.6.1.2.3, [lib.istream::extractors], paragraph 2.  Change the
3021 effects clause to "Effects: Calls pf(*this).  This extractor does not
3022 behave as a formatted input function (as described in 27.6.1.2.1).
3023 </p>
3024
3025 <p>
3026 In 27.6.1.2.3, [lib.istream::extractors], paragraph 4.  Change the
3027 effects clause to "Effects: Calls pf(*this).  This extractor does not
3028 behave as a formatted input function (as described in 27.6.1.2.1).
3029 </p>
3030
3031 <p>
3032 In 27.6.1.2.3, [lib.istream::extractors], paragraph 12.  Change the
3033 first two sentences from "If sb is null, calls setstate(failbit),
3034 which may throw ios_base::failure (27.4.4.3).  Extracts characters
3035 from *this..." to "Behaves as a formatted input function (as described
3036 in 27.6.1.2.1).  If sb is null, calls setstate(failbit), which may
3037 throw ios_base::failure (27.4.4.3).  After a sentry object is
3038 constructed, extracts characters from *this...".
3039 </p>
3040
3041 <p>
3042 In 27.6.1.3, [lib.istream.unformatted], before paragraph 2.  Add an
3043 effects clause.  "Effects: none. This member function does not behave
3044 as an unformatted input function (as described in 27.6.1.3, paragraph 1)."
3045 </p>
3046
3047 <p>
3048 In 27.6.1.3, [lib.istream.unformatted], paragraph 3.  Change the
3049 beginning of the first sentence of the effects clause from "Extracts a
3050 character" to "Behaves as an unformatted input function (as described
3051 in 27.6.1.3, paragraph 1).  After constructing a sentry object, extracts a
3052 character"
3053 </p>
3054
3055 <p>
3056 In 27.6.1.3, [lib.istream.unformatted], paragraph 5.  Change the
3057 beginning of the first sentence of the effects clause from "Extracts a
3058 character" to "Behaves as an unformatted input function (as described
3059 in 27.6.1.3, paragraph 1).  After constructing a sentry object, extracts a
3060 character"
3061 </p>
3062
3063 <p>
3064 In 27.6.1.3, [lib.istream.unformatted], paragraph 7.  Change the
3065 beginning of the first sentence of the effects clause from "Extracts
3066 characters" to "Behaves as an unformatted input function (as described
3067 in 27.6.1.3, paragraph 1).  After constructing a sentry object, extracts
3068 characters"
3069 </p>
3070
3071 <p>
3072 [No change needed in paragraph 10, because it refers to paragraph 7.]
3073 </p>
3074
3075 <p>
3076 In 27.6.1.3, [lib.istream.unformatted], paragraph 12.  Change the
3077 beginning of the first sentence of the effects clause from "Extracts
3078 characters" to "Behaves as an unformatted input function (as described
3079 in 27.6.1.3, paragraph 1).  After constructing a sentry object, extracts
3080 characters"
3081 </p>
3082
3083 <p>
3084 [No change needed in paragraph 15.]
3085 </p>
3086
3087 <p>
3088 In 27.6.1.3, [lib.istream.unformatted], paragraph 17.  Change the
3089 beginning of the first sentence of the effects clause from "Extracts
3090 characters" to "Behaves as an unformatted input function (as described
3091 in 27.6.1.3, paragraph 1).  After constructing a sentry object, extracts
3092 characters"
3093 </p>
3094
3095 <p>
3096 [No change needed in paragraph 23.]
3097 </p>
3098
3099 <p>
3100 In 27.6.1.3, [lib.istream.unformatted], paragraph 24.  Change the
3101 beginning of the first sentence of the effects clause from "Extracts
3102 characters" to "Behaves as an unformatted input function (as described
3103 in 27.6.1.3, paragraph 1).  After constructing a sentry object, extracts
3104 characters"
3105 </p>
3106
3107 <p>
3108 In 27.6.1.3, [lib.istream.unformatted], before paragraph 27.  Add an
3109 Effects clause: "Effects: Behaves as an unformatted input function (as
3110 described in 27.6.1.3, paragraph 1).  After constructing a sentry
3111 object, reads but does not extract the current input character."
3112 </p>
3113
3114 <p>
3115 In 27.6.1.3, [lib.istream.unformatted], paragraph 28.  Change the
3116 first sentence of the Effects clause from "If !good() calls" to
3117 Behaves as an unformatted input function (as described in 27.6.1.3,
3118 paragraph 1).  After constructing a sentry object, if !good() calls"
3119 </p>
3120
3121 <p>
3122 In 27.6.1.3, [lib.istream.unformatted], paragraph 30.  Change the
3123 first sentence of the Effects clause from "If !good() calls" to
3124 "Behaves as an unformatted input function (as described in 27.6.1.3,
3125 paragraph 1).  After constructing a sentry object, if !good() calls"
3126 </p>
3127
3128 <p>
3129 In 27.6.1.3, [lib.istream.unformatted], paragraph 32.  Change the
3130 first sentence of the Effects clause from "If !good() calls..." to
3131 "Behaves as an unformatted input function (as described in 27.6.1.3,
3132 paragraph 1).  After constructing a sentry object, if !good()
3133 calls..."  Add a new sentence to the end of the Effects clause:
3134 "[Note: this function extracts no characters, so the value returned
3135 by the next call to gcount() is 0.]"
3136 </p>
3137
3138 <p>
3139 In 27.6.1.3, [lib.istream.unformatted], paragraph 34.  Change the
3140 first sentence of the Effects clause from "If !good() calls" to
3141 "Behaves as an unformatted input function (as described in 27.6.1.3,
3142 paragraph 1).  After constructing a sentry object, if !good() calls".
3143 Add a new sentence to the end of the Effects clause: "[Note: this
3144 function extracts no characters, so the value returned by the next
3145 call to gcount() is 0.]"
3146 </p>
3147
3148 <p>
3149 In 27.6.1.3, [lib.istream.unformatted], paragraph 36.  Change the
3150 first sentence of the Effects clause from "If !rdbuf() is" to "Behaves
3151 as an unformatted input function (as described in 27.6.1.3, paragraph
3152 1), except that it does not count the number of characters extracted
3153 and does not affect the value returned by subsequent calls to
3154 gcount().  After constructing a sentry object, if rdbuf() is"
3155 </p>
3156
3157 <p>
3158 In 27.6.1.3, [lib.istream.unformatted], before paragraph 37.  Add an
3159 Effects clause: "Effects: Behaves as an unformatted input function (as
3160 described in 27.6.1.3, paragraph 1), except that it does not count the
3161 number of characters extracted and does not affect the value returned
3162 by subsequent calls to gcount()."  Change the first sentence of
3163 paragraph 37 from "if fail()" to "after constructing a sentry object,
3164 if fail()".
3165 </p>
3166
3167 <p>
3168 In 27.6.1.3, [lib.istream.unformatted], paragraph 38.  Change the
3169 first sentence of the Effects clause from "If fail()" to "Behaves
3170 as an unformatted input function (as described in 27.6.1.3, paragraph
3171 1), except that it does not count the number of characters extracted
3172 and does not affect the value returned by subsequent calls to
3173 gcount().  After constructing a sentry object, if fail()
3174 </p>
3175
3176 <p>
3177 In 27.6.1.3, [lib.istream.unformatted], paragraph 40.  Change the
3178 first sentence of the Effects clause from "If fail()" to "Behaves
3179 as an unformatted input function (as described in 27.6.1.3, paragraph
3180 1), except that it does not count the number of characters extracted
3181 and does not affect the value returned by subsequent calls to
3182 gcount().  After constructing a sentry object, if fail()
3183 </p>
3184
3185 <p>
3186 In 27.6.2.5.2 [lib.ostream.inserters.arithmetic], paragraph 1.  Change
3187 the beginning of the third sentence from "The formatting conversion"
3188 to "These extractors behave as formatted output functions (as
3189 described in 27.6.2.5.1).  After the sentry object is constructed, the
3190 conversion occurs".
3191 </p>
3192
3193 <p>
3194 In 27.6.2.5.3 [lib.ostream.inserters], before paragraph 1.  Add an
3195 effects clause: "Effects: None. Does not behave as a formatted output
3196 function (as described in 27.6.2.5.1).".
3197 </p>
3198
3199 <p>
3200 In 27.6.2.5.3 [lib.ostream.inserters], paragraph 2.  Change the
3201 effects clause to "Effects: calls pf(*this).  This extractor does not
3202 behave as a formatted output function (as described in 27.6.2.5.1).".
3203 </p>
3204
3205 <p>
3206 In 27.6.2.5.3 [lib.ostream.inserters], paragraph 4.  Change the
3207 effects clause to "Effects: calls pf(*this).  This extractor does not
3208 behave as a formatted output function (as described in 27.6.2.5.1).".
3209 </p>
3210
3211 <p>
3212 In 27.6.2.5.3 [lib.ostream.inserters], paragraph 6.  Change the first
3213 sentence from "If sb" to "Behaves as a formatted output function (as
3214 described in 27.6.2.5.1).  After the sentry object is constructed, if
3215 sb".
3216 </p>
3217
3218 <p>
3219 In 27.6.2.6 [lib.ostream.unformatted], paragraph 2.  Change the first
3220 sentence from "Inserts the character" to "Behaves as an unformatted
3221 output function (as described in 27.6.2.6, paragraph 1).  After
3222 constructing a sentry object, inserts the character".
3223 </p>
3224
3225 <p>
3226 In 27.6.2.6 [lib.ostream.unformatted], paragraph 5.  Change the first
3227 sentence from "Obtains characters" to "Behaves as an unformatted
3228 output function (as described in 27.6.2.6, paragraph 1).  After
3229 constructing a sentry object, obtains characters".
3230 </p>
3231
3232 <p>
3233 In 27.6.2.6 [lib.ostream.unformatted], paragraph 7.  Add a new
3234 sentence at the end of the paragraph: "Does not behave as an
3235 unformatted output function (as described in 27.6.2.6, paragraph 1)."
3236 </p>
3237
3238
3239 <p><b>Rationale:</b></p>
3240 <p>See J16/99-0043==WG21/N1219, Proposed Resolution to Library Issue 60,
3241 by Judy Ward and Matt Austern.  This proposed resolution is section
3242 VI of that paper.</p>
3243
3244
3245
3246
3247
3248 <hr>
3249 <h3><a name="61"></a>61. Ambiguity in iostreams exception policy</h3>
3250 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3251  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-08-06</p>
3252 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
3253 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3254 <p><b>Discussion:</b></p>
3255 <p>The introduction to the section on unformatted input (27.6.1.3)
3256 says that every unformatted input function catches all exceptions that
3257 were thrown during input, sets badbit, and then conditionally rethrows
3258 the exception. That seems clear enough. Several of the specific
3259 functions, however, such as get() and read(), are documented in some
3260 circumstances as setting eofbit and/or failbit. (The standard notes,
3261 correctly, that setting eofbit or failbit can sometimes result in an
3262 exception being thrown.) The question: if one of these functions
3263 throws an exception triggered by setting failbit, is this an exception
3264 "thrown during input" and hence covered by 27.6.1.3, or does
3265 27.6.1.3 only refer to a limited class of exceptions? Just to make
3266 this concrete, suppose you have the following snippet. </p>
3267
3268 <pre>  
3269   char buffer[N];
3270   istream is;
3271   ...
3272   is.exceptions(istream::failbit); // Throw on failbit but not on badbit.
3273   is.read(buffer, N);</pre>
3274
3275 <p>Now suppose we reach EOF before we've read N characters. What
3276 iostate bits can we expect to be set, and what exception (if any) will
3277 be thrown? </p>
3278
3279
3280 <p><b>Proposed resolution:</b></p>
3281 <p>
3282 In 27.6.1.3, paragraph 1, after the sentence that begins
3283 "If an exception is thrown...", add the following
3284 parenthetical comment: "(Exceptions thrown from 
3285 <tt>basic_ios&lt;&gt;::clear()</tt> are not caught or rethrown.)"
3286 </p>
3287
3288
3289 <p><b>Rationale:</b></p>
3290 <p>The LWG looked to two alternative wordings, and choose the proposed
3291 resolution as better standardese.</p>
3292
3293
3294
3295
3296
3297 <hr>
3298 <h3><a name="62"></a>62. <tt>Sync</tt>'s return value</h3>
3299 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3300  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-08-06</p>
3301 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
3302 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3303 <p><b>Discussion:</b></p>
3304 <p>The Effects clause for sync() (27.6.1.3, paragraph 36) says that it
3305 "calls rdbuf()-&gt;pubsync() and, if that function returns -1
3306 ... returns traits::eof()." </p>
3307
3308 <p>That looks suspicious, because traits::eof() is of type
3309 traits::int_type while the return type of sync() is int. </p>
3310
3311
3312 <p><b>Proposed resolution:</b></p>
3313 <p>In 27.6.1.3 [istream.unformatted], paragraph 36, change "returns
3314 <tt>traits::eof()</tt>" to "returns <tt>-1</tt>".
3315 </p>
3316
3317
3318
3319
3320
3321 <hr>
3322 <h3><a name="63"></a>63. Exception-handling policy for unformatted output</h3>
3323 <p><b>Section:</b> 27.6.2.7 [ostream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3324  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-08-11</p>
3325 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.unformatted">issues</a> in [ostream.unformatted].</p>
3326 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3327 <p><b>Discussion:</b></p>
3328 <p>Clause 27 details an exception-handling policy for formatted input,
3329 unformatted input, and formatted output. It says nothing for
3330 unformatted output (27.6.2.6). 27.6.2.6 should either include the same
3331 kind of exception-handling policy as in the other three places, or
3332 else it should have a footnote saying that the omission is
3333 deliberate. </p>
3334
3335
3336 <p><b>Proposed resolution:</b></p>
3337 <p>
3338 In 27.6.2.6, paragraph 1, replace the last sentence ("In any
3339 case, the unformatted output function ends by destroying the sentry
3340 object, then returning the value specified for the formatted output
3341 function.") with the following text:
3342 </p>
3343 <blockquote><p>
3344 If an exception is thrown during output, then <tt>ios::badbit</tt> is
3345 turned on [Footnote: without causing an <tt>ios::failure</tt> to be
3346 thrown.] in <tt>*this</tt>'s error state. If <tt>(exceptions() &amp;
3347 badbit) != 0</tt> then the exception is rethrown.  In any case, the
3348 unformatted output function ends by destroying the sentry object,
3349 then, if no exception was thrown, returning the value specified for
3350 the formatted output function.
3351 </p></blockquote>
3352
3353
3354 <p><b>Rationale:</b></p>
3355 <p>
3356 This exception-handling policy is consistent with that of formatted
3357 input, unformatted input, and formatted output.
3358 </p>
3359
3360
3361
3362
3363
3364 <hr>
3365 <h3><a name="64"></a>64. Exception handling in <tt>basic_istream::operator&gt;&gt;(basic_streambuf*)</tt></h3>
3366 <p><b>Section:</b> 27.6.1.2.3 [istream::extractors] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3367  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-08-11</p>
3368 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream::extractors">issues</a> in [istream::extractors].</p>
3369 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3370 <p><b>Discussion:</b></p>
3371 <p>27.6.1.2.3, paragraph 13, is ambiguous. It can be interpreted two
3372 different ways, depending on whether the second sentence is read as an
3373 elaboration of the first. </p>
3374
3375
3376 <p><b>Proposed resolution:</b></p>
3377 <p>Replace 27.6.1.2.3 [istream::extractors], paragraph 13, which begins
3378 "If the function inserts no characters ..." with:</p>
3379
3380 <blockquote>
3381   <p>If the function inserts no characters, it calls
3382   <tt>setstate(failbit)</tt>, which may throw
3383   <tt>ios_base::failure</tt> (27.4.4.3). If it inserted no characters
3384   because it caught an exception thrown while extracting characters
3385   from <tt>sb</tt> and <tt>failbit</tt> is on in <tt>exceptions()</tt>
3386   (27.4.4.3), then the caught exception is rethrown. </p>
3387 </blockquote>
3388
3389
3390
3391
3392
3393 <hr>
3394 <h3><a name="66"></a>66. Strstreambuf::setbuf</h3>
3395 <p><b>Section:</b> D.7.1.3 [depr.strstreambuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3396  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-08-18</p>
3397 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.strstreambuf.virtuals">issues</a> in [depr.strstreambuf.virtuals].</p>
3398 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3399 <p><b>Discussion:</b></p>
3400 <p>D.7.1.3, paragraph 19, says that strstreambuf::setbuf
3401 "Performs an operation that is defined separately for each class
3402 derived from strstreambuf". This is obviously an incorrect
3403 cut-and-paste from basic_streambuf. There are no classes derived from
3404 strstreambuf. </p>
3405
3406
3407 <p><b>Proposed resolution:</b></p>
3408 <p>D.7.1.3 [depr.strstreambuf.virtuals], paragraph 19, replace the setbuf effects
3409 clause which currently says "Performs an operation that is
3410 defined separately for each class derived from strstreambuf"
3411 with:</p>
3412
3413 <blockquote>
3414   <p><b>Effects</b>: implementation defined, except that
3415   <tt>setbuf(0,0)</tt> has no effect.</p>
3416 </blockquote>
3417
3418
3419
3420
3421
3422 <hr>
3423 <h3><a name="68"></a>68. Extractors for char* should store null at end</h3>
3424 <p><b>Section:</b> 27.6.1.2.3 [istream::extractors] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3425  <b>Submitter:</b> Angelika Langer <b>Date:</b> 1998-07-14</p>
3426 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream::extractors">issues</a> in [istream::extractors].</p>
3427 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3428 <p><b>Discussion:</b></p>
3429 <p>Extractors for char* (27.6.1.2.3) do not store a null character
3430 after the extracted character sequence whereas the unformatted
3431 functions like get() do. Why is this?</p>
3432
3433 <p>Comment from Jerry Schwarz: There is apparently an editing
3434 glitch. You'll notice that the last item of the list of what stops
3435 extraction doesn't make any sense. It was supposed to be the line that
3436 said a null is stored.</p>
3437
3438
3439 <p><b>Proposed resolution:</b></p>
3440 <p>27.6.1.2.3 [istream::extractors], paragraph 7, change the last list
3441 item from:</p>
3442
3443 <blockquote><p>
3444   A null byte (<tt>charT()</tt>) in the next position, which may be
3445   the first position if no characters were extracted.
3446 </p></blockquote>
3447
3448 <p>to become a new paragraph which reads:</p>
3449
3450 <blockquote><p>
3451   Operator&gt;&gt; then stores a null byte (<tt>charT()</tt>) in the
3452   next position, which may be the first position if no characters were
3453   extracted.
3454 </p></blockquote>
3455
3456
3457
3458
3459
3460 <hr>
3461 <h3><a name="69"></a>69. Must elements of a vector be contiguous?</h3>
3462 <p><b>Section:</b> 23.2.6 [vector] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3463  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 1998-07-29</p>
3464 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector">issues</a> in [vector].</p>
3465 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3466 <p><b>Discussion:</b></p>
3467 <p>The issue is this: Must the elements of a vector be in contiguous memory?</p>
3468
3469 <p>(Please note that this is entirely separate from the question of
3470 whether a vector iterator is required to be a pointer; the answer to
3471 that question is clearly "no," as it would rule out
3472 debugging implementations)</p>
3473
3474
3475 <p><b>Proposed resolution:</b></p>
3476 <p>Add the following text to the end of 23.2.6 [vector],
3477 paragraph 1. </p>
3478
3479 <blockquote>
3480   <p>The elements of a vector are stored contiguously, meaning that if
3481   v is a <tt>vector&lt;T, Allocator&gt;</tt> where T is some type
3482   other than <tt>bool</tt>, then it obeys the identity <tt>&amp;v[n]
3483   == &amp;v[0] + n</tt> for all <tt>0 &lt;= n &lt; v.size()</tt>.</p>
3484 </blockquote>
3485
3486
3487 <p><b>Rationale:</b></p>
3488 <p>The LWG feels that as a practical matter the answer is clearly
3489 "yes".  There was considerable discussion as to the best way
3490 to express the concept of "contiguous", which is not
3491 directly defined in the standard.  Discussion included:</p>
3492
3493 <ul>
3494   <li>An operational definition similar to the above proposed resolution is 
3495     already used for valarray (26.5.2.3 [valarray.access]).</li>
3496   <li>There is no need to explicitly consider a user-defined operator&amp; 
3497     because elements must be copyconstructible (23.1 [container.requirements] para 3) 
3498     and copyconstructible (20.1.1 [utility.arg.requirements]) specifies
3499     requirements for operator&amp;.</li>
3500   <li>There is no issue of one-past-the-end because of language rules.</li>
3501 </ul>
3502
3503
3504
3505
3506
3507 <hr>
3508 <h3><a name="70"></a>70. Uncaught_exception() missing throw() specification</h3>
3509 <p><b>Section:</b> 18.7 [support.exception], 18.7.4 [uncaught] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3510  <b>Submitter:</b> Steve Clamage <b>Date:</b> 1998-08-03</p>
3511 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#support.exception">issues</a> in [support.exception].</p>
3512 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3513 <p><b>Discussion:</b></p>
3514 <p>In article 3E04@pratique.fr, Valentin Bonnard writes: </p>
3515
3516 <p>uncaught_exception() doesn't have a throw specification.</p>
3517
3518 <p>It is intentional ? Does it means that one should be prepared to
3519 handle exceptions thrown from uncaught_exception() ?</p>
3520
3521 <p>uncaught_exception() is called in exception handling contexts where
3522 exception safety is very important.</p>
3523
3524
3525 <p><b>Proposed resolution:</b></p>
3526 <p>In 15.5.3 [except.uncaught], paragraph 1, 18.7 [support.exception],
3527 and 18.7.4 [uncaught], add "throw()" to uncaught_exception().</p>
3528
3529
3530
3531
3532 <hr>
3533 <h3><a name="71"></a>71. Do_get_monthname synopsis missing argument</h3>
3534 <p><b>Section:</b> 22.2.5.1 [locale.time.get] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3535  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-08-13</p>
3536 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3537 <p><b>Discussion:</b></p>
3538 <p>The locale facet member <tt>time_get&lt;&gt;::do_get_monthname</tt>
3539 is described in 22.2.5.1.2 [locale.time.get.virtuals] with five arguments,
3540 consistent with do_get_weekday and with its specified use by member
3541 get_monthname. However, in the synopsis, it is specified instead with
3542 four arguments. The missing argument is the "end" iterator
3543 value.</p>
3544
3545
3546 <p><b>Proposed resolution:</b></p>
3547 <p>In 22.2.5.1 [locale.time.get], add an "end" argument to
3548 the declaration of member do_monthname as follows:</p>
3549
3550 <pre>  virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&amp;,
3551                                      ios_base::iostate&amp; err, tm* t) const;</pre>
3552
3553
3554
3555
3556 <hr>
3557 <h3><a name="74"></a>74. Garbled text for <tt>codecvt::do_max_length</tt></h3>
3558 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3559  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-09-08</p>
3560 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
3561 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3562 <p><b>Discussion:</b></p>
3563 <p>The text of <tt>codecvt::do_max_length</tt>'s "Returns"
3564 clause (22.2.1.5.2, paragraph 11) is garbled. It has unbalanced
3565 parentheses and a spurious <b>n</b>.</p>
3566
3567
3568 <p><b>Proposed resolution:</b></p>
3569 <p>Replace 22.2.1.4.2 [locale.codecvt.virtuals] paragraph 11 with the
3570 following:</p>
3571
3572 <blockquote><p>
3573   <b>Returns</b>: The maximum value that
3574   <tt>do_length(state, from, from_end, 1)</tt> can return for any
3575   valid range <tt>[from, from_end)</tt> and <tt>stateT</tt> value
3576   <tt>state</tt>. The specialization <tt>codecvt&lt;char, char,
3577   mbstate_t&gt;::do_max_length()</tt> returns 1.
3578 </p></blockquote>
3579
3580
3581
3582
3583 <hr>
3584 <h3><a name="75"></a>75. Contradiction in <tt>codecvt::length</tt>'s argument types</h3>
3585 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3586  <b>Submitter:</b>  Matt
3587 Austern <b>Date:</b> 1998-09-18</p>
3588 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
3589 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3590 <p><b>Discussion:</b></p>
3591 <p>The class synopses for classes <tt>codecvt&lt;&gt;</tt> (22.2.1.5)
3592 and <tt>codecvt_byname&lt;&gt;</tt> (22.2.1.6) say that the first
3593 parameter of the member functions <tt>length</tt> and
3594 <tt>do_length</tt> is of type <tt>const stateT&amp;</tt>. The member
3595 function descriptions, however (22.2.1.5.1, paragraph 6; 22.2.1.5.2,
3596 paragraph 9) say that the type is <tt>stateT&amp;</tt>.  Either the
3597 synopsis or the summary must be changed. </p>
3598
3599 <p>If (as I believe) the member function descriptions are correct,
3600 then we must also add text saying how <tt>do_length</tt> changes its
3601 <tt>stateT</tt> argument. </p>
3602
3603
3604 <p><b>Proposed resolution:</b></p>
3605 <p>In 22.2.1.4 [locale.codecvt], and also in 22.2.1.5 [locale.codecvt.byname],
3606 change the <tt>stateT</tt> argument type on both member
3607 <tt>length()</tt> and member <tt>do_length()</tt> from </p>
3608
3609 <blockquote>
3610   <p><tt>const stateT&amp;</tt></p>
3611 </blockquote>
3612
3613 <p>to</p>
3614
3615 <blockquote>
3616   <p><tt>stateT&amp;</tt></p>
3617 </blockquote>
3618
3619 <p>In 22.2.1.4.2 [locale.codecvt.virtuals], add to the definition for member
3620 <tt>do_length</tt> a paragraph:</p>
3621
3622 <blockquote>
3623   <p>Effects: The effect on the <tt>state</tt> argument is ``as if''
3624   it called <tt>do_in(state, from, from_end, from, to, to+max,
3625   to)</tt> for <tt>to</tt> pointing to a buffer of at least
3626   <tt>max</tt> elements.</p>
3627 </blockquote>
3628
3629
3630
3631
3632 <hr>
3633 <h3><a name="76"></a>76. Can a <tt>codecvt</tt> facet always convert one internal character at a time?</h3>
3634 <p><b>Section:</b> 22.2.1.4 [locale.codecvt] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
3635  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-09-25</p>
3636 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt">issues</a> in [locale.codecvt].</p>
3637 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
3638 <p><b>Discussion:</b></p>
3639 <p>This issue concerns the requirements on classes derived from
3640 <tt>codecvt</tt>, including user-defined classes. What are the
3641 restrictions on the conversion from external characters
3642 (e.g. <tt>char</tt>) to internal characters (e.g. <tt>wchar_t</tt>)?
3643 Or, alternatively, what assumptions about <tt>codecvt</tt> facets can
3644 the I/O library make? </p>
3645
3646 <p>The question is whether it's possible to convert from internal
3647 characters to external characters one internal character at a time,
3648 and whether, given a valid sequence of external characters, it's
3649 possible to pick off internal characters one at a time. Or, to put it
3650 differently: given a sequence of external characters and the
3651 corresponding sequence of internal characters, does a position in the
3652 internal sequence correspond to some position in the external
3653 sequence? </p>
3654
3655 <p>To make this concrete, suppose that <tt>[first, last)</tt> is a
3656 sequence of <i>M</i> external characters and that <tt>[ifirst,
3657 ilast)</tt> is the corresponding sequence of <i>N</i> internal
3658 characters, where <i>N &gt; 1</i>. That is, <tt>my_encoding.in()</tt>,
3659 applied to <tt>[first, last)</tt>, yields <tt>[ifirst,
3660 ilast)</tt>. Now the question: does there necessarily exist a
3661 subsequence of external characters, <tt>[first, last_1)</tt>, such
3662 that the corresponding sequence of internal characters is the single
3663 character <tt>*ifirst</tt>?
3664 </p>
3665
3666 <p>(What a "no" answer would mean is that
3667 <tt>my_encoding</tt> translates sequences only as blocks. There's a
3668 sequence of <i>M</i> external characters that maps to a sequence of
3669 <i>N</i> internal characters, but that external sequence has no
3670 subsequence that maps to <i>N-1</i> internal characters.) </p>
3671
3672 <p>Some of the wording in the standard, such as the description of
3673 <tt>codecvt::do_max_length</tt> (22.2.1.4.2 [locale.codecvt.virtuals],
3674 paragraph 11) and <tt>basic_filebuf::underflow</tt> (27.8.1.5 [filebuf.virtuals], paragraph 3) suggests that it must always be
3675 possible to pick off internal characters one at a time from a sequence
3676 of external characters. However, this is never explicitly stated one
3677 way or the other. </p>
3678
3679 <p>This issue seems (and is) quite technical, but it is important if
3680 we expect users to provide their own encoding facets. This is an area
3681 where the standard library calls user-supplied code, so a well-defined
3682 set of requirements for the user-supplied code is crucial. Users must
3683 be aware of the assumptions that the library makes. This issue affects
3684 positioning operations on <tt>basic_filebuf</tt>, unbuffered input,
3685 and several of <tt>codecvt</tt>'s member functions. </p>
3686
3687
3688 <p><b>Proposed resolution:</b></p>
3689 <p>Add the following text as a new paragraph, following 22.2.1.4.2 [locale.codecvt.virtuals] paragraph 2:</p>
3690
3691 <blockquote>
3692 <p>A <tt>codecvt</tt> facet that is used by <tt>basic_filebuf</tt>
3693 (27.8 [file.streams]) must have the property that if</p>
3694 <pre>    do_out(state, from, from_end, from_next, to, to_lim, to_next)
3695 </pre>
3696 <p>would return <tt>ok</tt>, where <tt>from != from_end</tt>, then </p>
3697 <pre>    do_out(state, from, from + 1, from_next, to, to_end, to_next)
3698 </pre>
3699 <p>must also return <tt>ok</tt>, and that if</p>
3700 <pre>    do_in(state, from, from_end, from_next, to, to_lim, to_next)
3701 </pre>
3702 <p>would return <tt>ok</tt>, where <tt>to != to_lim</tt>, then</p>
3703 <pre>    do_in(state, from, from_end, from_next, to, to + 1, to_next)
3704 </pre>
3705 <p>must also return <tt>ok</tt>.  [<i>Footnote:</i> Informally, this
3706 means that <tt>basic_filebuf</tt> assumes that the mapping from
3707 internal to external characters is 1 to N: a <tt>codecvt</tt> that is
3708 used by <tt>basic_filebuf</tt> must be able to translate characters
3709 one internal character at a time.  <i>--End Footnote</i>]</p>
3710 </blockquote>
3711
3712 <p><i>[Redmond: Minor change in proposed resolution.  Original
3713 proposed resolution talked about "success", with a parenthetical
3714 comment that success meant returning <tt>ok</tt>.  New wording
3715 removes all talk about "success", and just talks about the
3716 return value.]</i></p>
3717
3718
3719
3720
3721 <p><b>Rationale:</b></p>
3722
3723   <p>The proposed resoluion says that conversions can be performed one
3724   internal character at a time.  This rules out some encodings that
3725   would otherwise be legal.  The alternative answer would mean there
3726   would be some internal positions that do not correspond to any
3727   external file position.</p>
3728   <p>
3729   An example of an encoding that this rules out is one where the
3730   <tt>internT</tt> and <tt>externT</tt> are of the same type, and
3731   where the internal sequence <tt>c1 c2</tt> corresponds to the
3732   external sequence <tt>c2 c1</tt>.
3733   </p>
3734   <p>It was generally agreed that <tt>basic_filebuf</tt> relies
3735   on this property: it was designed under the assumption that
3736   the external-to-internal mapping is N-to-1, and it is not clear
3737   that <tt>basic_filebuf</tt> is implementable without that 
3738   restriction.
3739   </p>
3740   <p>
3741   The proposed resolution is expressed as a restriction on
3742   <tt>codecvt</tt> when used by <tt>basic_filebuf</tt>, rather
3743   than a blanket restriction on all <tt>codecvt</tt> facets,
3744   because <tt>basic_filebuf</tt> is the only other part of the 
3745   library that uses <tt>codecvt</tt>.  If a user wants to define
3746   a <tt>codecvt</tt> facet that implements a more general N-to-M
3747   mapping, there is no reason to prohibit it, so long as the user
3748   does not expect <tt>basic_filebuf</tt> to be able to use it.
3749   </p>
3750
3751
3752
3753
3754
3755 <hr>
3756 <h3><a name="78"></a>78. Typo: event_call_back</h3>
3757 <p><b>Section:</b> 27.4.2 [ios.base] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3758  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3759 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios.base">issues</a> in [ios.base].</p>
3760 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3761 <p><b>Discussion:</b></p>
3762 <p>typo: event_call_back should be event_callback &nbsp; </p>
3763
3764
3765 <p><b>Proposed resolution:</b></p>
3766 <p>In the 27.4.2 [ios.base] synopsis change
3767 "event_call_back" to "event_callback". </p>
3768
3769
3770
3771
3772 <hr>
3773 <h3><a name="79"></a>79. Inconsistent declaration of polar()</h3>
3774 <p><b>Section:</b> 26.3.1 [complex.synopsis], 26.3.7 [complex.value.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3775  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3776 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#complex.synopsis">issues</a> in [complex.synopsis].</p>
3777 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3778 <p><b>Discussion:</b></p>
3779 <p>In 26.3.1 [complex.synopsis] polar is declared as follows:</p>
3780 <pre>   template&lt;class T&gt; complex&lt;T&gt; polar(const T&amp;, const T&amp;); </pre>
3781
3782 <p>In 26.3.7 [complex.value.ops] it is declared as follows:</p>
3783 <pre>   template&lt;class T&gt; complex&lt;T&gt; polar(const T&amp; rho, const T&amp; theta = 0); </pre>
3784
3785 <p>Thus whether the second parameter is optional is not clear. </p>
3786
3787
3788 <p><b>Proposed resolution:</b></p>
3789 <p>In 26.3.1 [complex.synopsis] change:</p>
3790 <pre>   template&lt;class T&gt; complex&lt;T&gt; polar(const T&amp;, const T&amp;);</pre>
3791
3792 <p>to:</p>
3793 <pre>   template&lt;class T&gt; complex&lt;T&gt; polar(const T&amp; rho, const T&amp; theta = 0); </pre>
3794
3795
3796
3797
3798
3799 <hr>
3800 <h3><a name="80"></a>80. Global Operators of complex declared twice</h3>
3801 <p><b>Section:</b> 26.3.1 [complex.synopsis], 26.3.2 [complex] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3802  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3803 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#complex.synopsis">issues</a> in [complex.synopsis].</p>
3804 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3805 <p><b>Discussion:</b></p>
3806 <p>Both 26.2.1 and 26.2.2 contain declarations of global operators for
3807 class complex. This redundancy should be removed.</p>
3808
3809
3810 <p><b>Proposed resolution:</b></p>
3811 <p>Reduce redundancy according to the general style of the standard. </p>
3812
3813
3814
3815
3816 <hr>
3817 <h3><a name="83"></a>83. String::npos vs. string::max_size()</h3>
3818 <p><b>Section:</b> 21.3 [basic.string] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3819  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3820 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
3821 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.string">issues</a> in [basic.string].</p>
3822 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3823 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#89">89</a></p>
3824 <p><b>Discussion:</b></p>
3825 <p>Many string member functions throw if size is getting or exceeding
3826 npos. However, I wonder why they don't throw if size is getting or
3827 exceeding max_size() instead of npos.  May be npos is known at compile
3828 time, while max_size() is known at runtime. However, what happens if
3829 size exceeds max_size() but not npos, then? It seems the standard
3830 lacks some clarifications here.</p>
3831
3832
3833 <p><b>Proposed resolution:</b></p>
3834 <p>After 21.3 [basic.string] paragraph 4 ("The functions
3835 described in this clause...") add a new paragraph:</p>
3836
3837 <blockquote>
3838   <p>For any string operation, if as a result of the operation, <tt> size()</tt> would exceed
3839   <tt> max_size()</tt> then
3840   the operation throws <tt>length_error</tt>.</p>
3841 </blockquote>
3842
3843
3844 <p><b>Rationale:</b></p>
3845 <p>The LWG believes length_error is the correct exception to throw.</p>
3846
3847
3848
3849
3850 <hr>
3851 <h3><a name="86"></a>86. String constructors don't describe exceptions</h3>
3852 <p><b>Section:</b> 21.3.1 [string.require] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3853  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3854 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.require">issues</a> in [string.require].</p>
3855 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3856 <p><b>Discussion:</b></p>
3857 <p>The constructor from a range:</p>
3858
3859 <pre>template&lt;class InputIterator&gt; 
3860          basic_string(InputIterator begin, InputIterator end, 
3861                       const Allocator&amp; a = Allocator());</pre>
3862
3863 <p>lacks a throws clause. However, I would expect that it throws
3864 according to the other constructors if the numbers of characters in
3865 the range equals npos (or exceeds max_size(), see above). </p>
3866
3867
3868 <p><b>Proposed resolution:</b></p>
3869 <p>In 21.3.1 [string.require], Strike throws paragraphs for
3870 constructors which say "Throws: length_error if n ==
3871 npos."</p>
3872
3873
3874 <p><b>Rationale:</b></p>
3875 <p>Throws clauses for length_error if n == npos are no longer needed
3876 because they are subsumed by the general wording added by the
3877 resolution for issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#83">83</a>.</p>
3878
3879
3880
3881
3882 <hr>
3883 <h3><a name="90"></a>90. Incorrect description of operator &gt;&gt; for strings</h3>
3884 <p><b>Section:</b> 21.3.8.9 [string.io] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
3885  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3886 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.io">issues</a> in [string.io].</p>
3887 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
3888 <p><b>Discussion:</b></p>
3889 <p>The effect of operator &gt;&gt; for strings contain the following item:</p>
3890
3891 <p>&nbsp;&nbsp;&nbsp; <tt>isspace(c,getloc())</tt> is true for the next available input
3892 character c.</p>
3893
3894 <p>Here <tt>getloc()</tt> has to be replaced by <tt>is.getloc()</tt>. </p>
3895
3896
3897 <p><b>Proposed resolution:</b></p>
3898 <p>In 21.3.8.9 [string.io] paragraph 1 Effects clause replace:</p>
3899
3900 <blockquote>
3901   <p><tt>isspace(c,getloc())</tt> is true for the next available input character c.</p>
3902 </blockquote>
3903
3904 <p>with:</p>
3905
3906 <blockquote>
3907   <p><tt>isspace(c,is.getloc())</tt> is true for the next available input character c.</p>
3908 </blockquote>
3909
3910
3911
3912
3913
3914 <hr>
3915 <h3><a name="91"></a>91. Description of operator&gt;&gt; and getline() for string&lt;&gt; might cause endless loop</h3>
3916 <p><b>Section:</b> 21.3.8.9 [string.io] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
3917  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3918 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.io">issues</a> in [string.io].</p>
3919 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
3920 <p><b>Discussion:</b></p>
3921 <p>Operator &gt;&gt; and getline() for strings read until eof()
3922 in the input stream is true. However, this might never happen, if the
3923 stream can't read anymore without reaching EOF. So shouldn't it be
3924 changed into that it reads until !good() ? </p>
3925
3926
3927 <p><b>Proposed resolution:</b></p>
3928 <p>In 21.3.8.9 [string.io], paragraph 1, replace:</p>
3929 <blockquote><p>
3930 Effects: Begins by constructing a sentry object k as if k were
3931 constructed by typename basic_istream&lt;charT,traits&gt;::sentry k( is). If
3932 bool( k) is true, it calls str.erase() and then extracts characters
3933 from is and appends them to str as if by calling str.append(1, c). If
3934 is.width() is greater than zero, the maximum number n of characters
3935 appended is is.width(); otherwise n is str.max_size(). Characters are
3936 extracted and appended until any of the following occurs:
3937 </p></blockquote>
3938 <p>with:</p>
3939 <blockquote><p>
3940 Effects: Behaves as a formatted input function (27.6.1.2.1
3941 [istream.formatted.reqmts]). After constructing a sentry object, if the
3942 sentry converts to true, calls str.erase() and then extracts
3943 characters from is and appends them to str as if by calling
3944 str.append(1,c). If is.width() is greater than zero, the maximum
3945 number n of characters appended is is.width(); otherwise n is
3946 str.max_size(). Characters are extracted and appended until any of the
3947 following occurs:
3948 </p></blockquote>
3949
3950 <p>In 21.3.8.9 [string.io], paragraph 6, replace</p>
3951 <blockquote><p>
3952 Effects: Begins by constructing a sentry object k as if by typename
3953 basic_istream&lt;charT,traits&gt;::sentry k( is, true). If bool( k) is true,
3954 it calls str.erase() and then extracts characters from is and appends
3955 them to str as if by calling str.append(1, c) until any of the
3956 following occurs:
3957 </p></blockquote>
3958 <p>with:</p>
3959 <blockquote><p>Effects: Behaves as an unformatted input function
3960 (27.6.1.3 [istream.unformatted]), except that it does not affect the
3961 value returned
3962 by subsequent calls to basic_istream&lt;&gt;::gcount(). After
3963 constructing a sentry object, if the sentry converts to true, calls
3964 str.erase() and then extracts characters from is and appends them to
3965 str as if by calling str.append(1,c) until any of the following
3966 occurs:
3967 </p></blockquote>
3968
3969 <p><i>[Redmond: Made changes in proposed resolution.  <tt>operator&gt;&gt;</tt>
3970 should be a formatted input function, not an unformatted input function.
3971 <tt>getline</tt> should not be required to set <tt>gcount</tt>, since
3972 there is no mechanism for <tt>gcount</tt> to be set except by one of
3973 <tt>basic_istream</tt>'s member functions.]</i></p>
3974
3975
3976 <p><i>[Curaçao: Nico agrees with proposed resolution.]</i></p>
3977
3978
3979
3980
3981 <p><b>Rationale:</b></p>
3982 <p>The real issue here is whether or not these string input functions
3983 get their characters from a streambuf, rather than by calling an
3984 istream's member functions, a streambuf signals failure either by
3985 returning eof or by throwing an exception; there are no other
3986 possibilities.  The proposed resolution makes it clear that these two
3987 functions do get characters from a streambuf.</p>
3988
3989
3990
3991
3992
3993 <hr>
3994 <h3><a name="92"></a>92. Incomplete Algorithm Requirements</h3>
3995 <p><b>Section:</b> 25 [algorithms] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
3996  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 1998-09-29</p>
3997 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#algorithms">issues</a> in [algorithms].</p>
3998 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
3999 <p><b>Discussion:</b></p>
4000 <p>The standard does not state, how often a function object is copied,
4001 called, or the order of calls inside an algorithm. This may lead to
4002 surprising/buggy behavior. Consider the following example: </p>
4003
4004 <pre>class Nth {    // function object that returns true for the nth element 
4005   private: 
4006     int nth;     // element to return true for 
4007     int count;   // element counter 
4008   public: 
4009     Nth (int n) : nth(n), count(0) { 
4010     } 
4011     bool operator() (int) { 
4012         return ++count == nth; 
4013     } 
4014 }; 
4015 .... 
4016 // remove third element 
4017     list&lt;int&gt;::iterator pos; 
4018     pos = remove_if(coll.begin(),coll.end(),  // range 
4019                     Nth(3)),                  // remove criterion 
4020     coll.erase(pos,coll.end()); </pre>
4021
4022 <p>This call, in fact removes the 3rd <b>AND the 6th</b> element. This
4023 happens because the usual implementation of the algorithm copies the
4024 function object internally: </p>
4025
4026 <pre>template &lt;class ForwIter, class Predicate&gt; 
4027 ForwIter std::remove_if(ForwIter beg, ForwIter end, Predicate op) 
4028
4029     beg = find_if(beg, end, op); 
4030     if (beg == end) { 
4031         return beg; 
4032     } 
4033     else { 
4034         ForwIter next = beg; 
4035         return remove_copy_if(++next, end, beg, op); 
4036     } 
4037 } </pre>
4038
4039 <p>The algorithm uses find_if() to find the first element that should
4040 be removed. However, it then uses a copy of the passed function object
4041 to process the resulting elements (if any). Here, Nth is used again
4042 and removes also the sixth element. This behavior compromises the
4043 advantage of function objects being able to have a state. Without any
4044 cost it could be avoided (just implement it directly instead of
4045 calling find_if()). </p>
4046
4047
4048 <p><b>Proposed resolution:</b></p>
4049
4050 <p>Add a new paragraph following 25 [algorithms] paragraph 8:</p>
4051 <blockquote><p>
4052 [Note: Unless otherwise specified, algorithms that take function
4053 objects as arguments are permitted to copy those function objects
4054 freely.  Programmers for whom object identity is important should
4055 consider using a wrapper class that points to a noncopied
4056 implementation object, or some equivalent solution.]
4057 </p></blockquote>
4058
4059 <p><i>[Dublin: Pete Becker felt that this may not be a defect,
4060 but rather something that programmers need to be educated about.
4061 There was discussion of adding wording to the effect that the number
4062 and order of calls to function objects, including predicates, not
4063 affect the behavior of the function object.]</i></p>
4064
4065
4066 <p><i>[Pre-Kona: Nico comments: It seems the problem is that we don't
4067 have a clear statement of "predicate" in the
4068 standard. People including me seemed to think "a function
4069 returning a Boolean value and being able to be called by an STL
4070 algorithm or be used as sorting criterion or ... is a
4071 predicate". But a predicate has more requirements: It should
4072 never change its behavior due to a call or being copied. IMHO we have
4073 to state this in the standard. If you like, see section 8.1.4 of my
4074 library book for a detailed discussion.]</i></p>
4075
4076
4077 <p><i>[Kona: Nico will provide wording to the effect that "unless
4078 otherwise specified, the number of copies of and calls to function
4079 objects by algorithms is unspecified".&nbsp; Consider placing in
4080 25 [algorithms] after paragraph 9.]</i></p>
4081
4082
4083 <p><i>[Santa Cruz: The standard doesn't currently guarantee that
4084   functions object won't be copied, and what isn't forbidden is
4085   allowed.  It is believed (especially since implementations that were
4086   written in concert with the standard do make copies of function
4087   objects) that this was intentional.  Thus, no normative change is
4088   needed.  What we should put in is a non-normative note suggesting to
4089   programmers that if they want to guarantee the lack of copying they
4090   should use something like the <tt>ref</tt> wrapper.]</i></p>
4091
4092
4093 <p><i>[Oxford: Matt provided wording.]</i></p>
4094
4095
4096
4097
4098
4099
4100
4101
4102 <hr>
4103 <h3><a name="98"></a>98. Input iterator requirements are badly written</h3>
4104 <p><b>Section:</b> 24.1.1 [input.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4105  <b>Submitter:</b> AFNOR <b>Date:</b> 1998-10-07</p>
4106 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#input.iterators">issues</a> in [input.iterators].</p>
4107 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4108 <p><b>Discussion:</b></p>
4109 <p>Table 72 in 24.1.1 [input.iterators] specifies semantics for
4110 <tt>*r++</tt> of:</p>
4111
4112 <p>&nbsp;&nbsp; <tt>{ T tmp = *r; ++r; return tmp; }</tt></p>
4113
4114 <p>There are two problems with this.  First, the return type is
4115 specified to be "T", as opposed to something like "convertible to T".
4116 This is too specific: we want to allow *r++ to return an lvalue.</p>
4117
4118 <p>Second, writing the semantics in terms of code misleadingly
4119 suggests that the effects *r++ should precisely replicate the behavior
4120 of this code, including side effects.  (Does this mean that *r++
4121 should invoke the copy constructor exactly as many times as the sample
4122 code above would?) See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#334">334</a> for a similar
4123 problem.</p>
4124
4125
4126
4127 <p><b>Proposed resolution:</b></p>
4128 <p>In Table 72 in 24.1.1 [input.iterators], change the return type
4129 for <tt>*r++</tt> from <tt>T</tt> to "convertible to T".</p>
4130
4131
4132 <p><b>Rationale:</b></p>
4133 <p>This issue has two parts: the return type, and the number of times
4134   the copy constructor is invoked.</p>
4135
4136 <p>The LWG believes the the first part is a real issue.  It's
4137   inappropriate for the return type to be specified so much more
4138   precisely for *r++ than it is for *r.  In particular, if r is of
4139   (say) type <tt>int*</tt>, then *r++ isn't <tt>int</tt>,
4140   but <tt>int&amp;</tt>.</p>
4141
4142 <p>The LWG does not believe that the number of times the copy
4143   constructor is invoked is a real issue.  This can vary in any case,
4144   because of language rules on copy constructor elision.  That's too
4145   much to read into these semantics clauses.</p>
4146
4147 <p>Additionally, as Dave Abrahams pointed out (c++std-lib-13703): since 
4148    we're told (24.1/3) that forward iterators satisfy all the requirements
4149    of input iterators, we can't impose any requirements in the Input
4150    Iterator requirements table that forward iterators don't satisfy.</p>
4151
4152
4153
4154
4155
4156 <hr>
4157 <h3><a name="103"></a>103. set::iterator is required to be modifiable, but this allows modification of keys</h3>
4158 <p><b>Section:</b> 23.1.4 [associative.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4159  <b>Submitter:</b> AFNOR <b>Date:</b> 1998-10-07</p>
4160 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
4161 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4162 <p><b>Discussion:</b></p>
4163 <p>Set::iterator is described as implementation-defined with a
4164 reference to the container requirement; the container requirement says
4165 that const_iterator is an iterator pointing to const T and iterator an
4166 iterator pointing to T.</p>
4167
4168 <p>23.1.2 paragraph 2 implies that the keys should not be modified to
4169 break the ordering of elements. But that is not clearly
4170 specified. Especially considering that the current standard requires
4171 that iterator for associative containers be different from
4172 const_iterator. Set, for example, has the following: </p>
4173
4174 <p><tt>typedef implementation defined iterator;<br>
4175 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // See _lib.container.requirements_</tt></p>
4176
4177 <p>23.1 [container.requirements] actually requires that iterator type pointing
4178 to T (table 65). Disallowing user modification of keys by changing the
4179 standard to require an iterator for associative container to be the
4180 same as const_iterator would be overkill since that will unnecessarily
4181 significantly restrict the usage of associative container. A class to
4182 be used as elements of set, for example, can no longer be modified
4183 easily without either redesigning the class (using mutable on fields
4184 that have nothing to do with ordering), or using const_cast, which
4185 defeats requiring iterator to be const_iterator. The proposed solution
4186 goes in line with trusting user knows what he is doing. </p>
4187
4188 <p><b>Other Options Evaluated:</b> </p>
4189
4190 <p>Option A.&nbsp;&nbsp; In 23.1.4 [associative.reqmts], paragraph 2, after
4191 first sentence, and before "In addition,...", add one line:
4192 </p>
4193
4194 <blockquote>
4195   <p>Modification of keys shall not change their strict weak ordering. </p>
4196 </blockquote>
4197
4198 <p>Option B.&nbsp;Add three new sentences to 23.1.4 [associative.reqmts]:</p>
4199
4200 <blockquote>
4201   <p>At the end of paragraph 5: "Keys in an associative container
4202   are immutable." At the end of paragraph 6: "For
4203   associative containers where the value type is the same as the key
4204   type, both <tt>iterator</tt> and <tt>const_iterator</tt> are
4205   constant iterators. It is unspecified whether or not
4206   <tt>iterator</tt> and <tt>const_iterator</tt> are the same
4207   type."</p>
4208 </blockquote>
4209
4210 <p>Option C.&nbsp;To 23.1.4 [associative.reqmts], paragraph 3, which
4211 currently reads:</p>
4212
4213 <blockquote>
4214   <p>The phrase ``equivalence of keys'' means the equivalence relation imposed by the
4215   comparison and not the operator== on keys. That is, two keys k1 and k2 in the same
4216   container are considered to be equivalent if for the comparison object comp, comp(k1, k2)
4217   == false &amp;&amp; comp(k2, k1) == false.</p>
4218 </blockquote>
4219
4220 <p>&nbsp; add the following:</p>
4221
4222 <blockquote>
4223   <p>For any two keys k1 and k2 in the same container, comp(k1, k2) shall return the same
4224   value whenever it is evaluated. [Note: If k2 is removed from the container and later
4225   reinserted, comp(k1, k2) must still return a consistent value but this value may be
4226   different than it was the first time k1 and k2 were in the same container. This is
4227   intended to allow usage like a string key that contains a filename, where comp compares
4228   file contents; if k2 is removed, the file is changed, and the same k2 (filename) is
4229   reinserted, comp(k1, k2) must again return a consistent value but this value may be
4230   different than it was the previous time k2 was in the container.]</p>
4231 </blockquote>
4232
4233
4234
4235 <p><b>Proposed resolution:</b></p>
4236 <p>Add the following to 23.1.4 [associative.reqmts] at
4237 the indicated location:</p>
4238
4239 <blockquote>
4240   <p>At the end of paragraph 3: "For any two keys k1 and k2 in the same container,
4241   calling comp(k1, k2) shall always return the same
4242   value."</p>
4243   <p>At the end of paragraph 5: "Keys in an associative container are immutable."</p>
4244   <p>At the end of paragraph 6: "For associative containers where the value type is the
4245   same as the key type, both <tt>iterator</tt> and <tt>const_iterator</tt> are constant
4246   iterators. It is unspecified whether or not <tt>iterator</tt> and <tt>const_iterator</tt>
4247   are the same type."</p>
4248 </blockquote>
4249
4250
4251 <p><b>Rationale:</b></p>
4252 <p>Several arguments were advanced for and against allowing set elements to be
4253 mutable as long as the ordering was not effected. The argument which swayed the
4254 LWG was one of safety; if elements were mutable, there would be no compile-time
4255 way to detect of a simple user oversight which caused ordering to be
4256 modified.  There was a report that this had actually happened in practice,
4257 and had been painful to diagnose.  If users need to modify elements,
4258 it is possible to use mutable members or const_cast.</p>
4259
4260 <p>Simply requiring that keys be immutable is not sufficient, because the comparison
4261 object may indirectly (via pointers) operate on values outside of the keys.</p>
4262
4263 <p>
4264 The types <tt>iterator</tt> and <tt>const_iterator</tt> are permitted
4265 to be different types to allow for potential future work in which some
4266 member functions might be overloaded between the two types.  No such
4267 member functions exist now, and the LWG believes that user functionality
4268 will not be impaired by permitting the two types to be the same.  A
4269 function that operates on both iterator types can be defined for 
4270 <tt>const_iterator</tt> alone, and can rely on the automatic
4271 conversion from <tt>iterator</tt> to <tt>const_iterator</tt>.
4272 </p>
4273
4274 <p><i>[Tokyo: The LWG crafted the proposed resolution and rationale.]</i></p>
4275
4276
4277
4278
4279
4280
4281 <hr>
4282 <h3><a name="106"></a>106. Numeric library private members are implementation defined</h3>
4283 <p><b>Section:</b> 26.5.5 [template.slice.array] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4284  <b>Submitter:</b> AFNOR <b>Date:</b> 1998-10-07</p>
4285 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#template.slice.array">issues</a> in [template.slice.array].</p>
4286 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4287 <p><b>Discussion:</b></p>
4288 <p>This is the only place in the whole standard where the implementation has to document
4289 something private.</p>
4290
4291
4292 <p><b>Proposed resolution:</b></p>
4293 <p>
4294 Remove the comment which says "// remainder implementation defined" from:
4295 </p>
4296
4297 <ul>
4298   <li>26.5.5 [template.slice.array]</li>
4299   <li>26.5.7 [template.gslice.array]</li>
4300   <li>26.5.8 [template.mask.array]</li>
4301   <li>26.5.9 [template.indirect.array]</li>
4302 </ul>
4303
4304
4305
4306
4307
4308 <hr>
4309 <h3><a name="108"></a>108. Lifetime of exception::what() return unspecified</h3>
4310 <p><b>Section:</b> 18.6.1 [type.info] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4311  <b>Submitter:</b> AFNOR <b>Date:</b> 1998-10-07</p>
4312 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#type.info">issues</a> in [type.info].</p>
4313 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4314 <p><b>Discussion:</b></p>
4315 <p>In 18.6.1, paragraphs 8-9, the lifetime of the return value of
4316 exception::what() is left unspecified. This issue has implications
4317 with exception safety of exception handling: some exceptions should
4318 not throw bad_alloc.</p>
4319
4320
4321 <p><b>Proposed resolution:</b></p>
4322 <p>Add to 18.6.1 [type.info] paragraph 9 (exception::what notes
4323 clause) the sentence:</p>
4324
4325 <blockquote>
4326   <p>The return value remains valid until the exception object from which it is obtained is
4327   destroyed or a non-const member function of the exception object is called.</p>
4328 </blockquote>
4329
4330
4331 <p><b>Rationale:</b></p>
4332 <p>If an exception object has non-const members, they may be used
4333 to set internal state that should affect the contents of the string
4334 returned by <tt>what()</tt>.
4335 </p>
4336
4337
4338
4339
4340
4341 <hr>
4342 <h3><a name="109"></a>109. Missing binders for non-const sequence elements</h3>
4343 <p><b>Section:</b> D.8 [depr.lib.binders] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4344  <b>Submitter:</b> Bjarne Stroustrup <b>Date:</b> 1998-10-07</p>
4345 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.lib.binders">issues</a> in [depr.lib.binders].</p>
4346 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4347 <p><b>Discussion:</b></p>
4348
4349 <p>There are no versions of binders that apply to non-const elements
4350 of a sequence. This makes examples like for_each() using bind2nd() on
4351 page 521 of "The C++ Programming Language (3rd)"
4352 non-conforming. Suitable versions of the binders need to be added.</p>
4353
4354 <p>Further discussion from Nico:</p>
4355
4356 <p>What is probably meant here is shown in the following example:</p>
4357
4358 <pre>class Elem { 
4359   public: 
4360     void print (int i) const { } 
4361     void modify (int i) { } 
4362 }; </pre>
4363 <pre>int main() 
4364
4365     vector&lt;Elem&gt; coll(2); 
4366     for_each (coll.begin(), coll.end(), bind2nd(mem_fun_ref(&amp;Elem::print),42));    // OK 
4367     for_each (coll.begin(), coll.end(), bind2nd(mem_fun_ref(&amp;Elem::modify),42));   // ERROR 
4368 }</pre>
4369
4370 <p>The error results from the fact that bind2nd() passes its first
4371 argument (the argument of the sequence) as constant reference. See the
4372 following typical implementation:</p>
4373
4374 <blockquote>
4375   <pre>template &lt;class Operation&gt; 
4376 class binder2nd 
4377   : public unary_function&lt;typename Operation::first_argument_type, 
4378                           typename Operation::result_type&gt; { 
4379 protected: 
4380   Operation op; 
4381   typename Operation::second_argument_type value; 
4382 public: 
4383   binder2nd(const Operation&amp; o, 
4384             const typename Operation::second_argument_type&amp; v) 
4385       : op(o), value(v) {} </pre>
4386   <pre> typename Operation::result_type 
4387   operator()(const typename Operation::first_argument_type&amp; x) const { 
4388     return op(x, value); 
4389   } 
4390 };</pre>
4391 </blockquote>
4392
4393 <p>The solution is to overload operator () of bind2nd for non-constant arguments:</p>
4394
4395 <blockquote>
4396   <pre>template &lt;class Operation&gt; 
4397 class binder2nd 
4398   : public unary_function&lt;typename Operation::first_argument_type, 
4399                           typename Operation::result_type&gt; { 
4400 protected: 
4401   Operation op; 
4402   typename Operation::second_argument_type value; 
4403 public: 
4404   binder2nd(const Operation&amp; o, 
4405             const typename Operation::second_argument_type&amp; v) 
4406       : op(o), value(v) {} </pre>
4407   <pre> typename Operation::result_type 
4408   operator()(const typename Operation::first_argument_type&amp; x) const { 
4409     return op(x, value); 
4410   } 
4411   typename Operation::result_type 
4412   operator()(typename Operation::first_argument_type&amp; x) const { 
4413     return op(x, value); 
4414   } 
4415 };</pre>
4416 </blockquote>
4417
4418
4419 <p><b>Proposed resolution:</b></p>
4420
4421 <p><b>Howard believes there is a flaw</b> in this resolution.
4422 See c++std-lib-9127.  We may need to reopen this issue.</p>
4423
4424 <p>In D.8 [depr.lib.binders] in the declaration of binder1st after:</p>
4425 <blockquote>
4426   <p><tt>typename Operation::result_type<br>
4427   &nbsp;operator()(const typename Operation::second_argument_type&amp; x) const;</tt></p>
4428 </blockquote>
4429 <p>insert:</p>
4430 <blockquote>
4431   <p><tt>typename Operation::result_type<br>
4432   &nbsp;operator()(typename Operation::second_argument_type&amp; x) const;</tt></p>
4433 </blockquote>
4434 <p>In D.8 [depr.lib.binders] in the declaration of binder2nd after:</p>
4435 <blockquote>
4436   <p><tt>typename Operation::result_type<br>
4437   &nbsp;operator()(const typename Operation::first_argument_type&amp; x) const;</tt></p>
4438 </blockquote>
4439 <p>insert:</p>
4440 <blockquote>
4441   <p><tt>typename Operation::result_type<br>
4442   &nbsp;operator()(typename Operation::first_argument_type&amp; x) const;</tt></p>
4443 </blockquote>
4444
4445 <p><i>[Kona: The LWG discussed this at some length.It was agreed that
4446 this is a mistake in the design, but there was no consensus on whether
4447 it was a defect in the Standard.  Straw vote: NAD - 5.  Accept
4448 proposed resolution - 3.  Leave open - 6.]</i></p>
4449
4450
4451 <p><i>[Copenhagen: It was generally agreed that this was a defect.
4452 Strap poll: NAD - 0.  Accept proposed resolution - 10. 
4453 Leave open - 1.]</i></p>
4454
4455
4456
4457
4458
4459
4460
4461 <hr>
4462 <h3><a name="110"></a>110. istreambuf_iterator::equal not const</h3>
4463 <p><b>Section:</b> 24.5.3 [istreambuf.iterator], 24.5.3.5 [istreambuf.iterator::equal] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4464  <b>Submitter:</b> Nathan Myers <b>Date:</b> 1998-10-15</p>
4465 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istreambuf.iterator">issues</a> in [istreambuf.iterator].</p>
4466 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4467 <p><b>Discussion:</b></p>
4468 <p>Member istreambuf_iterator&lt;&gt;::equal is not declared
4469 "const", yet 24.5.3.6 [istreambuf.iterator::op==] says that operator==,
4470 which is const, calls it. This is contradictory. </p>
4471
4472
4473 <p><b>Proposed resolution:</b></p>
4474 <p>In 24.5.3 [istreambuf.iterator] and also in 24.5.3.5 [istreambuf.iterator::equal],
4475 replace:</p>
4476
4477 <blockquote>
4478   <pre>bool equal(istreambuf_iterator&amp; b);</pre>
4479 </blockquote>
4480
4481 <p>with:</p>
4482
4483 <blockquote>
4484   <pre>bool equal(const istreambuf_iterator&amp; b) const;</pre>
4485 </blockquote>
4486
4487
4488
4489
4490
4491 <hr>
4492 <h3><a name="112"></a>112. Minor typo in <tt>ostreambuf_iterator</tt> constructor</h3>
4493 <p><b>Section:</b> 24.5.4.1 [ostreambuf.iter.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4494  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-10-20</p>
4495 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4496 <p><b>Discussion:</b></p>
4497 <p>The <b>requires</b> clause for <tt>ostreambuf_iterator</tt>'s
4498 constructor from an <tt>ostream_type</tt> (24.5.4.1, paragraph 1)
4499 reads "<i>s</i> is not null". However, <i>s</i> is a
4500 reference, and references can't be null. </p>
4501
4502
4503 <p><b>Proposed resolution:</b></p>
4504 <p>In 24.5.4.1 [ostreambuf.iter.cons]:</p>
4505
4506 <p>Move the current paragraph 1, which reads "Requires: s is not
4507 null.", from the first constructor to the second constructor.</p>
4508
4509 <p>Insert a new paragraph 1 Requires clause for the first constructor
4510 reading:</p>
4511
4512 <blockquote>
4513   <p><b>Requires</b>: <tt>s.rdbuf()</tt> is not null.</p>
4514 </blockquote>
4515
4516
4517
4518
4519
4520 <hr>
4521 <h3><a name="114"></a>114. Placement forms example in error twice</h3>
4522 <p><b>Section:</b> 18.5.1.3 [new.delete.placement] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4523  <b>Submitter:</b> Steve Clamage <b>Date:</b> 1998-10-28</p>
4524 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#new.delete.placement">issues</a> in [new.delete.placement].</p>
4525 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4526 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#196">196</a></p>
4527 <p><b>Discussion:</b></p>
4528 <p>Section 18.5.1.3 contains the following example: </p>
4529
4530 <pre>[Example: This can be useful for constructing an object at a known address:
4531         char place[sizeof(Something)];
4532         Something* p = new (place) Something();
4533  -end example]</pre>
4534
4535 <p>First code line: "place" need not have any special alignment, and the
4536 following constructor could fail due to misaligned data.</p>
4537
4538 <p>Second code line: Aren't the parens on Something() incorrect?&nbsp; [Dublin: the LWG
4539 believes the () are correct.]</p>
4540
4541 <p>Examples are not normative, but nevertheless should not show code that is invalid or
4542 likely to fail.</p>
4543
4544
4545 <p><b>Proposed resolution:</b></p>
4546 <p>Replace the first line of code in the example in 
4547 18.5.1.3 [new.delete.placement] with:
4548 </p>
4549
4550 <blockquote>
4551   <pre>void* place = operator new(sizeof(Something));</pre>
4552 </blockquote>
4553
4554
4555
4556
4557
4558 <hr>
4559 <h3><a name="115"></a>115. Typo in strstream constructors</h3>
4560 <p><b>Section:</b> D.7.4.1 [depr.strstream.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4561  <b>Submitter:</b> Steve Clamage <b>Date:</b> 1998-11-02</p>
4562 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4563 <p><b>Discussion:</b></p>
4564 <p>D.7.4.1 strstream constructors paragraph 2 says: </p>
4565
4566 <blockquote>
4567   <p>Effects: Constructs an object of class strstream, initializing the base class with
4568   iostream(&amp; sb) and initializing sb with one of the two constructors: </p>
4569   <p>- If mode&amp;app==0, then s shall designate the first element of an array of n
4570   elements. The constructor is strstreambuf(s, n, s). </p>
4571   <p>- If mode&amp;app==0, then s shall designate the first element of an array of n
4572   elements that contains an NTBS whose first element is designated by s. The constructor is
4573   strstreambuf(s, n, s+std::strlen(s)).</p>
4574 </blockquote>
4575
4576 <p>Notice the second condition is the same as the first. I think the second condition
4577 should be "If mode&amp;app==app", or "mode&amp;app!=0", meaning that
4578 the append bit is set.</p>
4579
4580
4581 <p><b>Proposed resolution:</b></p>
4582 <p>In D.7.3.1 [depr.ostrstream.cons] paragraph 2 and D.7.4.1 [depr.strstream.cons]
4583 paragraph 2, change the first condition to <tt>(mode&amp;app)==0</tt>
4584 and the second condition to <tt>(mode&amp;app)!=0</tt>.</p>
4585
4586
4587
4588
4589
4590 <hr>
4591 <h3><a name="117"></a>117. <tt>basic_ostream</tt> uses nonexistent <tt>num_put</tt> member functions</h3>
4592 <p><b>Section:</b> 27.6.2.6.2 [ostream.inserters.arithmetic] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4593  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-11-20</p>
4594 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.inserters.arithmetic">issues</a> in [ostream.inserters.arithmetic].</p>
4595 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4596 <p><b>Discussion:</b></p>
4597 <p>The <b>effects</b> clause for numeric inserters says that
4598 insertion of a value <tt>x</tt>, whose type is either <tt>bool</tt>,
4599 <tt>short</tt>, <tt>unsigned short</tt>, <tt>int</tt>, <tt>unsigned
4600 int</tt>, <tt>long</tt>, <tt>unsigned long</tt>, <tt>float</tt>,
4601 <tt>double</tt>, <tt>long double</tt>, or <tt>const void*</tt>, is
4602 delegated to <tt>num_put</tt>, and that insertion is performed as if
4603 through the following code fragment: </p>
4604
4605 <pre>bool failed = use_facet&lt;
4606    num_put&lt;charT,ostreambuf_iterator&lt;charT,traits&gt; &gt; 
4607    &gt;(getloc()).put(*this, *this, fill(), val). failed();</pre>
4608
4609 <p>This doesn't work, because <tt>num_put&lt;&gt;</tt>::put is only
4610 overloaded for the types <tt>bool</tt>, <tt>long</tt>, <tt>unsigned
4611 long</tt>, <tt>double</tt>, <tt>long double</tt>, and <tt>const
4612 void*</tt>. That is, the code fragment in the standard is incorrect
4613 (it is diagnosed as ambiguous at compile time) for the types
4614 <tt>short</tt>, <tt>unsigned short</tt>, <tt>int</tt>, <tt>unsigned
4615 int</tt>, and <tt>float</tt>. </p>
4616
4617 <p>We must either add new member functions to <tt>num_put</tt>, or
4618 else change the description in <tt>ostream</tt> so that it only calls
4619 functions that are actually there. I prefer the latter. </p>
4620
4621
4622 <p><b>Proposed resolution:</b></p>
4623 <p>Replace 27.6.2.5.2, paragraph 1 with the following: </p>
4624
4625 <blockquote>
4626 <p>
4627 The classes num_get&lt;&gt; and num_put&lt;&gt; handle locale-dependent numeric
4628 formatting and parsing.  These inserter functions use the imbued
4629 locale value to perform numeric formatting.  When val is of type bool,
4630 long, unsigned long, double, long double, or const void*, the
4631 formatting conversion occurs as if it performed the following code
4632 fragment:
4633 </p>
4634
4635 <pre>bool failed = use_facet&lt;
4636    num_put&lt;charT,ostreambuf_iterator&lt;charT,traits&gt; &gt;
4637    &gt;(getloc()).put(*this, *this, fill(), val). failed();
4638 </pre>
4639
4640 <p>
4641 When val is of type short the formatting conversion occurs as if it
4642 performed the following code fragment:
4643 </p>
4644
4645 <pre>ios_base::fmtflags baseflags = ios_base::flags() &amp; ios_base::basefield;
4646 bool failed = use_facet&lt;
4647    num_put&lt;charT,ostreambuf_iterator&lt;charT,traits&gt; &gt;
4648    &gt;(getloc()).put(*this, *this, fill(),
4649       baseflags == ios_base::oct || baseflags == ios_base::hex
4650          ? static_cast&lt;long&gt;(static_cast&lt;unsigned short&gt;(val))
4651          : static_cast&lt;long&gt;(val)). failed();
4652 </pre>
4653
4654 <p>
4655 When val is of type int the formatting conversion occurs as if it performed
4656 the following code fragment:
4657 </p>
4658
4659 <pre>ios_base::fmtflags baseflags = ios_base::flags() &amp; ios_base::basefield;
4660 bool failed = use_facet&lt;
4661    num_put&lt;charT,ostreambuf_iterator&lt;charT,traits&gt; &gt;
4662    &gt;(getloc()).put(*this, *this, fill(),
4663       baseflags == ios_base::oct || baseflags == ios_base::hex
4664          ? static_cast&lt;long&gt;(static_cast&lt;unsigned int&gt;(val))
4665          : static_cast&lt;long&gt;(val)). failed();
4666 </pre>
4667
4668 <p>
4669 When val is of type unsigned short or unsigned int the formatting conversion
4670 occurs as if it performed the following code fragment:
4671 </p>
4672
4673 <pre>bool failed = use_facet&lt;
4674    num_put&lt;charT,ostreambuf_iterator&lt;charT,traits&gt; &gt;
4675    &gt;(getloc()).put(*this, *this, fill(), static_cast&lt;unsigned long&gt;(val)).
4676 failed();
4677 </pre>
4678
4679 <p>
4680 When val is of type float the formatting conversion occurs as if it
4681 performed the following code fragment:
4682 </p>
4683
4684 <pre>bool failed = use_facet&lt;
4685    num_put&lt;charT,ostreambuf_iterator&lt;charT,traits&gt; &gt;
4686    &gt;(getloc()).put(*this, *this, fill(), static_cast&lt;double&gt;(val)).
4687 failed();
4688 </pre>
4689
4690 </blockquote>
4691
4692 <p><i>[post-Toronto: This differs from the previous proposed
4693 resolution; PJP provided the new wording.  The differences are in
4694 signed short and int output.]</i></p>
4695
4696
4697
4698 <p><b>Rationale:</b></p>
4699 <p>The original proposed resolution was to cast int and short to long,
4700 unsigned int and unsigned short to unsigned long, and float to double,
4701 thus ensuring that we don't try to use nonexistent num_put&lt;&gt;
4702 member functions.  The current proposed resolution is more
4703 complicated, but gives more expected results for hex and octal output
4704 of signed short and signed int.  (On a system with 16-bit short, for
4705 example, printing short(-1) in hex format should yield 0xffff.)</p>
4706
4707
4708
4709
4710
4711 <hr>
4712 <h3><a name="118"></a>118. <tt>basic_istream</tt> uses nonexistent <tt>num_get</tt> member functions</h3>
4713 <p><b>Section:</b> 27.6.1.2.2 [istream.formatted.arithmetic] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4714  <b>Submitter:</b> Matt Austern <b>Date:</b> 1998-11-20</p>
4715 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.formatted.arithmetic">issues</a> in [istream.formatted.arithmetic].</p>
4716 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4717 <p><b>Discussion:</b></p>
4718 <p>Formatted input is defined for the types <tt>short</tt>, <tt>unsigned short</tt>, <tt>int</tt>,
4719 <tt>unsigned int</tt>, <tt>long</tt>, <tt>unsigned long</tt>, <tt>float</tt>, <tt>double</tt>,
4720 <tt>long double</tt>, <tt>bool</tt>, and <tt>void*</tt>. According to section 27.6.1.2.2,
4721 formatted input of a value <tt>x</tt> is done as if by the following code fragment: </p>
4722
4723 <pre>typedef num_get&lt; charT,istreambuf_iterator&lt;charT,traits&gt; &gt; numget; 
4724 iostate err = 0; 
4725 use_facet&lt; numget &gt;(loc).get(*this, 0, *this, err, val); 
4726 setstate(err);</pre>
4727
4728 <p>According to section 22.2.2.1.1 [facet.num.get.members], however,
4729 <tt>num_get&lt;&gt;::get()</tt> is only overloaded for the types
4730 <tt>bool</tt>, <tt>long</tt>, <tt>unsigned short</tt>, <tt>unsigned
4731 int</tt>, <tt>unsigned long</tt>, <tt>unsigned long</tt>,
4732 <tt>float</tt>, <tt>double</tt>, <tt>long double</tt>, and
4733 <tt>void*</tt>. Comparing the lists from the two sections, we find
4734 that 27.6.1.2.2 is using a nonexistent function for types
4735 <tt>short</tt> and <tt>int</tt>. </p>
4736
4737
4738 <p><b>Proposed resolution:</b></p>
4739 <p>In 27.6.1.2.2 [istream.formatted.arithmetic] Arithmetic Extractors, remove the
4740 two lines (1st and 3rd) which read:</p>
4741 <blockquote>
4742   <pre>operator&gt;&gt;(short&amp; val);
4743 ...
4744 operator&gt;&gt;(int&amp; val);</pre>
4745 </blockquote>
4746
4747 <p>And add the following at the end of that section (27.6.1.2.2) :</p>
4748
4749 <blockquote>
4750   <pre>operator&gt;&gt;(short&amp; val);</pre>
4751   <p>The conversion occurs as if performed by the following code fragment (using
4752   the same notation as for the preceding code fragment):</p>
4753   <pre>  typedef num_get&lt; charT,istreambuf_iterator&lt;charT,traits&gt; &gt; numget;
4754   iostate err = 0;
4755   long lval;
4756   use_facet&lt; numget &gt;(loc).get(*this, 0, *this, err, lval);
4757         if (err == 0
4758                 &amp;&amp; (lval &lt; numeric_limits&lt;short&gt;::min() || numeric_limits&lt;short&gt;::max() &lt; lval))
4759                 err = ios_base::failbit;
4760   setstate(err);</pre>
4761   <pre>operator&gt;&gt;(int&amp; val);</pre>
4762   <p>The conversion occurs as if performed by the following code fragment (using
4763   the same notation as for the preceding code fragment):</p>
4764   <pre>  typedef num_get&lt; charT,istreambuf_iterator&lt;charT,traits&gt; &gt; numget;
4765   iostate err = 0;
4766   long lval;
4767   use_facet&lt; numget &gt;(loc).get(*this, 0, *this, err, lval);
4768         if (err == 0
4769                 &amp;&amp; (lval &lt; numeric_limits&lt;int&gt;::min() || numeric_limits&lt;int&gt;::max() &lt; lval))
4770                 err = ios_base::failbit;
4771   setstate(err);</pre>
4772 </blockquote>
4773
4774 <p><i>[Post-Tokyo: PJP provided the above wording.]</i></p>
4775
4776
4777
4778
4779
4780
4781 <hr>
4782 <h3><a name="119"></a>119. Should virtual functions be allowed to strengthen the exception specification?</h3>
4783 <p><b>Section:</b> 17.4.4.9 [res.on.exception.handling] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4784  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
4785 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#res.on.exception.handling">issues</a> in [res.on.exception.handling].</p>
4786 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4787 <p><b>Discussion:</b></p>
4788 <p>Section 17.4.4.9 [res.on.exception.handling] states: </p>
4789
4790 <p>"An implementation may strengthen the exception-specification
4791 for a function by removing listed exceptions." </p>
4792
4793 <p>The problem is that if an implementation is allowed to do this for
4794 virtual functions, then a library user cannot write a class that
4795 portably derives from that class. </p>
4796
4797 <p>For example, this would not compile if ios_base::failure::~failure
4798 had an empty exception specification: </p>
4799
4800 <pre>#include &lt;ios&gt;
4801 #include &lt;string&gt;
4802
4803 class D : public std::ios_base::failure {
4804 public:
4805         D(const std::string&amp;);
4806         ~D(); // error - exception specification must be compatible with 
4807               // overridden virtual function ios_base::failure::~failure()
4808 };</pre>
4809
4810
4811 <p><b>Proposed resolution:</b></p>
4812 <p>Change Section 17.4.4.9 [res.on.exception.handling] from:</p>
4813
4814 <p>&nbsp;&nbsp;&nbsp;&nbsp; "may strengthen the
4815 exception-specification for a function"</p>
4816
4817 <p>to:</p>
4818
4819 <p>&nbsp;&nbsp;&nbsp;&nbsp; "may strengthen the
4820 exception-specification for a non-virtual function". </p>
4821
4822
4823
4824
4825
4826 <hr>
4827 <h3><a name="120"></a>120. Can an implementor add specializations?</h3>
4828 <p><b>Section:</b> 17.4.3.2 [reserved.names] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4829  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
4830 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#reserved.names">issues</a> in [reserved.names].</p>
4831 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4832 <p><b>Discussion:</b></p>
4833
4834 <p>The original issue asked whether a library implementor could
4835 specialize standard library templates for built-in types.  (This was
4836 an issue because users are permitted to explicitly instantiate
4837 standard library templates.)</p>
4838
4839 <p>Specializations are no longer a problem, because of the resolution
4840 to core issue 259.  Under the proposed resolution, it will be legal
4841 for a translation unit to contain both a specialization and an
4842 explicit instantiation of the same template, provided that the
4843 specialization comes first.  In such a case, the explicit
4844 instantiation will be ignored.  Further discussion of library issue
4845 120 assumes that the core 259 resolution will be adopted.</p>
4846
4847 <p>However, as noted in lib-7047, one piece of this issue still
4848 remains: what happens if a standard library implementor explicitly
4849 instantiates a standard library templates?  It's illegal for a program
4850 to contain two different explicit instantiations of the same template
4851 for the same type in two different translation units (ODR violation),
4852 and the core working group doesn't believe it is practical to relax
4853 that restriction.</p>
4854
4855 <p>The issue, then, is: are users allowed to explicitly instantiate
4856 standard library templates for non-user defined types?  The status quo
4857 answer is 'yes'.  Changing it to 'no' would give library implementors
4858 more freedom.</p>
4859
4860 <p>This is an issue because, for performance reasons, library
4861 implementors often need to explicitly instantiate standard library
4862 templates.  (for example, std::basic_string&lt;char&gt;)  Does giving
4863 users freedom to explicitly instantiate standard library templates for
4864 non-user defined types make it impossible or painfully difficult for
4865 library implementors to do this?</p>
4866
4867 <p>John Spicer suggests, in lib-8957, that library implementors have a
4868 mechanism they can use for explicit instantiations that doesn't
4869 prevent users from performing their own explicit instantiations: put
4870 each explicit instantiation in its own object file.  (Different
4871 solutions might be necessary for Unix DSOs or MS-Windows DLLs.)  On
4872 some platforms, library implementors might not need to do anything
4873 special: the "undefined behavior" that results from having two
4874 different explicit instantiations might be harmless.</p>
4875
4876
4877
4878 <p><b>Proposed resolution:</b></p>
4879   <p>Append to 17.4.3.2 [reserved.names] paragraph 1: </p>
4880   <blockquote><p>
4881     A program may explicitly instantiate any templates in the standard
4882     library only if the declaration depends on the name of a user-defined
4883     type of external linkage and the instantiation meets the standard library
4884     requirements for the original template.
4885   </p></blockquote>
4886
4887 <p><i>[Kona: changed the wording from "a user-defined name" to "the name of
4888   a user-defined type"]</i></p>
4889
4890
4891
4892
4893 <p><b>Rationale:</b></p>
4894 <p>The LWG considered another possible resolution:</p>
4895 <blockquote>
4896   <p>In light of the resolution to core issue 259, no normative changes
4897   in the library clauses are necessary.  Add the following non-normative
4898   note to the end of 17.4.3.2 [reserved.names] paragraph 1:</p>
4899   <blockquote><p>
4900     [<i>Note:</i> A program may explicitly instantiate standard library
4901     templates, even when an explicit instantiation does not depend on
4902     a user-defined name. <i>--end note</i>]
4903   </p></blockquote>
4904 </blockquote>
4905
4906 <p>The LWG rejected this because it was believed that it would make
4907   it unnecessarily difficult for library implementors to write
4908   high-quality implementations.  A program may not include an
4909   explicit instantiation of the same template, for the same template
4910   arguments, in two different translation units.  If users are
4911   allowed to provide explicit instantiations of Standard Library
4912   templates for built-in types, then library implementors aren't,
4913   at least not without nonportable tricks.</p>
4914
4915 <p>The most serious problem is a class template that has writeable
4916   static member variables.  Unfortunately, such class templates are
4917   important and, in existing Standard Library implementations, are
4918   often explicitly specialized by library implementors: locale facets,
4919   which have a writeable static member variable <tt>id</tt>.  If a
4920   user's explicit instantiation collided with the implementations
4921   explicit instantiation, iostream initialization could cause locales
4922   to be constructed in an inconsistent state.</p>
4923
4924 <p>One proposed implementation technique was for Standard Library
4925   implementors to provide explicit instantiations in separate object
4926   files, so that they would not be picked up by the linker when the
4927   user also provides an explicit instantiation.  However, this
4928   technique only applies for Standard Library implementations that
4929   are packaged as static archives.  Most Standard Library
4930   implementations nowadays are packaged as dynamic libraries, so this
4931   technique would not apply.</p>
4932
4933 <p>The Committee is now considering standardization of dynamic
4934   linking.  If there are such changes in the future, it may be
4935   appropriate to revisit this issue later.</p>
4936
4937
4938
4939
4940
4941 <hr>
4942 <h3><a name="122"></a>122. streambuf/wstreambuf description should not say they are specializations</h3>
4943 <p><b>Section:</b> 27.5.2 [streambuf] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
4944  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
4945 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#streambuf">issues</a> in [streambuf].</p>
4946 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
4947 <p><b>Discussion:</b></p>
4948 <p>Section 27.5.2 describes the streambuf classes this way: </p>
4949
4950 <blockquote>
4951
4952 <p>The class streambuf is a specialization of the template class basic_streambuf
4953 specialized for the type char. </p>
4954
4955 <p>The class wstreambuf is a specialization of the template class basic_streambuf
4956 specialized for the type wchar_t. </p>
4957
4958 </blockquote>
4959
4960 <p>This implies that these classes must be template specializations, not typedefs. </p>
4961
4962 <p>It doesn't seem this was intended, since Section 27.5 has them declared as typedefs. </p>
4963
4964
4965 <p><b>Proposed resolution:</b></p>
4966 <p>Remove 27.5.2 [streambuf] paragraphs 2 and 3 (the above two
4967 sentences). </p>
4968
4969
4970 <p><b>Rationale:</b></p>
4971 <p>The <tt>streambuf</tt>  synopsis already has a declaration for the
4972 typedefs and that is sufficient. </p>
4973
4974
4975
4976
4977
4978 <hr>
4979 <h3><a name="123"></a>123. Should valarray helper arrays fill functions be const?</h3>
4980 <p><b>Section:</b> 26.5.5.3 [slice.arr.fill], 26.5.7.3 [gslice.array.fill], 26.5.8.3 [mask.array.fill], 26.5.9.3 [indirect.array.fill] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
4981  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
4982 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
4983 <p><b>Discussion:</b></p>
4984 <p>One of the operator= in the valarray helper arrays is const and one
4985 is not. For example, look at slice_array. This operator= in Section
4986 26.5.5.1 [slice.arr.assign] is const: </p>
4987
4988 <p>&nbsp;&nbsp;&nbsp; <tt>void operator=(const valarray&lt;T&gt;&amp;) const;</tt> </p>
4989
4990 <p>but this one in Section 26.5.5.3 [slice.arr.fill] is not: </p>
4991
4992 <p>&nbsp;&nbsp;&nbsp; <tt>void operator=(const T&amp;); </tt></p>
4993
4994 <p>The description of the semantics for these two functions is similar. </p>
4995
4996
4997 <p><b>Proposed resolution:</b></p>
4998
4999 <p>26.5.5 [template.slice.array] Template class slice_array</p>
5000 <blockquote>
5001
5002    <p>In the class template definition for slice_array, replace the member
5003    function declaration</p>
5004     <pre>      void operator=(const T&amp;);
5005     </pre>
5006    <p>with</p>
5007     <pre>      void operator=(const T&amp;) const;
5008     </pre>
5009 </blockquote>
5010
5011 <p>26.5.5.3 [slice.arr.fill] slice_array fill function</p>
5012 <blockquote>
5013
5014    <p>Change the function declaration</p>
5015     <pre>      void operator=(const T&amp;);
5016     </pre>
5017    <p>to</p>
5018     <pre>      void operator=(const T&amp;) const;
5019     </pre>
5020 </blockquote>
5021
5022 <p>26.5.7 [template.gslice.array] Template class gslice_array</p>
5023 <blockquote>
5024
5025    <p>In the class template definition for gslice_array, replace the member
5026    function declaration</p>
5027     <pre>      void operator=(const T&amp;);
5028     </pre>
5029    <p>with</p>
5030     <pre>      void operator=(const T&amp;) const;
5031     </pre>
5032 </blockquote>
5033
5034 <p>26.5.7.3 [gslice.array.fill] gslice_array fill function</p>
5035 <blockquote>
5036
5037    <p>Change the function declaration</p>
5038     <pre>      void operator=(const T&amp;);
5039     </pre>
5040    <p>to</p>
5041     <pre>      void operator=(const T&amp;) const;
5042     </pre>
5043 </blockquote>
5044
5045 <p>26.5.8 [template.mask.array] Template class mask_array</p>
5046 <blockquote>
5047
5048    <p>In the class template definition for mask_array, replace the member
5049    function declaration</p>
5050     <pre>      void operator=(const T&amp;);
5051     </pre>
5052    <p>with</p>
5053     <pre>      void operator=(const T&amp;) const;
5054     </pre>
5055 </blockquote>
5056
5057 <p>26.5.8.3 [mask.array.fill] mask_array fill function</p>
5058 <blockquote>
5059
5060    <p>Change the function declaration</p>
5061     <pre>      void operator=(const T&amp;);
5062     </pre>
5063    <p>to</p>
5064     <pre>      void operator=(const T&amp;) const;
5065     </pre>
5066 </blockquote>
5067
5068 <p>26.5.9 [template.indirect.array] Template class indirect_array</p>
5069 <blockquote>
5070
5071    <p>In the class template definition for indirect_array, replace the member
5072    function declaration</p>
5073     <pre>      void operator=(const T&amp;);
5074     </pre>
5075    <p>with</p>
5076     <pre>      void operator=(const T&amp;) const;
5077     </pre>
5078 </blockquote>
5079
5080 <p>26.5.9.3 [indirect.array.fill] indirect_array fill function</p>
5081 <blockquote>
5082
5083    <p>Change the function declaration</p>
5084     <pre>      void operator=(const T&amp;);
5085     </pre>
5086    <p>to</p>
5087     <pre>      void operator=(const T&amp;) const;
5088     </pre>
5089 </blockquote>
5090
5091
5092 <p><i>[Redmond: Robert provided wording.]</i></p>
5093
5094
5095
5096
5097 <p><b>Rationale:</b></p>
5098 <p>There's no good reason for one version of operator= being const and
5099 another one not.  Because of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#253">253</a>, this now
5100 matters: these functions are now callable in more circumstances.  In
5101 many existing implementations, both versions are already const.</p>
5102
5103
5104
5105
5106
5107 <hr>
5108 <h3><a name="124"></a>124. ctype_byname&lt;charT&gt;::do_scan_is &amp; do_scan_not return type should be const charT*</h3>
5109 <p><b>Section:</b> 22.2.1.2 [locale.ctype.byname] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5110  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
5111 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.ctype.byname">issues</a> in [locale.ctype.byname].</p>
5112 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5113 <p><b>Discussion:</b></p>
5114 <p>In Section 22.2.1.2 [locale.ctype.byname]
5115 ctype_byname&lt;charT&gt;::do_scan_is() and do_scan_not() are declared
5116 to return a const char* not a const charT*. </p>
5117
5118
5119 <p><b>Proposed resolution:</b></p>
5120 <p>Change Section 22.2.1.2 [locale.ctype.byname] <tt>do_scan_is()</tt> and
5121 <tt>do_scan_not()</tt> to return a <tt> const
5122 charT*</tt>. </p>
5123
5124
5125
5126
5127
5128 <hr>
5129 <h3><a name="125"></a>125. valarray&lt;T&gt;::operator!() return type is inconsistent</h3>
5130 <p><b>Section:</b> 26.5.2 [template.valarray] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5131  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
5132 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#template.valarray">issues</a> in [template.valarray].</p>
5133 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5134 <p><b>Discussion:</b></p>
5135 <p>In Section 26.5.2 [template.valarray] valarray&lt;T&gt;::operator!()
5136 is
5137 declared to return a valarray&lt;T&gt;, but in Section 26.5.2.5
5138 [valarray.unary] it is declared to return a valarray&lt;bool&gt;. The
5139 latter appears to be correct. </p>
5140
5141
5142 <p><b>Proposed resolution:</b></p>
5143 <p>Change in Section 26.5.2 [template.valarray] the declaration of
5144 <tt>operator!()</tt> so that the return type is
5145 <tt>valarray&lt;bool&gt;</tt>. </p>
5146
5147
5148
5149
5150 <hr>
5151 <h3><a name="126"></a>126. typos in Effects clause of ctype::do_narrow()</h3>
5152 <p><b>Section:</b> 22.2.1.1.2 [locale.ctype.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5153  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-12-15</p>
5154 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.ctype.virtuals">issues</a> in [locale.ctype.virtuals].</p>
5155 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5156 <p><b>Discussion:</b></p><p>Typos in 22.2.1.1.2 need to be fixed.</p>
5157
5158 <p><b>Proposed resolution:</b></p>
5159 <p>In Section 22.2.1.1.2 [locale.ctype.virtuals] change: </p>
5160
5161 <pre>   do_widen(do_narrow(c),0) == c</pre>
5162
5163 <p>to:</p>
5164
5165 <pre>   do_widen(do_narrow(c,0)) == c</pre>
5166
5167 <p>and change:</p>
5168
5169 <pre>   (is(M,c) || !ctc.is(M, do_narrow(c),dfault) )</pre>
5170
5171 <p>to:</p>
5172
5173 <pre>   (is(M,c) || !ctc.is(M, do_narrow(c,dfault)) )</pre>
5174
5175
5176
5177
5178
5179 <hr>
5180 <h3><a name="127"></a>127. auto_ptr&lt;&gt; conversion issues</h3>
5181 <p><b>Section:</b> D.9.1 [auto.ptr] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5182  <b>Submitter:</b> Greg Colvin <b>Date:</b> 1999-02-17</p>
5183 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#auto.ptr">issues</a> in [auto.ptr].</p>
5184 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5185 <p><b>Discussion:</b></p>
5186 <p>There are two problems with the current <tt>auto_ptr</tt> wording
5187 in the standard: </p>
5188
5189 <p>First, the <tt>auto_ptr_ref</tt> definition cannot be nested
5190 because <tt>auto_ptr&lt;Derived&gt;::auto_ptr_ref</tt> is unrelated to
5191 <tt>auto_ptr&lt;Base&gt;::auto_ptr_ref</tt>.  <i>Also submitted by
5192 Nathan Myers, with the same proposed resolution.</i></p>
5193
5194 <p>Second, there is no <tt>auto_ptr</tt> assignment operator taking an
5195 <tt>auto_ptr_ref</tt> argument. </p>
5196
5197 <p>I have discussed these problems with my proposal coauthor, Bill
5198 Gibbons, and with some compiler and library implementors, and we
5199 believe that these problems are not desired or desirable implications
5200 of the standard. </p>
5201
5202 <p>25 Aug 1999: The proposed resolution now reflects changes suggested
5203 by Dave Abrahams, with Greg Colvin's concurrence; 1) changed
5204 "assignment operator" to "public assignment
5205 operator", 2) changed effects to specify use of release(), 3)
5206 made the conversion to auto_ptr_ref const. </p>
5207
5208 <p>2 Feb 2000: Lisa Lippincott comments: [The resolution of] this issue
5209 states that the conversion from auto_ptr to auto_ptr_ref should
5210 be const.  This is not acceptable, because it would allow
5211 initialization and assignment from _any_ const auto_ptr!  It also
5212 introduces an implementation difficulty in writing this conversion
5213 function -- namely, somewhere along the line, a const_cast will be
5214 necessary to remove that const so that release() may be called.  This
5215 may result in undefined behavior [7.1.5.1/4]. The conversion
5216 operator does not have to be const, because a non-const implicit
5217 object parameter may be bound to an rvalue [13.3.3.1.4/3]
5218 [13.3.1/5]. </p>
5219
5220   <p>Tokyo: The LWG removed the following from the proposed resolution:</p>
5221
5222   <p>In 20.5.4 [meta.unary], paragraph 2, and 20.5.4.3 [meta.unary.prop], 
5223   paragraph 2, make the conversion to auto_ptr_ref const:</p>
5224   <blockquote>
5225     <pre>template&lt;class Y&gt; operator auto_ptr_ref&lt;Y&gt;() const throw();</pre>
5226   </blockquote>
5227
5228
5229 <p><b>Proposed resolution:</b></p>
5230 <p>In 20.5.4 [meta.unary], paragraph 2, move
5231 the <tt>auto_ptr_ref</tt> definition to namespace scope.</p>
5232
5233 <p>In 20.5.4 [meta.unary], paragraph 2, add
5234 a public assignment operator to the <tt>auto_ptr</tt> definition: </p>
5235
5236 <blockquote>
5237   <pre>auto_ptr&amp; operator=(auto_ptr_ref&lt;X&gt; r) throw();</pre>
5238 </blockquote>
5239
5240 <p>Also add the assignment operator to 20.5.4.3 [meta.unary.prop]: </p>
5241
5242 <blockquote>
5243   <pre>auto_ptr&amp; operator=(auto_ptr_ref&lt;X&gt; r) throw()</pre>
5244
5245   <p><b>Effects:</b> Calls <tt>reset(p.release())</tt> for the <tt>auto_ptr
5246   p</tt> that <tt>r</tt> holds a reference to.<br>
5247   <b>Returns: </b><tt>*this</tt>.</p>
5248
5249 </blockquote>
5250
5251
5252
5253
5254
5255 <hr>
5256 <h3><a name="129"></a>129. Need error indication from seekp() and seekg()</h3>
5257 <p><b>Section:</b> 27.6.1.3 [istream.unformatted], 27.6.2.5 [ostream.seeks] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5258  <b>Submitter:</b> Angelika Langer <b>Date:</b> 1999-02-22</p>
5259 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
5260 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5261 <p><b>Discussion:</b></p>
5262 <p>Currently, the standard does not specify how seekg() and seekp()
5263 indicate failure. They are not required to set failbit, and they can't
5264 return an error indication because they must return *this, i.e. the
5265 stream. Hence, it is undefined what happens if they fail. And they
5266 <i>can</i> fail, for instance, when a file stream is disconnected from the
5267 underlying file (is_open()==false) or when a wide character file
5268 stream must perform a state-dependent code conversion, etc. </p>
5269
5270 <p>The stream functions seekg() and seekp() should set failbit in the
5271 stream state in case of failure.</p>
5272
5273
5274 <p><b>Proposed resolution:</b></p>
5275 <p>Add to the Effects: clause of&nbsp; seekg() in 
5276 27.6.1.3 [istream.unformatted] and to the Effects: clause of seekp() in
5277 27.6.2.5 [ostream.seeks]: </p>
5278
5279 <blockquote>
5280   <p>In case of failure, the function calls <tt>setstate(failbit)</tt> (which may throw <tt>ios_base::failure</tt>).
5281   </p>
5282 </blockquote>
5283
5284
5285 <p><b>Rationale:</b></p>
5286 <p>Setting failbit is the usual error reporting mechanism for streams</p>
5287
5288
5289
5290
5291 <hr>
5292 <h3><a name="130"></a>130. Return type of container::erase(iterator) differs for associative containers</h3>
5293 <p><b>Section:</b> 23.1.4 [associative.reqmts], 23.1.3 [sequence.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
5294  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 1999-03-02</p>
5295 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
5296 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
5297 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#451">451</a></p>
5298 <p><b>Discussion:</b></p>
5299 <p>Table 67 (23.1.1) says that container::erase(iterator) returns an
5300 iterator. Table 69 (23.1.2) says that in addition to this requirement,
5301 associative containers also say that container::erase(iterator)
5302 returns void.  That's not an addition; it's a change to the
5303 requirements, which has the effect of making associative containers
5304 fail to meet the requirements for containers.</p>
5305
5306
5307 <p><b>Proposed resolution:</b></p>
5308
5309 <p>
5310 In 23.1.4 [associative.reqmts], in Table 69 Associative container
5311 requirements, change the return type of <tt>a.erase(q)</tt> from
5312 <tt>void</tt> to <tt>iterator</tt>.  Change the
5313 assertion/not/pre/post-condition from "erases the element pointed to
5314 by <tt>q</tt>" to "erases the element pointed to by <tt>q</tt>.
5315 Returns an iterator pointing to the element immediately following q
5316 prior to the element being erased. If no such element exists, a.end()
5317 is returned."
5318 </p>
5319
5320 <p>
5321 In 23.1.4 [associative.reqmts], in Table 69 Associative container
5322 requirements, change the return type of <tt>a.erase(q1, q2)</tt>
5323 from <tt>void</tt> to <tt>iterator</tt>.  Change the
5324 assertion/not/pre/post-condition from "erases the elements in the
5325 range <tt>[q1, q2)</tt>" to "erases the elements in the range <tt>[q1,
5326 q2)</tt>.  Returns q2."
5327 </p>
5328
5329 <p>
5330 In 23.3.1 [map], in the <tt>map</tt> class synopsis; and 
5331 in 23.3.2 [multimap], in the <tt>multimap</tt> class synopsis; and
5332 in 23.3.3 [set], in the <tt>set</tt> class synopsis; and
5333 in 23.3.4 [multiset], in the <tt>multiset</tt> class synopsis:
5334 change the signature of the first <tt>erase</tt> overload to
5335 </p>
5336 <pre>   iterator erase(iterator position);
5337 </pre>
5338 <p>and change the signature of the third <tt>erase</tt> overload to</p>
5339 <pre>  iterator erase(iterator first, iterator last); 
5340 </pre>
5341
5342
5343 <p><i>[Pre-Kona: reopened at the request of Howard Hinnant]</i></p>
5344
5345
5346 <p><i>[Post-Kona: the LWG agrees the return type should be
5347 <tt>iterator</tt>, not <tt>void</tt>.  (Alex Stepanov agrees too.)
5348 Matt provided wording.]</i></p>
5349
5350
5351 <p><i>[
5352  Sydney: the proposed wording went in the right direction, but it
5353  wasn't good enough. We want to return an iterator from the range form
5354  of erase as well as the single-iterator form. Also, the wording is
5355  slightly different from the wording we have for sequences; there's no
5356  good reason for having a difference.  Matt provided new wording,
5357 (reflected above) which we will review at the next meeting.
5358 ]</i></p>
5359
5360
5361 <p><i>[
5362 Redmond:  formally voted into WP.
5363 ]</i></p>
5364
5365
5366
5367
5368
5369
5370
5371 <hr>
5372 <h3><a name="132"></a>132. list::resize description uses random access iterators</h3>
5373 <p><b>Section:</b> 23.2.4.2 [list.capacity] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5374  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 1999-03-06</p>
5375 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5376 <p><b>Discussion:</b></p>
5377 <p>The description reads:</p>
5378
5379 <p>-1- Effects:</p>
5380
5381 <pre>         if (sz &gt; size())
5382            insert(end(), sz-size(), c);
5383          else if (sz &lt; size())
5384            erase(begin()+sz, end());
5385          else
5386            ;                           //  do nothing</pre>
5387
5388 <p>Obviously list::resize should not be specified in terms of random access iterators.</p>
5389
5390
5391 <p><b>Proposed resolution:</b></p>
5392 <p>Change 23.2.4.2 [list.capacity] paragraph 1 to:</p>
5393
5394 <p>Effects:</p>
5395
5396 <pre>         if (sz &gt; size())
5397            insert(end(), sz-size(), c);
5398          else if (sz &lt; size())
5399          {
5400            iterator i = begin();
5401            advance(i, sz);
5402            erase(i, end());
5403          }</pre>
5404
5405 <p><i>[Dublin: The LWG asked Howard to discuss exception safety offline
5406 with David Abrahams. They had a discussion and believe there is
5407 no issue of exception safety with the proposed resolution.]</i></p>
5408
5409
5410
5411
5412
5413
5414 <hr>
5415 <h3><a name="133"></a>133. map missing get_allocator()</h3>
5416 <p><b>Section:</b> 23.3.1 [map] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5417  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 1999-03-06</p>
5418 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#map">issues</a> in [map].</p>
5419 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5420 <p><b>Discussion:</b></p><p>The title says it all.</p>
5421
5422 <p><b>Proposed resolution:</b></p>
5423 <p>Insert in 23.3.1 [map], paragraph 2,
5424 after operator= in the map declaration:</p>
5425
5426 <pre>    allocator_type get_allocator() const;</pre>
5427
5428
5429
5430
5431 <hr>
5432 <h3><a name="134"></a>134. vector constructors over specified</h3>
5433 <p><b>Section:</b> 23.2.6.1 [vector.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5434  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 1999-03-06</p>
5435 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5436 <p><b>Discussion:</b></p>
5437 <p>The complexity description says: "It does at most 2N calls to the copy constructor
5438 of T and logN reallocations if they are just input iterators ...".</p>
5439
5440 <p>This appears to be overly restrictive, dictating the precise memory/performance
5441 tradeoff for the implementor.</p>
5442
5443
5444 <p><b>Proposed resolution:</b></p>
5445 <p>Change 23.2.6.1 [vector.cons], paragraph 1 to:</p>
5446
5447 <p>-1- Complexity: The constructor template &lt;class
5448 InputIterator&gt; vector(InputIterator first, InputIterator last)
5449 makes only N calls to the copy constructor of T (where N is the
5450 distance between first and last) and no reallocations if iterators
5451 first and last are of forward, bidirectional, or random access
5452 categories. It makes order N calls to the copy constructor of T and
5453 order logN reallocations if they are just input iterators.
5454 </p>
5455
5456
5457 <p><b>Rationale:</b></p>
5458 <p>"at most 2N calls" is correct only if the growth factor
5459 is greater than or equal to 2.
5460 </p>
5461
5462
5463
5464
5465 <hr>
5466 <h3><a name="136"></a>136. seekp, seekg setting wrong streams?</h3>
5467 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
5468  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 1999-03-06</p>
5469 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
5470 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
5471 <p><b>Discussion:</b></p>
5472 <p>I may be misunderstanding the intent, but should not seekg set only
5473 the input stream and seekp set only the output stream? The description
5474 seems to say that each should set both input and output streams. If
5475 that's really the intent, I withdraw this proposal.</p>
5476
5477
5478 <p><b>Proposed resolution:</b></p>
5479 <p>In section 27.6.1.3 change:</p>
5480
5481 <pre>basic_istream&lt;charT,traits&gt;&amp; seekg(pos_type pos);
5482 Effects: If fail() != true, executes rdbuf()-&gt;pubseekpos(pos). </pre>
5483
5484 <p>To:</p>
5485
5486 <pre>basic_istream&lt;charT,traits&gt;&amp; seekg(pos_type pos);
5487 Effects: If fail() != true, executes rdbuf()-&gt;pubseekpos(pos, ios_base::in). </pre>
5488
5489 <p>In section 27.6.1.3 change:</p>
5490
5491 <pre>basic_istream&lt;charT,traits&gt;&amp; seekg(off_type&amp; off, ios_base::seekdir dir);
5492 Effects: If fail() != true, executes rdbuf()-&gt;pubseekoff(off, dir). </pre>
5493
5494 <p>To:</p>
5495
5496 <pre>basic_istream&lt;charT,traits&gt;&amp; seekg(off_type&amp; off, ios_base::seekdir dir);
5497 Effects: If fail() != true, executes rdbuf()-&gt;pubseekoff(off, dir, ios_base::in). </pre>
5498
5499 <p>In section 27.6.2.4, paragraph 2 change:</p>
5500
5501 <pre>-2- Effects: If fail() != true, executes rdbuf()-&gt;pubseekpos(pos). </pre>
5502
5503 <p>To:</p>
5504
5505 <pre>-2- Effects: If fail() != true, executes rdbuf()-&gt;pubseekpos(pos, ios_base::out). </pre>
5506
5507 <p>In section 27.6.2.4, paragraph 4 change:</p>
5508
5509 <pre>-4- Effects: If fail() != true, executes rdbuf()-&gt;pubseekoff(off, dir). </pre>
5510
5511 <p>To:</p>
5512
5513 <pre>-4- Effects: If fail() != true, executes rdbuf()-&gt;pubseekoff(off, dir, ios_base::out). </pre>
5514
5515 <p><i>[Dublin: Dietmar Kühl thinks this is probably correct, but would
5516 like the opinion of more iostream experts before taking action.]</i></p>
5517
5518
5519 <p><i>[Tokyo: Reviewed by the LWG. PJP noted that although his docs are
5520 incorrect, his implementation already implements the Proposed
5521 Resolution.]</i></p>
5522
5523
5524 <p><i>[Post-Tokyo: Matt Austern comments:<br>
5525 Is it a problem with basic_istream and basic_ostream, or is it a problem
5526 with basic_stringbuf?
5527 We could resolve the issue either by changing basic_istream and
5528 basic_ostream, or by changing basic_stringbuf. I prefer the latter
5529 change (or maybe both changes): I don't see any reason for the standard to
5530 require that std::stringbuf s(std::string("foo"), std::ios_base::in);
5531 s.pubseekoff(0, std::ios_base::beg); must fail.<br>
5532 This requirement is a bit weird. There's no similar requirement
5533 for basic_streambuf&lt;&gt;::seekpos, or for basic_filebuf&lt;&gt;::seekoff or
5534 basic_filebuf&lt;&gt;::seekpos.]</i></p>
5535
5536
5537
5538
5539
5540
5541 <hr>
5542 <h3><a name="137"></a>137. Do use_facet and has_facet look in the global locale?</h3>
5543 <p><b>Section:</b> 22.1.1 [locale] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5544  <b>Submitter:</b> Angelika Langer <b>Date:</b> 1999-03-17</p>
5545 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale">issues</a> in [locale].</p>
5546 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5547 <p><b>Discussion:</b></p>
5548 <p>Section 22.1.1 [locale] says:</p>
5549
5550 <p>-4- In the call to use_facet&lt;Facet&gt;(loc), the type argument
5551 chooses a facet, making available all members of the named type. If
5552 Facet is not present in a locale (or, failing that, in the global
5553 locale), it throws the standard exception bad_cast. A C++ program can
5554 check if a locale implements a particular facet with the template
5555 function has_facet&lt;Facet&gt;(). </p>
5556
5557 <p>This contradicts the specification given in section 
5558 22.1.2 [locale.global.templates]:
5559 <br><br>
5560 template &lt;class&nbsp; Facet&gt; const&nbsp; Facet&amp; use_facet(const
5561 locale&amp;&nbsp; loc); <br>
5562 <br>
5563 -1- Get a reference to a facet of a locale. <br>
5564 -2- Returns: a reference to the corresponding facet of loc, if present. <br>
5565 -3- Throws: bad_cast if has_facet&lt;Facet&gt;(loc) is false. <br>
5566 -4- Notes: The reference returned remains valid at least as long as any copy of loc exists
5567 </p>
5568
5569
5570 <p><b>Proposed resolution:</b></p>
5571 <p>Remove the phrase "(or, failing that, in the global locale)"
5572 from section 22.1.1. </p>
5573
5574
5575 <p><b>Rationale:</b></p>
5576 <p>Needed for consistency with the way locales are handled elsewhere
5577 in the standard.</p>
5578
5579
5580
5581
5582 <hr>
5583 <h3><a name="139"></a>139. Optional sequence operation table description unclear</h3>
5584 <p><b>Section:</b> 23.1.3 [sequence.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5585  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 1999-03-30</p>
5586 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#sequence.reqmts">issues</a> in [sequence.reqmts].</p>
5587 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5588 <p><b>Discussion:</b></p>
5589 <p>The sentence introducing the Optional sequence operation table
5590 (23.1.1 paragraph 12) has two problems:</p>
5591
5592 <p>A. It says ``The operations in table 68 are provided only for the containers for which
5593 they take constant time.''<br>
5594 <br>
5595 That could be interpreted in two ways, one of them being ``Even though table 68 shows
5596 particular operations as being provided, implementations are free to omit them if they
5597 cannot implement them in constant time.''<br>
5598 <br>
5599 B. That paragraph says nothing about amortized constant time, and it should.&nbsp;</p>
5600
5601
5602 <p><b>Proposed resolution:</b></p>
5603 <p>Replace the wording in 23.1.1 paragraph 12&nbsp; which begins ``The operations in table 68 are provided only..."
5604 with:</p>
5605
5606 <blockquote>
5607   <p>Table 68 lists sequence operations that are provided for some types of sequential
5608   containers but not others. An implementation shall provide these operations for all
5609   container types shown in the ``container'' column, and shall implement them so as to take
5610   amortized constant time.</p>
5611 </blockquote>
5612
5613
5614
5615
5616 <hr>
5617 <h3><a name="141"></a>141. basic_string::find_last_of, find_last_not_of say pos instead of xpos</h3>
5618 <p><b>Section:</b> 21.3.6.4 [string::insert], 21.3.6.6 [string::replace] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5619  <b>Submitter:</b> Arch Robison <b>Date:</b> 1999-04-28</p>
5620 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string::insert">issues</a> in [string::insert].</p>
5621 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5622 <p><b>Discussion:</b></p>
5623 <p>Sections 21.3.6.4 paragraph 1 and 21.3.6.6 paragraph 1 surely have misprints where they
5624 say:<br>
5625 <br>
5626 &#8212; <tt>xpos &lt;= pos</tt> and <tt>pos &lt; size();</tt></p>
5627
5628 <p>Surely the document meant to say ``<tt>xpos &lt; size()</tt>'' in both places.</p>
5629
5630 <p><i>[Judy Ward also sent in this issue for 21.3.6.4 with the same
5631 proposed resolution.]</i></p>
5632
5633
5634
5635 <p><b>Proposed resolution:</b></p>
5636 <p>Change Sections 21.3.6.4 paragraph 1 and 21.3.6.6 paragraph 1, the line which says:<br>
5637 <br>
5638 &#8212; <tt>xpos &lt;= pos</tt> and <tt>pos &lt; size();<br>
5639 <br>
5640 </tt>to:<br>
5641 <tt><br>
5642 </tt>&#8212; <tt>xpos &lt;= pos</tt> and <tt>xpos &lt; size();</tt></p>
5643
5644
5645
5646
5647 <hr>
5648 <h3><a name="142"></a>142. lexicographical_compare complexity wrong</h3>
5649 <p><b>Section:</b> 25.3.8 [alg.lex.comparison] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5650  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 1999-06-20</p>
5651 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5652 <p><b>Discussion:</b></p>
5653 <p>The lexicographical_compare complexity is specified as:<br>
5654 <br>
5655 &nbsp;&nbsp;&nbsp;&nbsp; "At most min((last1 - first1), (last2 - first2))
5656 applications of the corresponding comparison."<br>
5657 <br>
5658 The best I can do is twice that expensive.</p>
5659
5660 <p>Nicolai Josuttis comments in lib-6862: You mean, to check for
5661 equality you have to check both &lt; and &gt;? Yes, IMO you are
5662 right! (and Matt states this complexity in his book)</p>
5663
5664
5665
5666 <p><b>Proposed resolution:</b></p>
5667 <p>Change 25.3.8 [alg.lex.comparison] complexity to:</p>
5668     <blockquote><p>
5669     At most <tt>2*min((last1 - first1), (last2 - first2))</tt>
5670     applications of the corresponding comparison.
5671     </p></blockquote>
5672
5673 <p>Change the example at the end of paragraph 3 to read:</p>
5674     <blockquote><p>
5675     [Example:<br>
5676     <br>
5677     &nbsp;&nbsp;&nbsp; for ( ; first1 != last1 &amp;&amp; first2 != last2 ;
5678     ++first1, ++first2) {<br>
5679     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (*first1 &lt; *first2) return true;<br>
5680     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (*first2 &lt; *first1) return false;<br>
5681     &nbsp;&nbsp;&nbsp; }<br>
5682     &nbsp;&nbsp;&nbsp; return first1 == last1 &amp;&amp; first2 != last2;<br>
5683     &nbsp;&nbsp;&nbsp;<br>
5684     --end example]
5685     </p></blockquote>
5686
5687
5688
5689
5690 <hr>
5691 <h3><a name="144"></a>144. Deque constructor complexity wrong </h3>
5692 <p><b>Section:</b> 23.2.2.1 [deque.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5693  <b>Submitter:</b> Herb Sutter <b>Date:</b> 1999-05-09</p>
5694 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#deque.cons">issues</a> in [deque.cons].</p>
5695 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5696 <p><b>Discussion:</b></p>
5697 <p>In 23.2.2.1 [deque.cons] paragraph 6, the deque ctor that takes an iterator range appears
5698 to have complexity requirements which are incorrect, and which contradict the
5699 complexity requirements for insert(). I suspect that the text in question,
5700 below, was taken from vector:</p>
5701 <blockquote>
5702   <p>Complexity: If the iterators first and last are forward iterators,
5703   bidirectional iterators, or random access iterators the constructor makes only
5704   N calls to the copy constructor, and performs no reallocations, where N is
5705   last - first.</p>
5706 </blockquote>
5707 <p>The word "reallocations" does not really apply to deque. Further,
5708 all of the following appears to be spurious:</p>
5709 <blockquote>
5710   <p>It makes at most 2N calls to the copy constructor of T and log N
5711   reallocations if they are input iterators.1)</p>
5712   <p>1) The complexity is greater in the case of input iterators because each
5713   element must be added individually: it is impossible to determine the distance
5714   between first abd last before doing the copying.</p>
5715 </blockquote>
5716 <p>This makes perfect sense for vector, but not for deque. Why should deque gain
5717 an efficiency advantage from knowing in advance the number of elements to
5718 insert?</p>
5719
5720
5721 <p><b>Proposed resolution:</b></p>
5722 <p>In 23.2.2.1 [deque.cons] paragraph 6, replace the Complexity description, including the
5723 footnote, with the following text (which also corrects the "abd"
5724 typo):</p>
5725 <blockquote>
5726   <p>Complexity: Makes last - first calls to the copy constructor of T.</p>
5727 </blockquote>
5728
5729
5730
5731
5732 <hr>
5733 <h3><a name="146"></a>146. complex&lt;T&gt; Inserter and Extractor need sentries</h3>
5734 <p><b>Section:</b> 26.3.6 [complex.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5735  <b>Submitter:</b> Angelika Langer <b>Date:</b> 1999-05-12</p>
5736 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#complex.ops">issues</a> in [complex.ops].</p>
5737 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5738 <p><b>Discussion:</b></p>
5739 <p>The extractor for complex numbers is specified as:&nbsp;</p>
5740
5741 <blockquote>
5742
5743 <p>     template&lt;class T, class charT, class traits&gt;&nbsp;<br>
5744      basic_istream&lt;charT, traits&gt;&amp;&nbsp;<br>
5745      operator&gt;&gt;(basic_istream&lt;charT, traits&gt;&amp;  is, complex&lt;T&gt;&amp;  x);<br>
5746 &nbsp;<br>
5747 Effects: Extracts a complex number x of the form: u, (u), or (u,v),
5748 where u is the real part and v is the imaginary part
5749 (lib.istream.formatted).&nbsp;<br>
5750 Requires: The input values be convertible to T. If bad input is
5751 encountered, calls is.setstate(ios::failbit) (which may throw
5752 ios::failure (lib.iostate.flags).&nbsp;<br>
5753 Returns: is .</p>
5754
5755 </blockquote>
5756 <p>Is it intended that the extractor for complex numbers does not skip
5757 whitespace, unlike all other extractors in the standard library do?
5758 Shouldn't a sentry be used?&nbsp;<br>
5759 <br>
5760 The inserter for complex numbers is specified as:</p>
5761
5762 <blockquote>
5763
5764 <p>     template&lt;class T, class charT, class traits&gt;&nbsp;<br>
5765      basic_ostream&lt;charT, traits&gt;&amp;&nbsp;<br>
5766      operator&lt;&lt;(basic_ostream&lt;charT, traits&gt;&amp;  o, const complex&lt;T&gt;&amp;  x);<br>
5767 <br>
5768 Effects: inserts the complex number x onto the stream o as if it were implemented as follows:<br>
5769 <br>
5770      template&lt;class T, class charT, class traits&gt;&nbsp;<br>
5771      basic_ostream&lt;charT, traits&gt;&amp;&nbsp;<br>
5772      operator&lt;&lt;(basic_ostream&lt;charT, traits&gt;&amp; o, const complex&lt;T&gt;&amp; x)&nbsp;<br>
5773      {&nbsp;<br>
5774              basic_ostringstream&lt;charT, traits&gt; s;&nbsp;<br>
5775              s.flags(o.flags());&nbsp;<br>
5776              s.imbue(o.getloc());&nbsp;<br>
5777              s.precision(o.precision());&nbsp;<br>
5778              s &lt;&lt; '(' &lt;&lt; x.real() &lt;&lt; "," &lt;&lt; x.imag() &lt;&lt; ')';&nbsp;<br>
5779              return o &lt;&lt; s.str();&nbsp;<br>
5780      }</p>
5781
5782 </blockquote>
5783
5784 <p>Is it intended that the inserter for complex numbers ignores the
5785 field width and does not do any padding? If, with the suggested
5786 implementation above, the field width were set in the stream then the
5787 opening parentheses would be adjusted, but the rest not, because the
5788 field width is reset to zero after each insertion.</p>
5789
5790 <p>I think that both operations should use sentries, for sake of
5791 consistency with the other inserters and extractors in the
5792 library. Regarding the issue of padding in the inserter, I don't know
5793 what the intent was.&nbsp;</p>
5794
5795
5796 <p><b>Proposed resolution:</b></p>
5797 <p>After 26.3.6 [complex.ops] paragraph 14 (operator&gt;&gt;), add a
5798 Notes clause:</p>
5799
5800 <blockquote>
5801
5802 <p>Notes: This extraction is performed as a series of simpler
5803 extractions. Therefore, the skipping of whitespace is specified to be the
5804 same for each of the simpler extractions.</p>
5805
5806 </blockquote>
5807
5808
5809 <p><b>Rationale:</b></p>
5810 <p>For extractors, the note is added to make it clear that skipping whitespace
5811 follows an "all-or-none" rule.</p>
5812
5813 <p>For inserters, the LWG believes there is no defect; the standard is correct
5814 as written.</p>
5815
5816
5817
5818
5819 <hr>
5820 <h3><a name="147"></a>147. Library Intro refers to global functions that aren't global</h3>
5821 <p><b>Section:</b> 17.4.4.3 [global.functions] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5822  <b>Submitter:</b> Lois Goldthwaite <b>Date:</b> 1999-06-04</p>
5823 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#global.functions">issues</a> in [global.functions].</p>
5824 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5825 <p><b>Discussion:</b></p>
5826 <p>The library had many global functions until 17.4.1.1 [lib.contents]
5827 paragraph 2 was added: </p>
5828
5829 <blockquote>
5830
5831 <p>All library entities except macros, operator new and operator
5832 delete are defined within the namespace std or namespaces nested
5833 within namespace std. </p>
5834
5835 </blockquote>
5836
5837 <p>It appears "global function" was never updated in the following: </p>
5838
5839 <blockquote>
5840
5841 <p>17.4.4.3 - Global functions [lib.global.functions]<br>
5842 <br>
5843 -1- It is unspecified whether any global functions in the C++ Standard
5844 Library are defined as inline (dcl.fct.spec).<br>
5845 <br>
5846 -2- A call to a global function signature described in Clauses
5847 lib.language.support through lib.input.output behaves the same as if
5848 the implementation declares no additional global function
5849 signatures.*<br>
5850 <br>
5851     [Footnote: A valid C++ program always calls the expected library
5852     global function. An implementation may also define additional
5853     global functions that would otherwise not be called by a valid C++
5854     program. --- end footnote]<br>
5855 <br>
5856 -3- A global function cannot be declared by the implementation as
5857 taking additional default arguments.&nbsp;<br>
5858 <br>
5859 17.4.4.4 - Member functions [lib.member.functions]<br>
5860 <br>
5861 -2- An implementation can declare additional non-virtual member
5862 function signatures within a class: </p>
5863
5864   <blockquote>
5865
5866 <p>-- by adding arguments with default values to a member function
5867 signature; The same latitude does not extend to the implementation of
5868 virtual or global functions, however. </p>
5869
5870   </blockquote>
5871 </blockquote>
5872
5873
5874 <p><b>Proposed resolution:</b></p>
5875 <p>     Change "global" to "global or non-member" in:</p>
5876 <blockquote>
5877   <p>17.4.4.3 [lib.global.functions] section title,<br>
5878   17.4.4.3 [lib.global.functions] para 1,<br>
5879   17.4.4.3 [lib.global.functions] para 2 in 2 places plus 2 
5880            places in the footnote,<br>
5881   17.4.4.3 [lib.global.functions] para 3,<br>
5882   17.4.4.4 [lib.member.functions] para 2</p>
5883 </blockquote>
5884
5885
5886 <p><b>Rationale:</b></p>
5887 <p>
5888 Because operator new and delete are global, the proposed resolution
5889 was changed from "non-member" to "global or non-member.
5890 </p>
5891
5892
5893
5894
5895 <hr>
5896 <h3><a name="148"></a>148. Functions in the example facet BoolNames should be const</h3>
5897 <p><b>Section:</b> 22.2.8 [facets.examples] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5898  <b>Submitter:</b> Jeremy Siek <b>Date:</b> 1999-06-03</p>
5899 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facets.examples">issues</a> in [facets.examples].</p>
5900 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5901 <p><b>Discussion:</b></p>
5902 <p>In 22.2.8 [facets.examples] paragraph 13, the do_truename() and
5903 do_falsename() functions in the example facet BoolNames should be
5904 const. The functions they are overriding in
5905 numpunct_byname&lt;char&gt; are const. </p>
5906
5907
5908 <p><b>Proposed resolution:</b></p>
5909 <p>In 22.2.8 [facets.examples] paragraph 13, insert "const" in
5910 two places:</p>
5911 <blockquote>
5912   <p><tt>string do_truename() const { return "Oui Oui!"; }<br>
5913   string do_falsename() const { return "Mais Non!"; }</tt></p>
5914 </blockquote>
5915
5916
5917
5918
5919 <hr>
5920 <h3><a name="150"></a>150. Find_first_of says integer instead of iterator </h3>
5921 <p><b>Section:</b> 25.1.7 [alg.find.first.of] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5922  <b>Submitter:</b> Matt McClure <b>Date:</b> 1999-06-30</p>
5923 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.find.first.of">issues</a> in [alg.find.first.of].</p>
5924 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5925 <p><b>Discussion:</b></p>
5926
5927
5928 <p><b>Proposed resolution:</b></p>
5929 <p>Change 25.1.7 [alg.find.first.of] paragraph 2 from:</p>
5930
5931 <blockquote>
5932 <p>Returns: The first iterator i in the range [first1, last1) such
5933 that for some integer j in the range [first2, last2) ...</p>
5934 </blockquote>
5935
5936 <p>to:</p>
5937
5938 <blockquote>
5939 <p>Returns: The first iterator i in the range [first1, last1) such
5940 that for some iterator j in the range [first2, last2) ...</p>
5941 </blockquote>
5942
5943
5944
5945
5946 <hr>
5947 <h3><a name="151"></a>151. Can't currently clear() empty container</h3>
5948 <p><b>Section:</b> 23.1.3 [sequence.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5949  <b>Submitter:</b> Ed Brey <b>Date:</b> 1999-06-21</p>
5950 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#sequence.reqmts">issues</a> in [sequence.reqmts].</p>
5951 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5952 <p><b>Discussion:</b></p>
5953 <p>For both sequences and associative containers, a.clear() has the
5954 semantics of erase(a.begin(),a.end()), which is undefined for an empty
5955 container since erase(q1,q2) requires that q1 be dereferenceable
5956 (23.1.1,3 and 23.1.2,7).  When the container is empty, a.begin() is
5957 not dereferenceable.<br>
5958 <br>
5959 The requirement that q1 be unconditionally dereferenceable causes many
5960 operations to be intuitively undefined, of which clearing an empty
5961 container is probably the most dire.<br>
5962 <br>
5963 Since q1 and q2 are only referenced in the range [q1, q2), and [q1,
5964 q2) is required to be a valid range, stating that q1 and q2 must be
5965 iterators or certain kinds of iterators is unnecessary.
5966 </p>
5967
5968
5969 <p><b>Proposed resolution:</b></p>
5970 <p>In 23.1.1, paragraph 3, change:</p>
5971 <blockquote>
5972   <p>p and q2 denote valid iterators to a, q and q1 denote valid dereferenceable iterators to a, [q1, q2) denotes a valid range</p>
5973 </blockquote>
5974 <p>to:</p>
5975 <blockquote>
5976   <p>p denotes a valid iterator to a, q denotes a valid dereferenceable iterator to a, [q1, q2) denotes a valid range
5977   in a</p>
5978 </blockquote>
5979 <p>In 23.1.2, paragraph 7, change:</p>
5980 <blockquote>
5981   <p>p and q2 are valid iterators to a, q and q1 are valid dereferenceable
5982   iterators to a, [q1, q2) is a valid range</p>
5983 </blockquote>
5984 <p>to</p>
5985 <blockquote>
5986   <p>p is a valid iterator to a, q is a valid dereferenceable iterator to a, [q1, q2) is a valid range
5987   into a</p>
5988 </blockquote>
5989
5990
5991
5992
5993 <hr>
5994 <h3><a name="152"></a>152. Typo in <tt>scan_is()</tt> semantics</h3>
5995 <p><b>Section:</b> 22.2.1.1.2 [locale.ctype.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
5996  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
5997 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.ctype.virtuals">issues</a> in [locale.ctype.virtuals].</p>
5998 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
5999 <p><b>Discussion:</b></p>
6000 <p>The semantics of <tt>scan_is()</tt> (paragraphs 4 and 6) is not exactly described
6001 because there is no function <tt>is()</tt> which only takes a character as
6002 argument. Also, in the effects clause (paragraph 3), the semantic is also kept
6003 vague.</p>
6004
6005
6006 <p><b>Proposed resolution:</b></p>
6007 <p>In 22.2.1.1.2 [locale.ctype.virtuals] paragraphs 4 and 6, change the returns
6008 clause from:</p>
6009 <blockquote>
6010   <p>"... such that <tt>is(*p)</tt>
6011 would..."</p>
6012 </blockquote>
6013 <p>to:&nbsp; "... such that <tt>is(m, *p)</tt>
6014  would...."</p>
6015
6016
6017
6018
6019
6020 <hr>
6021 <h3><a name="153"></a>153. Typo in <tt>narrow()</tt> semantics</h3>
6022 <p><b>Section:</b> 22.2.1.3.2 [facet.ctype.char.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
6023  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6024 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.ctype.char.members">issues</a> in [facet.ctype.char.members].</p>
6025 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
6026 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#207">207</a></p>
6027 <p><b>Discussion:</b></p>
6028 <p>The description of the array version of <tt>narrow()</tt> (in
6029 paragraph 11) is flawed: There is no member <tt>do_narrow()</tt> which
6030 takes only three arguments because in addition to the range a default
6031 character is needed.</p>
6032
6033 <p>Additionally, for both <tt>widen</tt> and <tt>narrow</tt> we have
6034 two signatures followed by a <b>Returns</b> clause that only addresses
6035 one of them.</p>
6036
6037
6038
6039 <p><b>Proposed resolution:</b></p>
6040 <p>Change the returns clause in 22.2.1.3.2 [facet.ctype.char.members]
6041 paragraph 10 from:</p>
6042 <p>&nbsp;&nbsp;&nbsp; Returns: do_widen(low, high, to).</p>
6043
6044 <p>to:</p>
6045 <p>&nbsp;&nbsp;&nbsp; Returns: do_widen(c) or do_widen(low, high, to), 
6046 respectively.</p>
6047
6048 <p>Change 22.2.1.3.2 [facet.ctype.char.members] paragraph 10 and 11 from:</p>
6049 <pre>        char        narrow(char c, char /*dfault*/) const;
6050         const char* narrow(const char* low, const char* high,
6051                            char /*dfault*/, char* to) const;</pre>
6052 <pre>        Returns: do_narrow(low, high, to).</pre>
6053 <p>to:</p>
6054 <pre>        char        narrow(char c, char dfault) const;
6055         const char* narrow(const char* low, const char* high,
6056                            char dfault, char* to) const;</pre>
6057 <pre>        Returns: do_narrow(c, dfault) or
6058                  do_narrow(low, high, dfault, to), respectively.</pre>
6059
6060 <p><i>[Kona: 1) the problem occurs in additional places, 2) a user
6061 defined version could be different.]</i></p>
6062
6063
6064 <p><i>[Post-Tokyo: Dietmar provided the above wording at the request of
6065 the LWG. He could find no other places the problem occurred. He
6066 asks for clarification of the Kona "a user defined
6067 version..." comment above.  Perhaps it was a circuitous way of
6068 saying "dfault" needed to be uncommented?]</i></p>
6069
6070
6071 <p><i>[Post-Toronto: the issues list maintainer has merged in the
6072 proposed resolution from issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#207">207</a>, which addresses the
6073 same paragraphs.]</i></p>
6074
6075
6076
6077
6078
6079
6080 <hr>
6081 <h3><a name="154"></a>154. Missing <tt>double</tt> specifier for <tt>do_get()</tt></h3>
6082 <p><b>Section:</b> 22.2.2.1.2 [facet.num.get.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6083  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6084 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#facet.num.get.virtuals">active issues</a> in [facet.num.get.virtuals].</p>
6085 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.virtuals">issues</a> in [facet.num.get.virtuals].</p>
6086 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6087 <p><b>Discussion:</b></p>
6088 <p>The table in paragraph 7 for the length modifier does not list the length
6089 modifier <tt>l</tt> to be applied if the type is <tt>double</tt>. Thus, the
6090 standard asks the implementation to do undefined things when using <tt>scanf()</tt>
6091 (the missing length modifier for <tt>scanf()</tt> when scanning <tt>double</tt>s
6092 is actually a problem I found quite often in production code, too).</p>
6093
6094
6095 <p><b>Proposed resolution:</b></p>
6096 <p>In 22.2.2.1.2 [facet.num.get.virtuals], paragraph 7, add a row in the Length
6097 Modifier table to say that for <tt>double</tt> a length modifier
6098 <tt>l</tt> is to be used.</p>
6099
6100
6101 <p><b>Rationale:</b></p>
6102 <p>The standard makes an embarrassing beginner's mistake.</p>
6103
6104
6105
6106
6107 <hr>
6108 <h3><a name="155"></a>155. Typo in naming the class defining the class <tt>Init</tt></h3>
6109 <p><b>Section:</b> 27.3 [iostream.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6110  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6111 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostream.objects">issues</a> in [iostream.objects].</p>
6112 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6113 <p><b>Discussion:</b></p>
6114 <p>There are conflicting statements about where the class
6115 <tt>Init</tt> is defined. According to 27.3 [iostream.objects] paragraph 2
6116 it is defined as <tt>basic_ios::Init</tt>, according to 27.4.2 [ios.base] it is defined as <tt>ios_base::Init</tt>.</p>
6117
6118
6119 <p><b>Proposed resolution:</b></p>
6120 <p>Change 27.3 [iostream.objects] paragraph 2 from
6121 "<tt>basic_ios::Init"</tt> to
6122 "<tt>ios_base::Init"</tt>.</p>
6123
6124
6125 <p><b>Rationale:</b></p>
6126 <p>Although not strictly wrong, the standard was misleading enough to warrant
6127 the change.</p>
6128
6129
6130
6131
6132 <hr>
6133 <h3><a name="156"></a>156. Typo in <tt>imbue()</tt> description</h3>
6134 <p><b>Section:</b> 27.4.2.3 [ios.base.locales] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6135  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6136 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios.base.locales">issues</a> in [ios.base.locales].</p>
6137 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6138 <p><b>Discussion:</b></p>
6139 <p>There is a small discrepancy between the declarations of
6140 <tt>imbue()</tt>: in 27.4.2 [ios.base] the argument is passed as
6141 <tt>locale const&amp;</tt> (correct), in 27.4.2.3 [ios.base.locales] it
6142 is passed as <tt>locale const</tt> (wrong).</p>
6143
6144
6145 <p><b>Proposed resolution:</b></p>
6146 <p>In 27.4.2.3 [ios.base.locales] change the <tt>imbue</tt> argument
6147 from "<tt>locale const" to "locale
6148 const&amp;".</tt></p>
6149
6150
6151
6152
6153 <hr>
6154 <h3><a name="158"></a>158. Underspecified semantics for <tt>setbuf()</tt></h3>
6155 <p><b>Section:</b> 27.5.2.4.2 [streambuf.virt.buffer] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6156  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6157 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#streambuf.virt.buffer">issues</a> in [streambuf.virt.buffer].</p>
6158 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6159 <p><b>Discussion:</b></p>
6160 <p>The default behavior of <tt>setbuf()</tt> is described only for the
6161 situation that <tt>gptr() != 0 &amp;&amp; gptr() != egptr()</tt>:
6162 namely to do nothing.  What has to be done in other situations&nbsp;
6163 is not described although there is actually only one reasonable
6164 approach, namely to do nothing, too.</p> 
6165
6166 <p>Since changing the buffer would almost certainly mess up most
6167 buffer management of derived classes unless these classes do it
6168 themselves, the default behavior of <tt>setbuf()</tt> should always be
6169 to do nothing.</p>
6170
6171
6172 <p><b>Proposed resolution:</b></p>
6173 <p>Change 27.5.2.4.2 [streambuf.virt.buffer], paragraph 3, Default behavior,
6174 to: "Default behavior: Does nothing. Returns this."</p>
6175
6176
6177
6178
6179 <hr>
6180 <h3><a name="159"></a>159. Strange use of <tt>underflow()</tt></h3>
6181 <p><b>Section:</b> 27.5.2.4.3 [streambuf.virt.get] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6182  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6183 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6184 <p><b>Discussion:</b></p>
6185 <p>The description of the meaning of the result of
6186 <tt>showmanyc()</tt> seems to be rather strange: It uses calls to
6187 <tt>underflow()</tt>. Using <tt>underflow()</tt> is strange because
6188 this function only reads the current character but does not extract
6189 it, <tt>uflow()</tt> would extract the current character. This should
6190 be fixed to use <tt>sbumpc()</tt> instead.</p>
6191
6192
6193 <p><b>Proposed resolution:</b></p>
6194 <p>Change 27.5.2.4.3 [streambuf.virt.get] paragraph 1,
6195 <tt>showmanyc()</tt>returns clause, by replacing the word
6196 "supplied" with the words "extracted from the
6197 stream".</p>
6198
6199
6200
6201
6202 <hr>
6203 <h3><a name="160"></a>160. Typo: Use of non-existing function <tt>exception()</tt></h3>
6204 <p><b>Section:</b> 27.6.1.1 [istream] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6205  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6206 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream">issues</a> in [istream].</p>
6207 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6208 <p><b>Discussion:</b></p>
6209 <p>The paragraph 4 refers to the function <tt>exception()</tt> which
6210 is not defined. Probably, the referred function is
6211 <tt>basic_ios&lt;&gt;::exceptions()</tt>.</p>
6212
6213
6214 <p><b>Proposed resolution:</b></p>
6215 <p>In 27.6.1.1 [istream], 27.6.1.3 [istream.unformatted], paragraph 1,
6216 27.6.2.1 [ostream], paragraph 3, and 27.6.2.6.1 [ostream.formatted.reqmts],
6217 paragraph 1, change "<tt>exception()" to
6218 "exceptions()"</tt>.</p>
6219
6220 <p><i>[Note to Editor: "exceptions" with an "s"
6221 is the correct spelling.]</i></p>
6222
6223
6224
6225
6226
6227
6228 <hr>
6229 <h3><a name="161"></a>161. Typo: <tt>istream_iterator</tt> vs. <tt>istreambuf_iterator</tt></h3>
6230 <p><b>Section:</b> 27.6.1.2.2 [istream.formatted.arithmetic] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6231  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6232 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.formatted.arithmetic">issues</a> in [istream.formatted.arithmetic].</p>
6233 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6234 <p><b>Discussion:</b></p>
6235 <p>The note in the second paragraph pretends that the first argument
6236 is an object of type <tt>istream_iterator</tt>. This is wrong: It is
6237 an object of type <tt>istreambuf_iterator</tt>.</p>
6238
6239
6240 <p><b>Proposed resolution:</b></p>
6241 <p>Change 27.6.1.2.2 [istream.formatted.arithmetic] from:</p>
6242 <blockquote>
6243   <p>The first argument provides an object of the istream_iterator class...</p>
6244 </blockquote>
6245 <p>to</p>
6246 <blockquote>
6247   <p>The first argument provides an object of the istreambuf_iterator class...</p>
6248 </blockquote>
6249
6250
6251
6252
6253
6254 <hr>
6255 <h3><a name="164"></a>164. do_put() has apparently unused fill argument</h3>
6256 <p><b>Section:</b> 22.2.5.3.2 [locale.time.put.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6257  <b>Submitter:</b> Angelika Langer <b>Date:</b> 1999-07-23</p>
6258 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6259 <p><b>Discussion:</b></p>
6260 <p>In 22.2.5.3.2 [locale.time.put.virtuals] the do_put() function is specified
6261 as taking a fill character as an argument, but the description of the
6262 function does not say whether the character is used at all and, if so,
6263 in which way. The same holds for any format control parameters that
6264 are accessible through the ios_base&amp; argument, such as the
6265 adjustment or the field width. Is strftime() supposed to use the fill
6266 character in any way? In any case, the specification of
6267 time_put.do_put() looks inconsistent to me.<br> <br> Is the
6268 signature of do_put() wrong, or is the effects clause incomplete?</p>
6269
6270
6271 <p><b>Proposed resolution:</b></p>
6272 <p>Add the following note after 22.2.5.3.2 [locale.time.put.virtuals]
6273 paragraph 2:</p>
6274 <blockquote>
6275   <p>  [Note: the <tt>fill</tt> argument may be used in the implementation-defined  formats, or by derivations.  A space character is a reasonable default
6276   for this argument. --end Note]</p>
6277 </blockquote>
6278
6279
6280 <p><b>Rationale:</b></p>
6281 <p>The LWG felt that while the normative text was correct,
6282 users need some guidance on what to pass for the <tt>fill</tt>
6283 argument since the standard doesn't say how it's used.</p>
6284
6285
6286
6287
6288 <hr>
6289 <h3><a name="165"></a>165. <tt>xsputn()</tt>, <tt>pubsync()</tt> never called by <tt>basic_ostream</tt> members?</h3>
6290 <p><b>Section:</b> 27.6.2.1 [ostream] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
6291  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6292 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream">issues</a> in [ostream].</p>
6293 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
6294 <p><b>Discussion:</b></p>
6295 <p>Paragraph 2 explicitly states that none of the <tt>basic_ostream</tt>
6296 functions falling into one of the groups "formatted output functions"
6297 and "unformatted output functions" calls any stream buffer function
6298 which might call a virtual function other than <tt>overflow()</tt>. Basically
6299 this is fine but this implies that <tt>sputn()</tt> (this function would call
6300 the virtual function <tt>xsputn()</tt>) is never called by any of the standard
6301 output functions. Is this really intended? At minimum it would be convenient to
6302 call <tt>xsputn()</tt> for strings... Also, the statement that <tt>overflow()</tt>
6303 is the only virtual member of <tt>basic_streambuf</tt> called is in conflict
6304 with the definition of <tt>flush()</tt> which calls <tt>rdbuf()-&gt;pubsync()</tt>
6305 and thereby the virtual function <tt>sync()</tt> (<tt>flush()</tt> is listed
6306 under "unformatted output functions").</p>
6307 <p>In addition, I guess that the sentence starting with "They may use other
6308 public members of <tt>basic_ostream</tt> ..." probably was intended to
6309 start with "They may use other public members of <tt>basic_streamuf</tt>..."
6310 although the problem with the virtual members exists in both cases.</p>
6311 <p>I see two obvious resolutions:</p>
6312 <ol>
6313   <li>state in a footnote that this means that <tt>xsputn()</tt> will never be
6314     called by any ostream member and that this is intended.</li>
6315   <li>relax the restriction and allow calling <tt>overflow()</tt> and <tt>xsputn()</tt>.
6316     Of course, the problem with <tt>flush()</tt> has to be resolved in some way.</li>
6317 </ol>
6318
6319
6320 <p><b>Proposed resolution:</b></p>
6321 <p>Change the last sentence of 27.6.2.1 (lib.ostream) paragraph 2 from:</p>
6322 <blockquote>
6323   <p>They may use other public members of basic_ostream except that they do not
6324   invoke any virtual members of rdbuf() except overflow().</p>
6325 </blockquote>
6326 <p>to:</p>
6327 <blockquote>
6328   <p>They may use other public members of basic_ostream except that they shall
6329   not invoke any virtual members of rdbuf() except overflow(), xsputn(), and
6330   sync().</p>
6331 </blockquote>
6332
6333 <p><i>[Kona: the LWG believes this is a problem. Wish to ask Jerry or
6334 PJP why the standard is written this way.]</i></p>
6335
6336
6337 <p><i>[Post-Tokyo: Dietmar supplied wording at the request of the
6338 LWG. He comments: The rules can be made a little bit more specific if
6339 necessary be explicitly spelling out what virtuals are allowed to be
6340 called from what functions and eg to state specifically that flush()
6341 is allowed to call sync() while other functions are not.]</i></p>
6342
6343
6344
6345
6346
6347
6348 <hr>
6349 <h3><a name="167"></a>167. Improper use of <tt>traits_type::length()</tt></h3>
6350 <p><b>Section:</b> 27.6.2.6.4 [ostream.inserters.character] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
6351  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6352 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.inserters.character">issues</a> in [ostream.inserters.character].</p>
6353 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
6354 <p><b>Discussion:</b></p>
6355 <p>Paragraph 4 states that the length is determined using
6356 <tt>traits::length(s)</tt>.  Unfortunately, this function is not
6357 defined for example if the character type is <tt>wchar_t</tt> and the
6358 type of <tt>s</tt> is <tt>char const*</tt>. Similar problems exist if
6359 the character type is <tt>char</tt> and the type of <tt>s</tt> is
6360 either <tt>signed char const*</tt> or <tt>unsigned char
6361 const*</tt>.</p>
6362
6363
6364 <p><b>Proposed resolution:</b></p>
6365 <p>Change 27.6.2.6.4 [ostream.inserters.character] paragraph 4 from:</p>
6366 <blockquote>
6367   <p>Effects: Behaves like an formatted inserter (as described in
6368   lib.ostream.formatted.reqmts) of out. After a sentry object is
6369   constructed it inserts characters. The number of characters starting
6370   at s to be inserted is traits::length(s). Padding is determined as
6371   described in lib.facet.num.put.virtuals. The traits::length(s)
6372   characters starting at s are widened using out.widen
6373   (lib.basic.ios.members). The widened characters and any required
6374   padding are inserted into out. Calls width(0).</p>
6375 </blockquote>
6376 <p>to:</p>
6377 <blockquote>
6378   <p>Effects: Behaves like a formatted inserter (as described in
6379   lib.ostream.formatted.reqmts) of out. After a sentry object is
6380   constructed it inserts <i>n</i> characters starting at <i>s</i>,
6381   where <i>n</i> is the number that would be computed as if by:</p>
6382   <ul>
6383   <li>traits::length(s) for the overload where the first argument is of
6384     type basic_ostream&lt;charT, traits&gt;&amp; and the second is
6385     of type const charT*, and also for the overload where the first
6386     argument is of type basic_ostream&lt;char, traits&gt;&amp; and
6387     the second is of type const char*.</li>
6388   <li>std::char_traits&lt;char&gt;::length(s) 
6389     for the overload where the first argument is of type 
6390     basic_ostream&lt;charT, traits&gt;&amp; and the second is of type
6391     const char*.</li>
6392   <li>traits::length(reinterpret_cast&lt;const char*&gt;(s)) 
6393     for the other two overloads.</li>
6394   </ul>
6395   <p>Padding is determined as described in
6396   lib.facet.num.put.virtuals. The <i>n</i> characters starting at
6397   <i>s</i> are widened using out.widen (lib.basic.ios.members).  The
6398   widened characters and any required padding are inserted into
6399   out. Calls width(0).</p>
6400 </blockquote>
6401
6402 <p><i>[Santa Cruz: Matt supplied new wording]</i></p>
6403
6404
6405 <p><i>[Kona: changed "where <i>n</i> is" to " where <i>n</i> is the
6406   number that would be computed as if by"]</i></p>
6407  
6408
6409
6410
6411 <p><b>Rationale:</b></p>
6412 <p>We have five separate cases.  In two of them we can use the
6413 user-supplied traits class without any fuss.  In the other three we
6414 try to use something as close to that user-supplied class as possible.
6415 In two cases we've got a traits class that's appropriate for
6416 char and what we've got is a const signed char* or a const
6417 unsigned char*; that's close enough so we can just use a reinterpret
6418 cast, and continue to use the user-supplied traits class.  Finally,
6419 there's one case where we just have to give up: where we've got a
6420 traits class for some arbitrary charT type, and we somehow have to
6421 deal with a const char*.  There's nothing better to do but fall back
6422 to char_traits&lt;char&gt;</p>
6423
6424
6425
6426
6427
6428 <hr>
6429 <h3><a name="168"></a>168. Typo: formatted vs. unformatted</h3>
6430 <p><b>Section:</b> 27.6.2.7 [ostream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6431  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6432 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.unformatted">issues</a> in [ostream.unformatted].</p>
6433 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6434 <p><b>Discussion:</b></p>
6435 <p>The first paragraph begins with a descriptions what has to be done
6436 in <i>formatted</i> output functions. Probably this is a typo and the
6437 paragraph really want to describe unformatted output functions...</p>
6438
6439
6440 <p><b>Proposed resolution:</b></p>
6441 <p>In 27.6.2.7 [ostream.unformatted] paragraph 1, the first and last
6442 sentences, change the word "formatted" to
6443 "unformatted":</p>
6444 <blockquote>
6445   <p>"Each <b>unformatted </b> output function begins ..."<br>
6446   "... value specified for the <b>unformatted </b>  output 
6447   function."</p>
6448 </blockquote>
6449
6450
6451
6452
6453 <hr>
6454 <h3><a name="169"></a>169. Bad efficiency of <tt>overflow()</tt> mandated</h3>
6455 <p><b>Section:</b> 27.7.1.4 [stringbuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6456  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6457 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#stringbuf.virtuals">issues</a> in [stringbuf.virtuals].</p>
6458 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6459 <p><b>Discussion:</b></p>
6460 <p>Paragraph 8, Notes, of this section seems to mandate an extremely
6461 inefficient way of buffer handling for <tt>basic_stringbuf</tt>,
6462 especially in view of the restriction that <tt>basic_ostream</tt>
6463 member functions are not allowed to use <tt>xsputn()</tt> (see 27.6.2.1 [ostream]): For each character to be inserted, a new buffer
6464 is to be created.</p> 
6465 <p>Of course, the resolution below requires some handling of
6466 simultaneous input and output since it is no longer possible to update
6467 <tt>egptr()</tt> whenever <tt>epptr()</tt> is changed. A possible
6468 solution is to handle this in <tt>underflow()</tt>.</p>
6469
6470
6471 <p><b>Proposed resolution:</b></p>
6472 <p>In 27.7.1.4 [stringbuf.virtuals] paragraph 8, Notes, insert the words
6473 "at least" as in the following:</p>
6474 <blockquote>
6475   <p>To make a write position available, the function reallocates (or initially
6476   allocates) an array object with a sufficient number of elements to hold the
6477   current array object (if any), plus <b>at least</b> one additional write
6478   position.</p>
6479 </blockquote>
6480
6481
6482
6483
6484 <hr>
6485 <h3><a name="170"></a>170. Inconsistent definition of <tt>traits_type</tt></h3>
6486 <p><b>Section:</b> 27.7.4 [stringstream] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6487  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6488 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6489 <p><b>Discussion:</b></p>
6490 <p>The classes <tt>basic_stringstream</tt> (27.7.4 [stringstream]),
6491 <tt>basic_istringstream</tt> (27.7.2 [istringstream]), and
6492 <tt>basic_ostringstream</tt> (27.7.3 [ostringstream]) are inconsistent
6493 in their definition of the type <tt>traits_type</tt>: For
6494 <tt>istringstream</tt>, this type is defined, for the other two it is
6495 not. This should be consistent.</p>
6496
6497
6498 <p><b>Proposed resolution:</b></p>
6499 <p><b>Proposed resolution:</b></p> <p>To the declarations of
6500 <tt>basic_ostringstream</tt> (27.7.3 [ostringstream]) and
6501 <tt>basic_stringstream</tt> (27.7.4 [stringstream]) add:</p>
6502 <blockquote>
6503 <pre>typedef traits traits_type;</pre>
6504 </blockquote>
6505
6506
6507
6508
6509 <hr>
6510 <h3><a name="171"></a>171. Strange <tt>seekpos()</tt> semantics due to joint position</h3>
6511 <p><b>Section:</b> 27.8.1.5 [filebuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
6512  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-20</p>
6513 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#filebuf.virtuals">issues</a> in [filebuf.virtuals].</p>
6514 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
6515 <p><b>Discussion:</b></p>
6516 <p>Overridden virtual functions, seekpos()</p> <p>In 27.8.1.1 [filebuf] paragraph 3, it is stated that a joint input and
6517 output position is maintained by <tt>basic_filebuf</tt>. Still, the
6518 description of <tt>seekpos()</tt> seems to talk about different file
6519 positions. In particular, it is unclear (at least to me) what is
6520 supposed to happen to the output buffer (if there is one) if only the
6521 input position is changed. The standard seems to mandate that the
6522 output buffer is kept and processed as if there was no positioning of
6523 the output position (by changing the input position). Of course, this
6524 can be exactly what you want if the flag <tt>ios_base::ate</tt> is
6525 set. However, I think, the standard should say something like
6526 this:</p>
6527 <ul>
6528   <li>If <tt>(which &amp; mode) == 0</tt> neither read nor write position is
6529     changed and the call fails. Otherwise, the joint read and write position is
6530     altered to correspond to <tt>sp</tt>.</li>
6531   <li>If there is an output buffer, the output sequences is updated and any
6532     unshift sequence is written before the position is altered.</li>
6533   <li>If there is an input buffer, the input sequence is updated after the
6534     position is altered.</li>
6535 </ul>
6536 <p>Plus the appropriate error handling, that is...</p>
6537
6538
6539 <p><b>Proposed resolution:</b></p>
6540 <p>Change the unnumbered paragraph in 27.8.1.4 (lib.filebuf.virtuals) before
6541 paragraph 14 from:</p>
6542 <blockquote>
6543   <p>pos_type seekpos(pos_type sp, ios_base::openmode = ios_base::in |
6544   ios_base::out);</p>
6545   <p>Alters the file position, if possible, to correspond to the position stored
6546   in sp (as described below).</p>
6547   <p>- if (which&amp;ios_base::in)!=0, set the file position to sp, then update
6548   the input sequence</p>
6549   <p>- if (which&amp;ios_base::out)!=0, then update the output sequence, write
6550   any unshift sequence, and set the file position to sp.</p>
6551 </blockquote>
6552 <p>to:</p>
6553 <blockquote>
6554   <p>pos_type seekpos(pos_type sp, ios_base::openmode = ios_base::in |
6555   ios_base::out);</p>
6556   <p>Alters the file position, if possible, to correspond to the position stored
6557   in sp (as described below). Altering the file position performs as follows:</p>
6558   <p>1. if (om &amp; ios_base::out)!=0, then update the output sequence and
6559   write any unshift sequence;</p>
6560   <p>2. set the file position to sp;</p>
6561   <p>3. if (om &amp; ios_base::in)!=0, then update the input sequence;</p>
6562   <p>where om is the open mode passed to the last call to open(). The operation
6563   fails if is_open() returns false.</p>
6564 </blockquote>
6565
6566 <p><i>[Kona: Dietmar is working on a proposed resolution.]</i></p>
6567
6568 <p><i>[Post-Tokyo: Dietmar supplied the above wording.]</i></p>
6569
6570
6571
6572
6573
6574
6575 <hr>
6576 <h3><a name="172"></a>172. Inconsistent types for <tt>basic_istream::ignore()</tt></h3>
6577 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6578  <b>Submitter:</b> Greg Comeau, Dietmar Kühl <b>Date:</b> 1999-07-23</p>
6579 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
6580 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6581 <p><b>Discussion:</b></p>
6582 <p>In 27.6.1.1 [istream] the function
6583 <tt>ignore()</tt> gets an object of type <tt>streamsize</tt> as first
6584 argument. However, in 27.6.1.3 [istream.unformatted]
6585 paragraph 23 the first argument is of type <tt>int.</tt></p>
6586
6587 <p>As far as I can see this is not really a contradiction because
6588 everything is consistent if <tt>streamsize</tt> is typedef to be
6589 <tt>int</tt>. However, this is almost certainly not what was
6590 intended. The same thing happened to <tt>basic_filebuf::setbuf()</tt>,
6591 as described in issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#173">173</a>.</p>
6592
6593 <p>Darin Adler also
6594 submitted this issue, commenting: Either 27.6.1.1 should be modified
6595 to show a first parameter of type int, or 27.6.1.3 should be modified
6596 to show a first parameter of type streamsize and use
6597 numeric_limits&lt;streamsize&gt;::max.</p>
6598
6599
6600 <p><b>Proposed resolution:</b></p>
6601 <p>In 27.6.1.3 [istream.unformatted] paragraph 23 and 24, change both uses
6602 of <tt>int</tt> in the description of <tt>ignore()</tt> to
6603 <tt>streamsize</tt>.</p>
6604
6605
6606
6607
6608 <hr>
6609 <h3><a name="173"></a>173. Inconsistent types for <tt>basic_filebuf::setbuf()</tt></h3>
6610 <p><b>Section:</b> 27.8.1.5 [filebuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6611  <b>Submitter:</b> Greg Comeau, Dietmar Kühl <b>Date:</b> 1999-07-23</p>
6612 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#filebuf.virtuals">issues</a> in [filebuf.virtuals].</p>
6613 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6614 <p><b>Discussion:</b></p>
6615
6616 <p>
6617 In 27.8.1.1 [filebuf] the function <tt>setbuf()</tt> gets an
6618 object of type <tt>streamsize</tt> as second argument. However, in
6619 27.8.1.5 [filebuf.virtuals] paragraph 9 the second argument is of type
6620 <tt>int</tt>.
6621 </p>
6622
6623 <p>
6624 As far as I can see this is not really a contradiction because
6625 everything is consistent if <tt>streamsize</tt> is typedef to be
6626 <tt>int</tt>. However, this is almost certainly not what was
6627 intended. The same thing happened to <tt>basic_istream::ignore()</tt>,
6628 as described in issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#172">172</a>.
6629 </p>
6630
6631
6632
6633 <p><b>Proposed resolution:</b></p>
6634 <p>In 27.8.1.5 [filebuf.virtuals] paragraph 9, change all uses of
6635 <tt>int</tt> in the description of <tt>setbuf()</tt> to
6636 <tt>streamsize</tt>.</p>
6637
6638
6639
6640
6641 <hr>
6642 <h3><a name="174"></a>174. Typo: <tt>OFF_T</tt> vs. <tt>POS_T</tt></h3>
6643 <p><b>Section:</b> D.6 [depr.ios.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6644  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-23</p>
6645 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.ios.members">issues</a> in [depr.ios.members].</p>
6646 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6647 <p><b>Discussion:</b></p>
6648 <p>According to paragraph 1 of this section, <tt>streampos</tt> is the
6649 type <tt>OFF_T</tt>, the same type as <tt>streamoff</tt>. However, in
6650 paragraph 6 the <tt>streampos</tt> gets the type <tt>POS_T</tt></p>
6651
6652
6653 <p><b>Proposed resolution:</b></p>
6654 <p>Change D.6 [depr.ios.members] paragraph 1 from "<tt>typedef
6655 OFF_T streampos;</tt>" to "<tt>typedef POS_T
6656 streampos;</tt>"</p>
6657
6658
6659
6660
6661 <hr>
6662 <h3><a name="175"></a>175. Ambiguity for <tt>basic_streambuf::pubseekpos()</tt> and a few other functions.</h3>
6663 <p><b>Section:</b> D.6 [depr.ios.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6664  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-23</p>
6665 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.ios.members">issues</a> in [depr.ios.members].</p>
6666 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6667 <p><b>Discussion:</b></p>
6668 <p>According to paragraph 8 of this section, the methods
6669 <tt>basic_streambuf::pubseekpos()</tt>,
6670 <tt>basic_ifstream::open()</tt>, and <tt>basic_ofstream::open</tt>
6671 "may" be overloaded by a version of this function taking the
6672 type <tt>ios_base::open_mode</tt> as last argument argument instead of
6673 <tt>ios_base::openmode</tt> (<tt>ios_base::open_mode</tt> is defined
6674 in this section to be an alias for one of the integral types). The
6675 clause specifies, that the last argument has a default argument in
6676 three cases.  However, this generates an ambiguity with the overloaded
6677 version because now the arguments are absolutely identical if the last
6678 argument is not specified.</p>
6679
6680
6681 <p><b>Proposed resolution:</b></p>
6682 <p>In D.6 [depr.ios.members] paragraph 8, remove the default arguments for
6683 <tt>basic_streambuf::pubseekpos()</tt>,
6684 <tt>basic_ifstream::open()</tt>, and
6685 <tt>basic_ofstream::open().</tt></p>
6686
6687
6688
6689
6690 <hr>
6691 <h3><a name="176"></a>176. <tt>exceptions()</tt> in <tt>ios_base</tt>...?</h3>
6692 <p><b>Section:</b> D.6 [depr.ios.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6693  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 1999-07-23</p>
6694 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.ios.members">issues</a> in [depr.ios.members].</p>
6695 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6696 <p><b>Discussion:</b></p>
6697 <p>The "overload" for the function <tt>exceptions()</tt> in
6698 paragraph 8 gives the impression that there is another function of
6699 this function defined in class <tt>ios_base</tt>. However, this is not
6700 the case. Thus, it is hard to tell how the semantics (paragraph 9) can
6701 be implemented: "Call the corresponding member function specified
6702 in clause 27 [input.output]."</p>
6703
6704
6705 <p><b>Proposed resolution:</b></p>
6706 <p>In D.6 [depr.ios.members] paragraph 8, move the declaration of the
6707 function <tt>exceptions()</tt>into class <tt>basic_ios</tt>.</p>
6708
6709
6710
6711
6712 <hr>
6713 <h3><a name="179"></a>179. Comparison of const_iterators to iterators doesn't work</h3>
6714 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
6715  <b>Submitter:</b> Judy Ward <b>Date:</b> 1998-07-02</p>
6716 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
6717 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
6718 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
6719 <p><b>Discussion:</b></p>
6720 <p>Currently the following will not compile on two well-known standard
6721 library implementations:</p>
6722
6723 <blockquote>
6724   <pre>#include &lt;set&gt;
6725 using namespace std;
6726
6727 void f(const set&lt;int&gt; &amp;s)
6728 {
6729   set&lt;int&gt;::iterator i;
6730   if (i==s.end()); // s.end() returns a const_iterator
6731 }</pre>
6732 </blockquote>
6733
6734 <p>
6735 The reason this doesn't compile is because operator== was implemented
6736 as a member function of the nested classes set:iterator and
6737 set::const_iterator, and there is no conversion from const_iterator to
6738 iterator. Surprisingly, (s.end() == i) does work, though, because of
6739 the conversion from iterator to const_iterator.
6740 </p>
6741
6742 <p>
6743 I don't see a requirement anywhere in the standard that this must
6744 work. Should there be one?  If so, I think the requirement would need
6745 to be added to the tables in section 24.1.1. I'm not sure about the
6746 wording.  If this requirement existed in the standard, I would think
6747 that implementors would have to make the comparison operators
6748 non-member functions.</p>
6749
6750 <p>This issues was also raised on comp.std.c++ by Darin
6751 Adler.&nbsp; The example given was:</p>
6752
6753 <blockquote>
6754   <pre>bool check_equal(std::deque&lt;int&gt;::iterator i,
6755 std::deque&lt;int&gt;::const_iterator ci)
6756 {
6757 return i == ci;
6758 }</pre>
6759 </blockquote>
6760
6761 <p>Comment from John Potter:</p>
6762 <blockquote>
6763     <p>
6764     In case nobody has noticed, accepting it will break reverse_iterator.
6765     </p>
6766
6767     <p>
6768     The fix is to make the comparison operators templated on two types.
6769     </p>
6770
6771     <pre>    template &lt;class Iterator1, class Iterator2&gt;
6772     bool operator== (reverse_iterator&lt;Iterator1&gt; const&amp; x,
6773                      reverse_iterator&lt;Iterator2&gt; const&amp; y);
6774     </pre>
6775
6776     <p>
6777     Obviously:  return x.base() == y.base();
6778     </p>
6779
6780     <p>
6781     Currently, no reverse_iterator to const_reverse_iterator compares are
6782     valid.
6783     </p>
6784
6785     <p>
6786     BTW, I think the issue is in support of bad code.  Compares should be
6787     between two iterators of the same type.  All std::algorithms require
6788     the begin and end iterators to be of the same type. 
6789     </p>
6790 </blockquote>
6791
6792
6793 <p><b>Proposed resolution:</b></p>
6794 <p>Insert this paragraph after 23.1 [container.requirements] paragraph 7:</p>
6795 <blockquote>
6796   <p>In the expressions</p>
6797   <pre>    i == j
6798     i != j
6799     i &lt; j
6800     i &lt;= j
6801     i &gt;= j
6802     i &gt; j
6803     i - j
6804   </pre>
6805   <p>Where i and j denote objects of a container's iterator type,
6806   either or both may be replaced by an object of the container's
6807   const_iterator type referring to the same element with no
6808   change in semantics.</p>
6809 </blockquote>
6810
6811 <p><i>[post-Toronto: Judy supplied a proposed resolution saying that
6812 <tt>iterator</tt> and <tt>const_iterator</tt> could be freely mixed in
6813 iterator comparison and difference operations.]</i></p>
6814
6815
6816 <p><i>[Redmond: Dave and Howard supplied a new proposed resolution which
6817 explicitly listed expressions; there was concern that the previous
6818 proposed resolution was too informal.]</i></p>
6819
6820
6821
6822 <p><b>Rationale:</b></p>
6823 <p>
6824 The LWG believes it is clear that the above wording applies only to
6825 the nested types <tt>X::iterator</tt> and <tt>X::const_iterator</tt>,
6826 where <tt>X</tt> is a container.  There is no requirement that
6827 <tt>X::reverse_iterator</tt> and <tt>X::const_reverse_iterator</tt>
6828 can be mixed.  If mixing them is considered important, that's a
6829 separate issue.  (Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#280">280</a>.)
6830 </p>
6831
6832
6833
6834
6835 <hr>
6836 <h3><a name="181"></a>181. make_pair() unintended behavior</h3>
6837 <p><b>Section:</b> 20.2.3 [pairs] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
6838  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 1999-08-03</p>
6839 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#pairs">issues</a> in [pairs].</p>
6840 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
6841 <p><b>Discussion:</b></p>
6842 <p>The claim has surfaced in Usenet that expressions such as<br>
6843 <br>
6844 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tt>make_pair("abc", 3)</tt><br>
6845 <br>
6846 are illegal, notwithstanding their use in examples, because template instantiation tries to bind the first template
6847 parameter to <tt> const char (&amp;)[4]</tt>, which type is uncopyable.<br>
6848 <br>
6849 I doubt anyone intended that behavior...
6850 </p>
6851
6852
6853 <p><b>Proposed resolution:</b></p>
6854 <p>In 20.2 [utility], paragraph 1 change the following
6855 declaration of make_pair():</p>
6856 <blockquote>
6857   <pre>template &lt;class T1, class T2&gt; pair&lt;T1,T2&gt; make_pair(const T1&amp;, const T2&amp;);</pre>
6858 </blockquote>
6859 <p>to:</p>
6860 <blockquote>
6861   <pre>template &lt;class T1, class T2&gt; pair&lt;T1,T2&gt; make_pair(T1, T2);</pre>
6862 </blockquote>
6863 <p>  In 20.2.3 [pairs] paragraph 7 and the line before, change:</p>
6864 <blockquote>
6865 <pre>template &lt;class T1, class T2&gt;
6866 pair&lt;T1, T2&gt; make_pair(const T1&amp; x, const T2&amp; y);</pre>
6867 </blockquote>
6868 <p>to:</p>
6869 <blockquote>
6870 <pre>template &lt;class T1, class T2&gt;
6871 pair&lt;T1, T2&gt; make_pair(T1 x, T2 y);</pre>
6872 </blockquote>
6873 <p>and add the following footnote to the effects clause:</p>
6874 <blockquote>
6875   <p> According to 12.8 [class.copy], an implementation is permitted
6876   to not perform a copy of an argument, thus avoiding unnecessary
6877   copies.</p>
6878 </blockquote>
6879
6880
6881 <p><b>Rationale:</b></p>
6882 <p>Two potential fixes were suggested by Matt Austern and Dietmar
6883 Kühl, respectively, 1) overloading with array arguments, and 2) use of
6884 a reference_traits class with a specialization for arrays.  Andy
6885 Koenig suggested changing to pass by value. In discussion, it appeared
6886 that this was a much smaller change to the standard that the other two
6887 suggestions, and any efficiency concerns were more than offset by the
6888 advantages of the solution. Two implementors reported that the
6889 proposed resolution passed their test suites.</p>
6890
6891
6892
6893
6894 <hr>
6895 <h3><a name="182"></a>182. Ambiguous references to size_t</h3>
6896 <p><b>Section:</b> 17 [library] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
6897  <b>Submitter:</b> Al Stevens <b>Date:</b> 1999-08-15</p>
6898 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#library">issues</a> in [library].</p>
6899 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
6900 <p><b>Discussion:</b></p>
6901 <p>Many references to <tt> size_t</tt> throughout the document
6902 omit the <tt> std::</tt> namespace qualification.</p> <p>For
6903 example, 17.4.3.5 [replacement.functions] paragraph 2:</p>
6904 <blockquote>
6905 <pre> operator new(size_t)
6906  operator new(size_t, const std::nothrow_t&amp;)
6907  operator new[](size_t)
6908  operator new[](size_t, const std::nothrow_t&amp;)</pre>
6909 </blockquote>
6910
6911
6912 <p><b>Proposed resolution:</b></p>
6913 <p>   In 17.4.3.5 [replacement.functions] paragraph 2: replace:</p>
6914 <blockquote>
6915 <p><tt>     - operator new(size_t)<br>
6916      - operator new(size_t, const std::nothrow_t&amp;)<br>
6917      - operator new[](size_t)<br>
6918      - operator new[](size_t, const std::nothrow_t&amp;)</tt></p>
6919 </blockquote>
6920 <p>    by:</p>
6921 <blockquote>
6922 <pre>- operator new(std::size_t)
6923 - operator new(std::size_t, const std::nothrow_t&amp;)
6924 - operator new[](std::size_t)
6925 - operator new[](std::size_t, const std::nothrow_t&amp;)</pre>
6926 </blockquote>
6927 <p>In [lib.allocator.requirements] 20.1.5, paragraph 4: replace:</p>
6928 <blockquote>
6929   <p>The typedef members pointer, const_pointer, size_type, and difference_type
6930   are required to be T*, T const*, size_t, and ptrdiff_t, respectively.</p>
6931 </blockquote>
6932 <p>&nbsp;by:</p>
6933 <blockquote>
6934   <p>The typedef members pointer, const_pointer, size_type, and difference_type
6935   are required to be T*, T const*, std::size_t, and std::ptrdiff_t,
6936   respectively.</p>
6937 </blockquote>
6938 <p>In [lib.allocator.members] 20.4.1.1, paragraphs 3 and 6: replace:</p>
6939 <blockquote>
6940   <p>3 Notes: Uses ::operator new(size_t) (18.4.1).</p>
6941   <p>6 Note: the storage is obtained by calling ::operator new(size_t), but it
6942   is unspecified when or how often this function is called. The use of hint is
6943   unspecified, but intended as an aid to locality if an implementation so
6944   desires.</p>
6945 </blockquote>
6946 <p>by:</p>
6947 <blockquote>
6948   <p>3 Notes: Uses ::operator new(std::size_t) (18.4.1).</p>
6949   <p>6 Note: the storage is obtained by calling ::operator new(std::size_t), but
6950   it is unspecified when or how often this function is called. The use of hint
6951   is unspecified, but intended as an aid to locality if an implementation so
6952   desires.</p>
6953 </blockquote>
6954 <p>In [lib.char.traits.require] 21.1.1, paragraph 1: replace:</p>
6955 <blockquote>
6956   <p>In Table 37, X denotes a Traits class defining types and functions for the
6957   character container type CharT; c and d denote values of type CharT; p and q
6958   denote values of type const CharT*; s denotes a value of type CharT*; n, i and
6959   j denote values of type size_t; e and f denote values of type X::int_type; pos
6960   denotes a value of type X::pos_type; and state denotes a value of type X::state_type.</p>
6961 </blockquote>
6962 <p>by:</p>
6963 <blockquote>
6964   <p>In Table 37, X denotes a Traits class defining types and functions for the
6965   character container type CharT; c and d denote values of type CharT; p and q
6966   denote values of type const CharT*; s denotes a value of type CharT*; n, i and
6967   j denote values of type std::size_t; e and f denote values of type X::int_type;
6968   pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.</p>
6969 </blockquote>
6970 <p>In [lib.char.traits.require] 21.1.1, table 37: replace the return type of
6971 X::length(p): "size_t" by "std::size_t".</p>
6972 <p>   In [lib.std.iterator.tags] 24.3.3, paragraph 2:    replace:<br>
6973 &nbsp;&nbsp;&nbsp; typedef ptrdiff_t difference_type;<br>
6974     by:<br>
6975 &nbsp;&nbsp;&nbsp; typedef std::ptrdiff_t difference_type;</p>
6976 <p> In [lib.locale.ctype] 22.2.1.1 put namespace std { ...} around the
6977 declaration of template &lt;class charT&gt; class ctype.<br>
6978 <br>
6979    In [lib.iterator.traits] 24.3.1, paragraph 2    put namespace std { ...} around the declaration of:<br>
6980 <br>
6981 &nbsp;&nbsp;&nbsp; template&lt;class Iterator&gt; struct iterator_traits<br>
6982 &nbsp;&nbsp;&nbsp; template&lt;class T&gt; struct iterator_traits&lt;T*&gt;<br>
6983 &nbsp;&nbsp;&nbsp; template&lt;class T&gt; struct iterator_traits&lt;const T*&gt;</p>
6984
6985
6986 <p><b>Rationale:</b></p>
6987 <p>The LWG believes correcting names like <tt>size_t</tt> and
6988 <tt>ptrdiff_t</tt> to <tt>std::size_t</tt> and <tt>std::ptrdiff_t</tt>
6989 to be essentially editorial.  There there can't be another size_t or
6990 ptrdiff_t meant anyway because, according to 17.4.3.2.4 [extern.types],</p>
6991
6992 <blockquote><p>
6993 For each type T from the Standard C library, the types ::T and std::T
6994 are reserved to the implementation and, when defined, ::T shall be
6995 identical to std::T.
6996 </p></blockquote>
6997
6998 <p>The issue is treated as a Defect Report to make explicit the Project
6999 Editor's authority to make this change.</p>
7000
7001 <p><i>[Post-Tokyo: Nico Josuttis provided the above wording at the
7002 request of the LWG.]</i></p>
7003
7004
7005 <p><i>[Toronto: This is tangentially related to issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#229">229</a>, but only tangentially: the intent of this issue is to
7006 address use of the name <tt>size_t</tt> in contexts outside of
7007 namespace std, such as in the description of <tt>::operator new</tt>.
7008 The proposed changes should be reviewed to make sure they are
7009 correct.]</i></p>
7010
7011
7012 <p><i>[pre-Copenhagen: Nico has reviewed the changes and believes
7013 them to be correct.]</i></p>
7014
7015
7016
7017
7018
7019
7020
7021 <hr>
7022 <h3><a name="183"></a>183. I/O stream manipulators don't work for wide character streams</h3>
7023 <p><b>Section:</b> 27.6.3 [std.manip] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7024  <b>Submitter:</b> Andy Sawyer <b>Date:</b> 1999-07-07</p>
7025 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#std.manip">issues</a> in [std.manip].</p>
7026 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7027 <p><b>Discussion:</b></p>
7028 <p>27.6.3 [std.manip] paragraph 3 says (clause numbering added for
7029 exposition):</p>
7030 <blockquote>
7031 <p>Returns: An object s of unspecified type such that if [1] out is an (instance
7032 of) basic_ostream then the expression out&lt;&lt;s behaves as if f(s) were
7033 called, and if [2] in is an (instance of) basic_istream then the expression
7034 in&gt;&gt;s behaves as if f(s) were called. Where f can be defined as: ios_base&amp;
7035 f(ios_base&amp; str, ios_base::fmtflags mask) { // reset specified flags
7036 str.setf(ios_base::fmtflags(0), mask); return str; } [3] The expression
7037 out&lt;&lt;s has type ostream&amp; and value out. [4] The expression in&gt;&gt;s
7038 has type istream&amp; and value in.</p>
7039 </blockquote>
7040 <p>Given the definitions [1] and [2] for out and in, surely [3] should read:
7041 "The expression out &lt;&lt; s has type basic_ostream&amp; ..." and
7042 [4] should read: "The expression in &gt;&gt; s has type basic_istream&amp;
7043 ..."</p>
7044 <p>If the wording in the standard is correct, I can see no way of implementing
7045 any of the manipulators so that they will work with wide character streams.</p>
7046 <p>e.g. wcout &lt;&lt; setbase( 16 );</p>
7047 <p>Must have value 'wcout' (which makes sense) and type 'ostream&amp;' (which
7048 doesn't).</p>
7049 <p>The same "cut'n'paste" type also seems to occur in Paras 4,5,7 and
7050 8. In addition, Para 6 [setfill] has a similar error, but relates only to
7051 ostreams.</p>
7052 <p>I'd be happier if there was a better way of saying this, to make it clear
7053 that the value of the expression is "the same specialization of
7054 basic_ostream as out"&amp;</p>
7055
7056
7057 <p><b>Proposed resolution:</b></p>
7058 <p>Replace section 27.6.3 [std.manip] except paragraph 1 with the
7059 following:</p>
7060 <blockquote>
7061 <p>2- The type designated smanip in each of the following function
7062 descriptions is implementation-specified and may be different for each
7063 function.<br>
7064 <br>
7065 <tt>smanip resetiosflags(ios_base::fmtflags mask);</tt><br>
7066 <br>
7067 -3- Returns: An object s of unspecified type such that if out is an
7068 instance of basic_ostream&lt;charT,traits&gt; then the expression
7069 out&lt;&lt;s behaves
7070 as if f(s, mask) were called, or if in is an instance of
7071 basic_istream&lt;charT,traits&gt; then the expression in&gt;&gt;s
7072 behaves as if
7073 f(s, mask) were called. The function f can be defined as:*<br>
7074 <br>
7075 [Footnote: The expression cin &gt;&gt; resetiosflags(ios_base::skipws)
7076 clears ios_base::skipws in the format flags stored in the
7077 basic_istream&lt;charT,traits&gt; object cin (the same as cin &gt;&gt;
7078 noskipws), and the expression cout &lt;&lt;
7079 resetiosflags(ios_base::showbase) clears
7080 ios_base::showbase in the format flags stored in the
7081 basic_ostream&lt;charT,traits&gt; object cout (the same as cout
7082 &lt;&lt;
7083 noshowbase). --- end footnote]<br>
7084 <br>
7085 &nbsp;&nbsp;&nbsp;&nbsp; <tt>ios_base&amp; f(ios_base&amp; str, ios_base::fmtflags mask)<br>
7086 &nbsp;&nbsp; {<br>
7087 &nbsp;&nbsp; //  reset specified flags<br>
7088 &nbsp;&nbsp; str.setf(ios_base::fmtflags(0), mask);<br>
7089 &nbsp;&nbsp; return str;<br>
7090 &nbsp;&nbsp; }<br>
7091 </tt><br>
7092 The expression out&lt;&lt;s has type basic_ostream&lt;charT,traits&gt;&amp; and value out.
7093 The expression in&gt;&gt;s has type basic_istream&lt;charT,traits&gt;&amp; and value in.<br>
7094 <br>
7095 &nbsp;<tt>smanip setiosflags(ios_base::fmtflags mask);</tt><br>
7096 <br>
7097 -4- Returns: An object s of unspecified type such that if out is an
7098 instance of basic_ostream&lt;charT,traits&gt; then the expression
7099 out&lt;&lt;s behaves
7100 as if f(s, mask) were called, or if in is an instance of
7101 basic_istream&lt;charT,traits&gt; then the expression in&gt;&gt;s
7102 behaves as if f(s,
7103 mask) were called. The function f can be defined as:<br>
7104 <br>
7105 &nbsp;&nbsp;&nbsp;&nbsp; <tt>ios_base&amp; f(ios_base&amp; str, ios_base::fmtflags mask)<br>
7106 &nbsp;&nbsp; {<br>
7107 &nbsp;&nbsp; //  set specified flags<br>
7108 &nbsp;&nbsp; str.setf(mask);<br>
7109 &nbsp;&nbsp; return str;<br>
7110 &nbsp;&nbsp; }<br>
7111 </tt><br>
7112 The expression out&lt;&lt;s has type basic_ostream&lt;charT,traits&gt;&amp; and value out.
7113 The expression in&gt;&gt;s has type basic_istream&lt;charT,traits&gt;&amp; and value in.<br>
7114 <br>
7115 <tt>smanip setbase(int base);</tt><br>
7116 <br>
7117 -5- Returns: An object s of unspecified type such that if out is an
7118 instance of basic_ostream&lt;charT,traits&gt; then the expression
7119 out&lt;&lt;s behaves
7120 as if f(s, base) were called, or if in is an instance of
7121 basic_istream&lt;charT,traits&gt; then the expression in&gt;&gt;s
7122 behaves as if f(s,
7123 base) were called. The function f can be defined as:<br>
7124 <br>
7125 &nbsp;&nbsp;&nbsp;&nbsp; <tt>ios_base&amp; f(ios_base&amp; str, int base)<br>
7126 &nbsp;&nbsp; {<br>
7127 &nbsp;&nbsp; //  set  basefield<br>
7128 &nbsp;&nbsp; str.setf(base ==  8 ? ios_base::oct :<br>
7129 &nbsp;&nbsp; base == 10 ? ios_base::dec :<br>
7130 &nbsp;&nbsp; base == 16 ? ios_base::hex :<br>
7131 &nbsp;&nbsp; ios_base::fmtflags(0), ios_base::basefield);<br>
7132 &nbsp;&nbsp; return str;<br>
7133 &nbsp;&nbsp; }<br>
7134 </tt><br>
7135 The expression out&lt;&lt;s has type basic_ostream&lt;charT,traits&gt;&amp; and value out.
7136 The expression in&gt;&gt;s has type basic_istream&lt;charT,traits&gt;&amp; and value in.<br>
7137 <br>
7138 <tt>smanip setfill(char_type c);<br>
7139 </tt><br>
7140 -6- Returns: An object s of unspecified type such that if out is (or is
7141 derived from) basic_ostream&lt;charT,traits&gt; and c has type charT
7142 then the
7143 expression out&lt;&lt;s behaves as if f(s, c) were called. The function
7144 f can be
7145 defined as:<br>
7146 <br>
7147 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tt>template&lt;class charT, class traits&gt;<br>
7148 &nbsp;&nbsp; basic_ios&lt;charT,traits&gt;&amp; f(basic_ios&lt;charT,traits&gt;&amp; str, charT c)<br>
7149 &nbsp;&nbsp; {<br>
7150 &nbsp;&nbsp; //  set fill character<br>
7151 &nbsp;&nbsp; str.fill(c);<br>
7152 &nbsp;&nbsp; return str;<br>
7153 &nbsp;&nbsp; }<br>
7154 </tt><br>
7155 The expression out&lt;&lt;s has type basic_ostream&lt;charT,traits&gt;&amp; and value out.<br>
7156 <br>
7157 <tt>smanip setprecision(int n);</tt><br>
7158 <br>
7159 -7- Returns: An object s of unspecified type such that if out is an
7160 instance of basic_ostream&lt;charT,traits&gt; then the expression
7161 out&lt;&lt;s behaves
7162 as if f(s, n) were called, or if in is an instance of
7163 basic_istream&lt;charT,traits&gt; then the expression in&gt;&gt;s
7164 behaves as if f(s, n)
7165 were called. The function f can be defined as:<br>
7166 <br>
7167 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tt>ios_base&amp; f(ios_base&amp; str, int n)<br>
7168 &nbsp;&nbsp; {<br>
7169 &nbsp;&nbsp; //  set precision<br>
7170 &nbsp;&nbsp; str.precision(n);<br>
7171 &nbsp;&nbsp; return str;<br>
7172 &nbsp;&nbsp; }<br>
7173 </tt><br>
7174 The expression out&lt;&lt;s has type basic_ostream&lt;charT,traits&gt;&amp; and value out.
7175 The expression in&gt;&gt;s has type basic_istream&lt;charT,traits&gt;&amp; and value in<br>
7176 .<br>
7177 <tt>smanip setw(int n);<br>
7178 </tt><br>
7179 -8- Returns: An object s of unspecified type such that if out is an
7180 instance of basic_ostream&lt;charT,traits&gt; then the expression
7181 out&lt;&lt;s behaves
7182 as if f(s, n) were called, or if in is an instance of
7183 basic_istream&lt;charT,traits&gt; then the expression in&gt;&gt;s
7184 behaves as if f(s, n)
7185 were called. The function f can be defined as:<br>
7186 <br>
7187 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tt>ios_base&amp; f(ios_base&amp; str, int n)<br>
7188 &nbsp;&nbsp; {<br>
7189 &nbsp;&nbsp; //  set width<br>
7190 &nbsp;&nbsp; str.width(n);<br>
7191 &nbsp;&nbsp; return str;<br>
7192 &nbsp;&nbsp; }<br>
7193 </tt><br>
7194 The expression out&lt;&lt;s has type
7195 basic_ostream&lt;charT,traits&gt;&amp; and value out.  The expression
7196 in&gt;&gt;s has type basic_istream&lt;charT,traits&gt;&amp; and value
7197 in.
7198 </p>
7199 </blockquote>
7200
7201 <p><i>[Kona: Andy Sawyer and Beman Dawes will work to improve the wording of
7202 the proposed resolution.]</i></p>
7203
7204
7205 <p><i>[Tokyo - The LWG noted that issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#216">216</a> involves
7206 the same paragraphs.]</i></p>
7207
7208
7209 <p><i>[Post-Tokyo: The issues list maintainer combined the proposed
7210 resolution of this issue with the proposed resolution for issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#216">216</a> as they both involved the same paragraphs, and were so
7211 intertwined that dealing with them separately appear fraught with
7212 error.  The full text was supplied by Bill Plauger; it was cross
7213 checked against changes supplied by Andy Sawyer. It should be further
7214 checked by the LWG.]</i></p>
7215
7216
7217
7218
7219
7220
7221 <hr>
7222 <h3><a name="184"></a>184. numeric_limits&lt;bool&gt; wording problems</h3>
7223 <p><b>Section:</b> 18.2.1.5 [numeric.special] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7224  <b>Submitter:</b> Gabriel Dos Reis <b>Date:</b> 1999-07-21</p>
7225 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#numeric.special">issues</a> in [numeric.special].</p>
7226 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7227 <p><b>Discussion:</b></p>
7228 <p>bools are defined by the standard to be of integer types, as per
7229 3.9.1 [basic.fundamental] paragraph 7.  However "integer types"
7230 seems to have a special meaning for the author of 18.2. The net effect
7231 is an unclear and confusing specification for
7232 numeric_limits&lt;bool&gt; as evidenced below.</p>
7233
7234 <p>18.2.1.2/7 says numeric_limits&lt;&gt;::digits is, for built-in integer
7235 types, the number of non-sign bits in the representation.</p>
7236
7237 <p>4.5/4 states that a bool promotes to int ; whereas 4.12/1 says any non zero
7238 arithmetical value converts to true.</p>
7239
7240 <p>I don't think it makes sense at all to require
7241 numeric_limits&lt;bool&gt;::digits and numeric_limits&lt;bool&gt;::digits10 to
7242 be meaningful.</p>
7243
7244 <p>The standard defines what constitutes a signed (resp. unsigned) integer
7245 types. It doesn't categorize bool as being signed or unsigned. And the set of
7246 values of bool type has only two elements.</p>
7247
7248 <p>I don't think it makes sense to require numeric_limits&lt;bool&gt;::is_signed
7249 to be meaningful.</p>
7250
7251 <p>18.2.1.2/18 for numeric_limits&lt;integer_type&gt;::radix&nbsp; says:</p>
7252 <blockquote>
7253   <p>For integer types, specifies the base of the representation.186)</p>
7254 </blockquote>
7255
7256 <p>This disposition is at best misleading and confusing for the standard
7257 requires a "pure binary numeration system" for integer types as per
7258 3.9.1/7</p>
7259
7260 <p>The footnote 186) says: "Distinguishes types with base other than 2 (e.g
7261 BCD)."&nbsp; This also erroneous as the standard never defines any integer
7262 types with base representation other than 2.</p>
7263
7264 <p>Furthermore, numeric_limits&lt;bool&gt;::is_modulo and
7265 numeric_limits&lt;bool&gt;::is_signed have similar problems.</p>
7266
7267
7268 <p><b>Proposed resolution:</b></p>
7269 <p>Append to the end of 18.2.1.5 [numeric.special]:</p>
7270 <blockquote>
7271   <p>The specialization for bool shall be provided as follows:</p>
7272   <pre>    namespace std {
7273        template&lt;&gt; class numeric_limits&lt;bool&gt; {
7274        public:
7275          static const bool is_specialized = true;
7276          static bool min() throw() { return false; }
7277          static bool max() throw() { return true; }
7278
7279          static const int  digits = 1;
7280          static const int  digits10 = 0;
7281          static const bool is_signed = false;
7282          static const bool is_integer = true;
7283          static const bool is_exact = true;
7284          static const int  radix = 2;
7285          static bool epsilon() throw() { return 0; }
7286          static bool round_error() throw() { return 0; }
7287
7288          static const int  min_exponent = 0;
7289          static const int  min_exponent10 = 0;
7290          static const int  max_exponent = 0;
7291          static const int  max_exponent10 = 0;
7292
7293          static const bool has_infinity = false;
7294          static const bool has_quiet_NaN = false;
7295          static const bool has_signaling_NaN = false;
7296          static const float_denorm_style has_denorm = denorm_absent;
7297          static const bool has_denorm_loss = false;
7298          static bool infinity() throw() { return 0; }
7299          static bool quiet_NaN() throw() { return 0; }
7300          static bool signaling_NaN() throw() { return 0; }
7301          static bool denorm_min() throw() { return 0; }
7302
7303          static const bool is_iec559 = false;
7304          static const bool is_bounded = true;
7305          static const bool is_modulo = false;
7306
7307          static const bool traps = false;
7308          static const bool tinyness_before = false;
7309          static const float_round_style round_style = round_toward_zero;
7310        };
7311      }</pre>
7312 </blockquote>
7313
7314 <p><i>[Tokyo:&nbsp; The LWG desires wording that specifies exact values
7315 rather than more general wording in the original proposed
7316 resolution.]</i></p>
7317
7318
7319 <p><i>[Post-Tokyo:&nbsp; At the request of the LWG in Tokyo, Nico
7320 Josuttis provided the above wording.]</i></p>
7321
7322
7323
7324
7325
7326
7327 <hr>
7328 <h3><a name="185"></a>185. Questionable use of term "inline"</h3>
7329 <p><b>Section:</b> 20.6 [function.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7330  <b>Submitter:</b> UK Panel <b>Date:</b> 1999-07-26</p>
7331 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#function.objects">issues</a> in [function.objects].</p>
7332 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7333 <p><b>Discussion:</b></p>
7334 <p>Paragraph 4 of 20.6 [function.objects] says:</p>
7335 <blockquote>
7336   <p>&nbsp;[Example: To negate every element of a: transform(a.begin(), a.end(),
7337   a.begin(), negate&lt;double&gt;()); The corresponding functions will inline
7338   the addition and the negation. end example]</p>
7339 </blockquote>
7340 <p>(Note: The "addition" referred to in the above is in para 3) we can
7341 find no other wording, except this (non-normative) example which suggests that
7342 any "inlining" will take place in this case.</p>
7343 <p>Indeed both:</p>
7344 <blockquote>
7345   <p>17.4.4.3 Global Functions [lib.global.functions] 1 It is
7346   unspecified whether any global functions in the C++ Standard Library
7347   are defined as inline (7.1.2).</p>
7348 </blockquote>
7349 <p>and</p>
7350 <blockquote>
7351   <p>17.4.4.4 Member Functions [lib.member.functions] 1 It is
7352   unspecified whether any member functions in the C++ Standard Library
7353   are defined as inline (7.1.2).</p>
7354 </blockquote>
7355 <p>take care to state that this may indeed NOT be the case.</p>
7356 <p>Thus the example "mandates" behavior that is explicitly
7357 not required elsewhere.</p>
7358
7359
7360 <p><b>Proposed resolution:</b></p>
7361 <p>In 20.6 [function.objects] paragraph 1, remove the sentence:</p>
7362 <blockquote>
7363 <p>They are important for the effective use of the library.</p>
7364 </blockquote>
7365 <p>Remove 20.6 [function.objects] paragraph 2, which reads:</p>
7366 <blockquote>
7367   <p> Using function objects together with function templates
7368   increases the expressive power of the library as well as making the
7369   resulting code much more efficient.</p>
7370 </blockquote>
7371 <p>In 20.6 [function.objects] paragraph 4, remove the sentence:</p>
7372 <blockquote>
7373   <p>The corresponding functions will inline the addition and the
7374   negation.</p>
7375 </blockquote>
7376
7377 <p><i>[Kona: The LWG agreed there was a defect.]</i></p>
7378
7379 <p><i>[Tokyo: The LWG crafted the proposed resolution.]</i></p>
7380
7381
7382
7383
7384
7385
7386 <hr>
7387 <h3><a name="186"></a>186. bitset::set() second parameter should be bool</h3>
7388 <p><b>Section:</b> 23.3.5.2 [bitset.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7389  <b>Submitter:</b> Darin Adler <b>Date:</b> 1999-08-13</p>
7390 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#bitset.members">issues</a> in [bitset.members].</p>
7391 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7392 <p><b>Discussion:</b></p>
7393 <p>In section 23.3.5.2 [bitset.members], paragraph 13 defines the
7394 bitset::set operation to take a second parameter of type int. The
7395 function tests whether this value is non-zero to determine whether to
7396 set the bit to true or false. The type of this second parameter should
7397 be bool. For one thing, the intent is to specify a Boolean value. For
7398 another, the result type from test() is bool. In addition, it's
7399 possible to slice an integer that's larger than an int. This can't
7400 happen with bool, since conversion to bool has the semantic of
7401 translating 0 to false and any non-zero value to true.</p>
7402
7403
7404 <p><b>Proposed resolution:</b></p>
7405 <p>In 23.3.5 [template.bitset] Para 1 Replace:</p>
7406 <blockquote>
7407 <pre>bitset&lt;N&gt;&amp; set(size_t pos, int val = true ); </pre>
7408 </blockquote>
7409 <p>With:</p>
7410 <blockquote>
7411   <pre>bitset&lt;N&gt;&amp; set(size_t pos, bool val = true );</pre>
7412 </blockquote>
7413 <p>In 23.3.5.2 [bitset.members] Para 12(.5) Replace:</p>
7414 <blockquote>
7415   <pre>bitset&lt;N&gt;&amp; set(size_t pos, int val = 1 );</pre>
7416 </blockquote>
7417 <p>With:</p>
7418 <blockquote>
7419   <pre>bitset&lt;N&gt;&amp; set(size_t pos, bool val = true );</pre>
7420 </blockquote>
7421
7422 <p><i>[Kona: The LWG agrees with the description.&nbsp; Andy Sawyer will work
7423 on better P/R wording.]</i></p>
7424
7425 <p><i>[Post-Tokyo: Andy provided the above wording.]</i></p>
7426
7427
7428
7429 <p><b>Rationale:</b></p>
7430 <p><tt>bool</tt> is a better choice.  It is believed that binary
7431 compatibility is not an issue, because this member function is
7432 usually implemented as <tt>inline</tt>, and because it is already
7433 the case that users cannot rely on the type of a pointer to a
7434 nonvirtual member of a standard library class.</p>
7435
7436
7437
7438
7439
7440 <hr>
7441 <h3><a name="187"></a>187. iter_swap underspecified</h3>
7442 <p><b>Section:</b> 25.2.3 [alg.swap] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7443  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 1999-08-14</p>
7444 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.swap">issues</a> in [alg.swap].</p>
7445 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7446 <p><b>Discussion:</b></p>
7447 <p>The description of iter_swap in 25.2.2 paragraph 7,says that it
7448 ``exchanges the values'' of the objects to which two iterators
7449 refer.<br> <br> What it doesn't say is whether it does so using swap
7450 or using the assignment operator and copy constructor.<br> <br> This
7451 question is an important one to answer, because swap is specialized to
7452 work efficiently for standard containers.<br> For example:</p>
7453 <blockquote>
7454 <pre>vector&lt;int&gt; v1, v2;
7455 iter_swap(&amp;v1, &amp;v2);</pre>
7456 </blockquote>
7457 <p>Is this call to iter_swap equivalent to calling swap(v1, v2)?&nbsp;
7458 Or is it equivalent to</p>
7459 <blockquote>
7460 <pre>{
7461 vector&lt;int&gt; temp = v1;
7462 v1 = v2;
7463 v2 = temp;
7464 }</pre>
7465 </blockquote>
7466 <p>The first alternative is O(1); the second is O(n).</p>
7467 <p>A LWG member, Dave Abrahams, comments:</p>
7468 <blockquote>
7469 <p>Not an objection necessarily, but I want to point out the cost of
7470 that requirement:</p>
7471   <blockquote>
7472 <p><tt>iter_swap(list&lt;T&gt;::iterator, list&lt;T&gt;::iterator)</tt></p>
7473   </blockquote>
7474 <p>can currently be specialized to be more efficient than
7475 iter_swap(T*,T*) for many T (by using splicing). Your proposal would
7476 make that optimization illegal.&nbsp;</p>
7477 </blockquote>
7478
7479 <p><i>[Kona: The LWG notes the original need for iter_swap was proxy iterators
7480 which are no longer permitted.]</i></p>
7481
7482
7483
7484 <p><b>Proposed resolution:</b></p>
7485 <p>Change the effect clause of iter_swap in 25.2.2 paragraph 7 from:</p>
7486 <blockquote>
7487 <p>Exchanges the values pointed to by the two iterators a and b.</p>
7488 </blockquote>
7489 <p>to</p>
7490 <blockquote>
7491 <p><tt>swap(*a, *b)</tt>.</p>
7492 </blockquote>
7493
7494
7495
7496 <p><b>Rationale:</b></p>
7497 <p>It's useful to say just what <tt>iter_swap</tt> does.  There may be
7498   some iterators for which we want to specialize <tt>iter_swap</tt>,
7499   but the fully general version should have a general specification.</p>
7500
7501 <p>Note that in the specific case of <tt>list&lt;T&gt;::iterator</tt>,
7502 iter_swap should not be specialized as suggested above.  That would do
7503 much more than exchanging the two iterators' values: it would change
7504 predecessor/successor relationships, possibly moving the iterator from
7505 one list to another.  That would surely be inappropriate.</p>
7506
7507
7508
7509
7510
7511 <hr>
7512 <h3><a name="189"></a>189. setprecision() not specified correctly</h3>
7513 <p><b>Section:</b> 27.4.2.2 [fmtflags.state] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
7514  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 1999-08-25</p>
7515 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#fmtflags.state">issues</a> in [fmtflags.state].</p>
7516 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
7517 <p><b>Discussion:</b></p>
7518 <p>27.4.2.2 paragraph 9 claims that setprecision() sets the precision,
7519 and includes a parenthetical note saying that it is the number of
7520 digits after the decimal point.<br>
7521 <br>
7522 This claim is not strictly correct.  For example, in the default
7523 floating-point output format, setprecision sets the number of
7524 significant digits printed, not the number of digits after the decimal
7525 point.<br>
7526 <br>
7527 I would like the committee to look at the definition carefully and
7528 correct the statement in 27.4.2.2</p>
7529
7530
7531 <p><b>Proposed resolution:</b></p>
7532 <p>Remove from 27.4.2.2 [fmtflags.state], paragraph 9, the text
7533 "(number of digits after the decimal point)".</p>
7534
7535
7536
7537
7538 <hr>
7539 <h3><a name="193"></a>193. Heap operations description incorrect</h3>
7540 <p><b>Section:</b> 25.3.6 [alg.heap.operations] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
7541  <b>Submitter:</b> Markus Mauhart <b>Date:</b> 1999-09-24</p>
7542 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
7543 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#216">216</a></p>
7544 <p><b>Discussion:</b></p>
7545 <p>25.3.6 [lib.alg.heap.operations] states two key properties of a heap [a,b), the first of them
7546 is<br>
7547 <br>
7548 &nbsp;&nbsp;&nbsp; `"(1) *a is the largest element"<br>
7549 <br>
7550 I think this is incorrect and should be changed to the wording in the proposed
7551 resolution.</p>
7552 <p>Actually there are two independent changes:</p>
7553 <blockquote>
7554   <p>A-"part of largest equivalence class" instead of "largest", cause 25.3
7555   [lib.alg.sorting] asserts "strict weak ordering" for all its sub clauses.</p>
7556   <p>B-Take
7557 'an oldest' from that equivalence class, otherwise the heap functions
7558 could not be used for a priority queue as explained in 23.2.3.2.2
7559 [lib.priqueue.members] (where I assume that a "priority queue" respects
7560 priority AND time).</p>
7561 </blockquote>
7562
7563
7564 <p><b>Proposed resolution:</b></p>
7565 <p>Change 25.3.6 [alg.heap.operations] property (1) from:</p>
7566 <blockquote>
7567   <p>(1) *a is the largest element</p>
7568 </blockquote>
7569 <p>to:</p>
7570 <blockquote>
7571   <p>(1) There is no element greater than <tt>*a</tt></p>
7572 </blockquote>
7573
7574
7575
7576
7577
7578 <hr>
7579 <h3><a name="195"></a>195. Should <tt>basic_istream::sentry</tt>'s constructor ever set eofbit?</h3>
7580 <p><b>Section:</b> 27.6.1.1.3 [istream::sentry] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
7581  <b>Submitter:</b> Matt Austern <b>Date:</b> 1999-10-13</p>
7582 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream::sentry">issues</a> in [istream::sentry].</p>
7583 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
7584 <p><b>Discussion:</b></p>
7585 <p>Suppose that <tt>is.flags() &amp; ios_base::skipws</tt> is nonzero.
7586 What should <tt>basic_istream&lt;&gt;::sentry</tt>'s constructor do if it
7587 reaches eof while skipping whitespace?  27.6.1.1.2/5 suggests it
7588 should set failbit. Should it set eofbit as well?  The standard
7589 doesn't seem to answer that question.</p>
7590
7591 <p>On the one hand, nothing in 27.6.1.1.3 [istream::sentry] says that
7592 <tt>basic_istream&lt;&gt;::sentry</tt> should ever set eofbit.  On the
7593 other hand, 27.6.1.1 [istream] paragraph 4 says that if
7594 extraction from a <tt>streambuf</tt> "returns
7595 <tt>traits::eof()</tt>, then the input function, except as explicitly
7596 noted otherwise, completes its actions and does
7597 <tt>setstate(eofbit)"</tt>.  So the question comes down to
7598 whether <tt>basic_istream&lt;&gt;::sentry</tt>'s constructor is an
7599 input function.</p>
7600
7601 <p>Comments from Jerry Schwarz:</p>
7602 <blockquote>
7603 <p>It was always my intention that eofbit should be set any time that a
7604 virtual returned something to indicate eof, no matter what reason
7605 iostream code had for calling the virtual.</p>
7606 <p>
7607 The motivation for this is that I did not want to require streambufs
7608 to behave consistently if their virtuals are called after they have
7609 signaled eof.</p>
7610 <p>
7611 The classic case is a streambuf reading from a UNIX file.  EOF isn't
7612 really a state for UNIX file descriptors.  The convention is that a
7613 read on UNIX returns 0 bytes to indicate "EOF", but the file
7614 descriptor isn't shut down in any way and future reads do not
7615 necessarily also return 0 bytes.  In particular, you can read from
7616 tty's on UNIX even after they have signaled "EOF".  (It
7617 isn't always understood that a ^D on UNIX is not an EOF indicator, but
7618 an EOL indicator.  By typing a "line" consisting solely of
7619 ^D you cause a read to return 0 bytes, and by convention this is
7620 interpreted as end of file.)</p>
7621 </blockquote>
7622
7623
7624 <p><b>Proposed resolution:</b></p>
7625 <p>Add a sentence to the end of 27.6.1.1.2 paragraph 2:</p>
7626 <blockquote>
7627 <p>If <tt>is.rdbuf()-&gt;sbumpc()</tt> or <tt>is.rdbuf()-&gt;sgetc()</tt>
7628 returns <tt>traits::eof()</tt>, the function calls
7629 <tt>setstate(failbit | eofbit)</tt> (which may throw
7630 <tt>ios_base::failure</tt>).
7631 </p>
7632 </blockquote>
7633
7634
7635
7636
7637 <hr>
7638 <h3><a name="198"></a>198. Validity of pointers and references unspecified after iterator destruction</h3>
7639 <p><b>Section:</b> 24.1 [iterator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7640  <b>Submitter:</b> Beman Dawes <b>Date:</b> 1999-11-03</p>
7641 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#iterator.requirements">active issues</a> in [iterator.requirements].</p>
7642 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iterator.requirements">issues</a> in [iterator.requirements].</p>
7643 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7644 <p><b>Discussion:</b></p>
7645 <p>
7646 Is a pointer or reference obtained from an iterator still valid after
7647 destruction of the iterator?
7648 </p>
7649 <p>
7650 Is a pointer or reference obtained from an iterator still valid after the value
7651 of the iterator changes?
7652 </p>
7653 <blockquote>
7654 <pre>#include &lt;iostream&gt;
7655 #include &lt;vector&gt;
7656 #include &lt;iterator&gt;
7657
7658 int main()
7659 {
7660     typedef std::vector&lt;int&gt; vec_t;
7661     vec_t v;
7662     v.push_back( 1 );
7663
7664     // Is a pointer or reference obtained from an iterator still
7665     // valid after destruction of the iterator?
7666     int * p = &amp;*v.begin();
7667     std::cout &lt;&lt; *p &lt;&lt; '\n';  // OK?
7668
7669     // Is a pointer or reference obtained from an iterator still
7670     // valid after the value of the iterator changes?
7671     vec_t::iterator iter( v.begin() );
7672     p = &amp;*iter++;
7673     std::cout &lt;&lt; *p &lt;&lt; '\n';  // OK?
7674
7675     return 0;
7676 }
7677 </pre>
7678 </blockquote>
7679
7680 <p>The standard doesn't appear to directly address these
7681 questions. The standard needs to be clarified. At least two real-world
7682 cases have been reported where library implementors wasted
7683 considerable effort because of the lack of clarity in the
7684 standard. The question is important because requiring pointers and
7685 references to remain valid has the effect for practical purposes of
7686 prohibiting iterators from pointing to cached rather than actual
7687 elements of containers.</p>
7688
7689 <p>The standard itself assumes that pointers and references obtained
7690 from an iterator are still valid after iterator destruction or
7691 change. The definition of reverse_iterator::operator*(), 24.4.1.3.3 [reverse.iter.conv], which returns a reference, defines
7692 effects:</p>
7693
7694 <blockquote>
7695   <pre>Iterator tmp = current;
7696 return *--tmp;</pre>
7697 </blockquote>
7698 <p>The definition of reverse_iterator::operator-&gt;(), 24.4.1.3.4
7699 [reverse.iter.op.star], which returns a pointer, defines effects:</p>
7700 <blockquote>
7701   <pre>return &amp;(operator*());</pre>
7702 </blockquote>
7703
7704 <p>Because the standard itself assumes pointers and references remain
7705 valid after iterator destruction or change, the standard should say so
7706 explicitly. This will also reduce the chance of user code breaking
7707 unexpectedly when porting to a different standard library
7708 implementation.</p>
7709
7710
7711 <p><b>Proposed resolution:</b></p>
7712 <p>Add a new paragraph to 24.1 [iterator.requirements]:</p>
7713 <blockquote><p>
7714 Destruction of an iterator may invalidate pointers and references
7715 previously obtained from that iterator.
7716 </p></blockquote>
7717
7718 <p>Replace paragraph 1 of 24.4.1.3.3 [reverse.iter.conv] with:</p>
7719
7720 <blockquote>
7721 <p><b>Effects:</b></p>
7722 <pre>  this-&gt;tmp = current;
7723   --this-&gt;tmp;
7724   return *this-&gt;tmp;
7725 </pre>
7726
7727 <p>
7728 [<i>Note:</i> This operation must use an auxiliary member variable,
7729 rather than a temporary variable, to avoid returning a reference that
7730 persists beyond the lifetime of its associated iterator.  (See
7731 24.1 [iterator.requirements].)  The name of this member variable is shown for
7732 exposition only.  <i>--end note</i>]
7733 </p>
7734 </blockquote>
7735
7736 <p><i>[Post-Tokyo: The issue has been reformulated purely
7737 in terms of iterators.]</i></p>
7738
7739
7740 <p><i>[Pre-Toronto: Steve Cleary pointed out the no-invalidation
7741 assumption by reverse_iterator. The issue and proposed resolution was
7742 reformulated yet again to reflect this reality.]</i></p>
7743
7744
7745 <p><i>[Copenhagen: Steve Cleary pointed out that reverse_iterator
7746 assumes its underlying iterator has persistent pointers and
7747 references.  Andy Koenig pointed out that it is possible to rewrite
7748 reverse_iterator so that it no longer makes such an assupmption.
7749 However, this issue is related to issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299">299</a>.  If we
7750 decide it is intentional that <tt>p[n]</tt> may return by value
7751 instead of reference when <tt>p</tt> is a Random Access Iterator,
7752 other changes in reverse_iterator will be necessary.]</i></p>
7753
7754
7755
7756 <p><b>Rationale:</b></p>
7757 <p>This issue has been discussed extensively.  Note that it is
7758 <i>not</i> an issue about the behavior of predefined iterators.  It is
7759 asking whether or not user-defined iterators are permitted to have
7760 transient pointers and references.  Several people presented examples
7761 of useful user-defined iterators that have such a property; examples
7762 include a B-tree iterator, and an "iota iterator" that doesn't point
7763 to memory.  Library implementors already seem to be able to cope with
7764 such iterators: they take pains to avoid forming references to memory
7765 that gets iterated past.  The only place where this is a problem is
7766 <tt>reverse_iterator</tt>, so this issue changes
7767 <tt>reverse_iterator</tt> to make it work.</p>
7768
7769 <p>This resolution does not weaken any guarantees provided by
7770 predefined iterators like <tt>list&lt;int&gt;::iterator</tt>.
7771 Clause 23 should be reviewed to make sure that guarantees for
7772 predefined iterators are as strong as users expect.</p>
7773
7774
7775
7776
7777
7778
7779 <hr>
7780 <h3><a name="199"></a>199. What does <tt>allocate(0)</tt> return?</h3>
7781 <p><b>Section:</b> 20.1.2 [allocator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
7782  <b>Submitter:</b> Matt Austern <b>Date:</b> 1999-11-19</p>
7783 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#allocator.requirements">active issues</a> in [allocator.requirements].</p>
7784 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.requirements">issues</a> in [allocator.requirements].</p>
7785 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
7786 <p><b>Discussion:</b></p>
7787 <p>
7788 Suppose that <tt>A</tt> is a class that conforms to the
7789 Allocator requirements of Table 32, and <tt>a</tt> is an
7790 object of class <tt>A</tt>  What should be the return
7791 value of <tt>a.allocate(0)</tt>?  Three reasonable
7792 possibilities: forbid the argument <tt>0</tt>, return
7793 a null pointer, or require that the return value be a
7794 unique non-null pointer.
7795 </p>
7796
7797
7798 <p><b>Proposed resolution:</b></p>
7799 <p>
7800 Add a note to the <tt>allocate</tt> row of Table 32:
7801 "[<i>Note:</i> If <tt>n == 0</tt>, the return value is unspecified. <i>--end note</i>]"</p>
7802
7803
7804 <p><b>Rationale:</b></p>
7805 <p>A key to understanding this issue is that the ultimate use of
7806 allocate() is to construct an iterator, and that iterator for zero
7807 length sequences must be the container's past-the-end
7808 representation.  Since this already implies special case code, it
7809 would be over-specification to mandate the return value.
7810 </p>
7811
7812
7813
7814
7815 <hr>
7816 <h3><a name="200"></a>200. Forward iterator requirements don't allow constant iterators</h3>
7817 <p><b>Section:</b> 24.1.3 [forward.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7818  <b>Submitter:</b> Matt Austern <b>Date:</b> 1999-11-19</p>
7819 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#forward.iterators">issues</a> in [forward.iterators].</p>
7820 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7821 <p><b>Discussion:</b></p>
7822 <p>
7823 In table 74, the return type of the expression <tt>*a</tt> is given
7824 as <tt>T&amp;</tt>, where <tt>T</tt> is the iterator's value type.
7825 For constant iterators, however, this is wrong.  ("Value type"
7826 is never defined very precisely, but it is clear that the value type
7827 of, say, <tt>std::list&lt;int&gt;::const_iterator</tt> is supposed to be
7828 <tt>int</tt>, not <tt>const int</tt>.)
7829 </p>
7830
7831
7832 <p><b>Proposed resolution:</b></p>
7833 <p>
7834 In table 74, in the <tt>*a</tt> and <tt>*r++</tt> rows, change the
7835 return type from "<tt>T&amp;</tt>" to "<tt>T&amp;</tt>
7836 if <tt>X</tt> is mutable, otherwise <tt>const T&amp;</tt>".
7837 In the <tt>a-&gt;m</tt> row, change the return type from
7838 "<tt>U&amp;</tt>" to "<tt>U&amp;</tt> if <tt>X</tt> is mutable,
7839 otherwise <tt>const U&amp;</tt>".
7840 </p>
7841
7842 <p><i>[Tokyo: The LWG believes this is the tip of a larger iceberg;
7843 there are multiple const problems with the STL portion of the library
7844 and that these should be addressed as a single package.&nbsp; Note
7845 that issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#180">180</a> has already been declared NAD Future for
7846 that very reason.]</i></p>
7847
7848
7849 <p><i>[Redmond: the LWG thinks this is separable from other constness
7850 issues.  This issue is just cleanup; it clarifies language that was
7851 written before we had iterator_traits.  Proposed resolution was
7852 modified: the original version only discussed *a.  It was pointed out
7853 that we also need to worry about *r++ and a-&gt;m.]</i></p>
7854
7855
7856
7857
7858
7859
7860
7861 <hr>
7862 <h3><a name="201"></a>201. Numeric limits terminology wrong</h3>
7863 <p><b>Section:</b> 18.2.1 [limits] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7864  <b>Submitter:</b> Stephen Cleary <b>Date:</b> 1999-12-21</p>
7865 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#limits">issues</a> in [limits].</p>
7866 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7867 <p><b>Discussion:</b></p>
7868 <p>
7869 In some places in this section, the terms "fundamental types" and
7870 "scalar types" are used when the term "arithmetic types" is intended.
7871 The current usage is incorrect because void is a fundamental type and
7872 pointers are scalar types, neither of which should have
7873 specializations of numeric_limits.
7874 </p>
7875 <p><i>[Lillehammer: it remains true that numeric_limits is using
7876   imprecise language. However, none of the proposals for changed
7877   wording are clearer.  A redesign of numeric_limits is needed, but this
7878   is more a task than an open issue.]</i></p>
7879
7880
7881
7882 <p><b>Proposed resolution:</b></p>
7883
7884 <p>
7885 Change 18.2 [support.limits] to:
7886 </p>
7887
7888 <blockquote>
7889 <p>
7890 -1- The headers <tt>&lt;limits&gt;</tt>, <tt>&lt;climits&gt;</tt>,
7891 <tt>&lt;cfloat&gt;</tt>, and <tt>&lt;cinttypes&gt;</tt> supply
7892 characteristics of implementation-dependent <del>fundamental</del>
7893 <ins>arithmetic</ins> types (3.9.1).
7894 </p>
7895 </blockquote>
7896
7897 <p>
7898 Change 18.2.1 [limits] to:
7899 </p>
7900
7901 <blockquote>
7902 <p>
7903 -1- The <tt>numeric_limits</tt> component provides a C++ program with
7904 information about various properties of the implementation's
7905 representation of the <del>fundamental</del> <ins>arithmetic</ins>
7906 types.
7907 </p>
7908 <p>
7909 -2- Specializations shall be provided for each <del>fundamental</del>
7910 <ins>arithmetic</ins> type, both floating point and integer, including
7911 <tt>bool</tt>. The member <tt>is_specialized</tt> shall be <tt>true</tt>
7912 for all such specializations of <tt>numeric_limits</tt>.
7913 </p>
7914 <p>
7915 -4- Non-<del>fundamental</del><ins>arithmetic</ins> standard types, such
7916 as <tt>complex&lt;T&gt;</tt> (26.3.2), shall not have specializations.
7917 </p>
7918 </blockquote>
7919
7920 <p>
7921 Change 18.2.1.1 [numeric.limits] to:
7922 </p>
7923
7924 <blockquote>
7925 <p>
7926 <del>-1- The member <tt>is_specialized</tt> makes it possible to distinguish
7927 between fundamental types, which have specializations, and non-scalar types,
7928 which do not.</del>
7929 </p>
7930 </blockquote>
7931
7932
7933
7934
7935
7936
7937 <hr>
7938 <h3><a name="202"></a>202. unique() effects unclear when predicate not an equivalence relation</h3>
7939 <p><b>Section:</b> 25.2.9 [alg.unique] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
7940  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 2000-01-13</p>
7941 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.unique">issues</a> in [alg.unique].</p>
7942 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
7943 <p><b>Discussion:</b></p>
7944 <p>
7945 What should unique() do if you give it a predicate that is not an
7946 equivalence relation?  There are at least two plausible answers:
7947 </p>
7948
7949 <blockquote>
7950
7951 <p>
7952    1. You can't, because 25.2.8 says that it it "eliminates all but
7953    the first element from every consecutive group of equal
7954    elements..." and it wouldn't make sense to interpret "equal" as
7955    meaning anything but an equivalence relation.  [It also doesn't
7956    make sense to interpret "equal" as meaning ==, because then there
7957    would never be any sense in giving a predicate as an argument at
7958    all.]
7959 </p>
7960
7961 <p>
7962    2. The word "equal" should be interpreted to mean whatever the
7963    predicate says, even if it is not an equivalence relation
7964    (and in particular, even if it is not transitive).
7965 </p>
7966
7967 </blockquote>
7968
7969 <p>
7970 The example that raised this question is from Usenet:
7971 </p>
7972
7973 <blockquote>
7974
7975 <pre>int f[] = { 1, 3, 7, 1, 2 };
7976 int* z = unique(f, f+5, greater&lt;int&gt;());</pre>
7977
7978 </blockquote>
7979
7980 <p>
7981 If one blindly applies the definition using the predicate
7982 greater&lt;int&gt;, and ignore the word "equal", you get:
7983 </p>
7984
7985 <blockquote>
7986
7987 <p>
7988     Eliminates all but the first element from every consecutive group    
7989     of elements referred to by the iterator i in the range [first, last)    
7990     for which *i &gt; *(i - 1).
7991 </p>
7992
7993 </blockquote>
7994
7995 <p>
7996 The first surprise is the order of the comparison.  If we wanted to
7997 allow for the predicate not being an equivalence relation, then we
7998 should surely compare elements the other way: pred(*(i - 1), *i).  If
7999 we do that, then the description would seem to say: "Break the
8000 sequence into subsequences whose elements are in strictly increasing
8001 order, and keep only the first element of each subsequence".  So the
8002 result would be 1, 1, 2.  If we take the description at its word, it
8003 would seem to call for strictly DEcreasing order, in which case the
8004 result should be 1, 3, 7, 2.<br>
8005 <br>
8006 In fact, the SGI implementation of unique() does neither: It yields 1,
8007 3, 7.
8008 </p>
8009
8010
8011 <p><b>Proposed resolution:</b></p>
8012 <p>Change 25.2.9 [alg.unique] paragraph 1 to:</p>
8013 <blockquote><p>
8014 For a nonempty range, eliminates all but the first element from every
8015 consecutive group of equivalent elements referred to by the iterator
8016 <tt>i</tt> in the range [first+1, last) for which the following
8017 conditions hold: <tt>*(i-1) == *i</tt> or <tt>pred(*(i-1), *i) !=
8018 false</tt>.
8019 </p></blockquote>
8020
8021 <p>
8022 Also insert a new paragraph, paragraph 2a, that reads: "Requires: The
8023 comparison function must be an equivalence relation."
8024 </p>
8025
8026 <p><i>[Redmond: discussed arguments for and against requiring the
8027 comparison function to be an equivalence relation.  Straw poll:
8028 14-2-5.  First number is to require that it be an equivalence
8029 relation, second number is to explicitly not require that it be an
8030 equivalence relation, third number is people who believe they need
8031 more time to consider the issue.  A separate issue: Andy Sawyer
8032 pointed out that "i-1" is incorrect, since "i" can refer to the first
8033 iterator in the range.  Matt provided wording to address this
8034 problem.]</i></p>
8035
8036
8037 <p><i>[Curaçao: The LWG changed "... the range (first,
8038 last)..." to "...  the range [first+1, last)..." for
8039 clarity. They considered this change close enough to editorial to not
8040 require another round of review.]</i></p>
8041
8042
8043
8044
8045 <p><b>Rationale:</b></p>
8046 <p>The LWG also considered an alternative resolution: change 
8047 25.2.9 [alg.unique] paragraph 1 to:</p>
8048
8049 <blockquote><p>
8050 For a nonempty range, eliminates all but the first element from every
8051 consecutive group of elements referred to by the iterator
8052 <tt>i</tt> in the range (first, last) for which the following
8053 conditions hold: <tt>*(i-1) == *i</tt> or <tt>pred(*(i-1), *i) !=
8054 false</tt>.
8055 </p></blockquote>
8056
8057 <p>
8058 Also insert a new paragraph, paragraph 1a, that reads: "Notes: The
8059 comparison function need not be an equivalence relation."
8060 </p>
8061
8062
8063 <p>Informally: the proposed resolution imposes an explicit requirement
8064 that the comparison function be an equivalence relation.  The
8065 alternative resolution does not, and it gives enough information so
8066 that the behavior of unique() for a non-equivalence relation is
8067 specified.  Both resolutions are consistent with the behavior of
8068 existing implementations.</p>
8069
8070
8071
8072
8073
8074 <hr>
8075 <h3><a name="206"></a>206. operator new(size_t, nothrow) may become unlinked to ordinary operator new if ordinary version replaced</h3>
8076 <p><b>Section:</b> 18.5.1.1 [new.delete.single] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
8077  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 1999-08-29</p>
8078 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#new.delete.single">issues</a> in [new.delete.single].</p>
8079 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
8080 <p><b>Discussion:</b></p>
8081 <p>As specified, the implementation of the nothrow version of operator
8082 new does not necessarily call the ordinary operator new, but may
8083 instead simply call the same underlying allocator and return a null
8084 pointer instead of throwing an exception in case of failure.</p>
8085
8086 <p>Such an implementation breaks code that replaces the ordinary
8087 version of new, but not the nothrow version. If the ordinary version
8088 of new/delete is replaced, and if the replaced delete is not
8089 compatible with pointers returned from the library versions of new,
8090 then when the replaced delete receives a pointer allocated by the
8091 library new(nothrow), crash follows.</p>
8092
8093 <p>The fix appears to be that the lib version of new(nothrow) must
8094 call the ordinary new. Thus when the ordinary new gets replaced, the
8095 lib version will call the replaced ordinary new and things will
8096 continue to work.</p>
8097
8098 <p>An alternative would be to have the ordinary new call
8099 new(nothrow). This seems sub-optimal to me as the ordinary version of
8100 new is the version most commonly replaced in practice. So one would
8101 still need to replace both ordinary and nothrow versions if one wanted
8102 to replace the ordinary version.</p>
8103
8104 <p>Another alternative is to put in clear text that if one version is
8105 replaced, then the other must also be replaced to maintain
8106 compatibility. Then the proposed resolution below would just be a
8107 quality of implementation issue. There is already such text in
8108 paragraph 7 (under the new(nothrow) version). But this nuance is
8109 easily missed if one reads only the paragraphs relating to the
8110 ordinary new.</p>
8111
8112 <p>
8113 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2158.html">N2158</a>
8114 has been written explaining the rationale for the proposed resolution below.
8115 </p>
8116
8117
8118
8119 <p><b>Proposed resolution:</b></p>
8120 <p>
8121 Change 18.5.1.1 [new.delete.single]:
8122 </p>
8123
8124 <blockquote>
8125 <pre>void* operator new(std::size_t <i>size</i>, const std::nothrow_t&amp;) throw();
8126 </pre>
8127 <blockquote>
8128 <p>
8129 -5- <i>Effects:</i> Same as above, except that it is called by a placement
8130 version of a <i>new-expression</i> when a C++ program prefers a null pointer result as
8131 an error indication, instead of a <tt>bad_alloc</tt> exception.
8132 </p>
8133
8134 <p>
8135 -6- <i>Replaceable:</i> a C++ program may define a function with this function
8136 signature that displaces the default version defined by the C++ Standard
8137 library.
8138 </p>
8139
8140 <p>
8141 -7- <i>Required behavior:</i> Return a non-null pointer to suitably aligned
8142 storage (3.7.4), or else return a null pointer. This nothrow version of operator
8143 new returns a pointer obtained as if acquired from the <ins>(possibly
8144 replaced)</ins> ordinary version. This requirement is binding on a replacement
8145 version of this function.
8146 </p>
8147
8148 <p>
8149 -8- <i>Default behavior:</i>
8150 </p>
8151 <ul>
8152 <li><ins>
8153 Calls <tt>operator new(<i>size</i>)</tt>.
8154 </ins></li>
8155 <li><ins>
8156 If the call to <tt>operator new(<i>size</i>)</tt> returns normally, returns
8157 the result of that call, else
8158 </ins></li>
8159 <li><ins>
8160 if the call to <tt>operator new(<i>size</i>)</tt> throws an exception, returns
8161 a null pointer.
8162 </ins></li>
8163 <li><del>
8164 Executes a loop: Within the loop, the function first attempts to allocate the
8165 requested storage. Whether the attempt involves a call to the Standard C library
8166 function <tt>malloc</tt> is unspecified.
8167 </del></li>
8168 <li><del>
8169 Returns a pointer to the allocated storage if the attempt is successful.
8170 Otherwise, if the last argument to <tt>set_new_handler()</tt> was a null
8171 pointer, return a null pointer.
8172 </del></li>
8173 <li><del>
8174 Otherwise, the function calls the current <i>new_handler</i> (18.5.2.2). If the
8175 called function returns, the loop repeats.
8176 </del></li>
8177 <li><del>
8178 The loop terminates when an attempt to allocate the requested storage is
8179 successful or when a called <i>new_handler</i> function does not return. If the
8180 called <i>new_handler</i> function terminates by throwing a <tt>bad_alloc
8181 exception</tt>, the function returns a null pointer.
8182 </del></li>
8183 </ul>
8184 <p>
8185 -9- [<i>Example:</i>
8186 </p>
8187 <blockquote><pre>T* p1 = new T;                 <i>// throws bad_alloc if it fails</i>
8188 T* p2 = new(nothrow) T;        <i>// returns 0 if it fails</i>
8189 </pre></blockquote>
8190 <p>
8191 --<i>end example</i>]
8192 </p>
8193 </blockquote>
8194
8195 <pre>void operator delete(void* <i>ptr</i>) throw();
8196 <del>void operator delete(void* <i>ptr</i>, const std::nothrow_t&amp;) throw();</del>
8197 </pre>
8198
8199 <blockquote>
8200 <p>
8201 -10- <i>Effects:</i> The <i>deallocation function</i> (3.7.4.2) called by a
8202 <i>delete-expression</i> to render the value of <tt><i>ptr</i></tt> invalid.
8203 </p>
8204 <p>
8205 -11- <i>Replaceable:</i> a C++ program may define a function with this function
8206 signature that displaces the default version defined by the C++ Standard
8207 library.
8208 </p>
8209 <p>
8210 -12- <i>Requires:</i> the value of <tt><i>ptr</i></tt> is null or the value
8211 returned by an earlier call to the <del>default</del> <ins>(possibly
8212 replaced)</ins> <tt>operator new(std::size_t)</tt> or <tt>operator
8213 new(std::size_t, const std::nothrow_t&amp;)</tt>.
8214 </p>
8215 <p>
8216 -13- <i>Default behavior:</i>
8217 </p>
8218 <ul>
8219 <li>
8220 For a null value of <tt><i>ptr</i></tt>, do nothing.
8221 </li>
8222 <li>
8223 Any other value of <tt><i>ptr</i></tt> shall be a value returned earlier by a
8224 call to the default <tt>operator new</tt>, which was not invalidated by an
8225 intervening call to <tt>operator delete(void*)</tt> (17.4.3.7). For such a
8226 non-null value of <tt><i>ptr</i></tt>, reclaims storage allocated by the earlier
8227 call to the default <tt>operator new</tt>.
8228 </li>
8229 </ul>
8230 <p>
8231 -14- <i>Remarks:</i>  It is unspecified under what conditions part or all of
8232 such reclaimed storage is allocated by a subsequent call to <tt>operator
8233 new</tt> or any of <tt>calloc</tt>, <tt>malloc</tt>, or <tt>realloc</tt>,
8234 declared in <tt>&lt;cstdlib&gt;</tt>.
8235 </p>
8236 </blockquote>
8237
8238 <pre><ins>void operator delete(void* <i>ptr</i>, const std::nothrow_t&amp;) throw();</ins>
8239 </pre>
8240
8241 <blockquote>
8242 <p><ins>
8243 -15- <i>Effects:</i> Same as above, except that it is called by the
8244 implementation when an exception propagates from a nothrow placement version
8245 of the <i>new-expression</i> (i.e. when the constructor throws an exception).
8246 </ins></p>
8247 <p><ins>
8248 -16- <i>Replaceable:</i> a C++ program may define a function with this function
8249 signature that displaces the default version defined by the C++ Standard
8250 library.
8251 </ins></p>
8252 <p><ins>
8253 -17- <i>Requires:</i> the value of <tt><i>ptr</i></tt> is null or the
8254 value returned by an earlier call to the (possibly replaced) <tt>operator
8255 new(std::size_t)</tt> or <tt>operator new(std::size_t, const
8256 std::nothrow_t&amp;)</tt>. </ins></p>
8257 <p><ins>
8258 -18- <i>Default behavior:</i> Calls <tt>operator delete(<i>ptr</i>)</tt>.
8259 </ins></p>
8260 </blockquote>
8261
8262 </blockquote>
8263
8264 <p>
8265 Change 18.5.1.2 [new.delete.array]
8266 </p>
8267
8268 <blockquote>
8269 <pre>void* operator new[](std::size_t <i>size</i>, const std::nothrow_t&amp;) throw();
8270 </pre>
8271
8272 <blockquote>
8273 <p>
8274 -5- <i>Effects:</i> Same as above, except that it is called by a placement
8275 version of a <i>new-expression</i> when a C++ program prefers a null pointer result as
8276 an error indication, instead of a <tt>bad_alloc</tt> exception.
8277 </p>
8278
8279 <p>
8280 -6- <i>Replaceable:</i>  a C++ program can define a function with this function
8281 signature that displaces the default version defined by the C++ Standard
8282 library.
8283 </p>
8284
8285 <p>
8286 -7- <i>Required behavior:</i> <del>Same as for operator <tt>new(std::size_t,
8287 const std::nothrow_t&amp;)</tt>. This nothrow version of operator <tt>new[]</tt>
8288 returns a pointer obtained as if acquired from the ordinary version.</del>
8289 <ins>Return a non-null pointer to suitably aligned storage (3.7.4), or else
8290 return a null pointer. This nothrow version of operator new returns a pointer
8291 obtained as if acquired from the (possibly replaced) <tt>operator
8292 new[](std::size_t <i>size</i>)</tt>. This requirement is binding on a
8293 replacement version of this function.</ins>
8294 </p>
8295
8296 <p>
8297 -8- <i>Default behavior:</i> <del>Returns <tt>operator new(<i>size</i>,
8298 nothrow)</tt>.</del>
8299 </p>
8300
8301 <ul>
8302 <li><ins>
8303 Calls <tt>operator new[](<i>size</i>)</tt>.
8304 </ins></li>
8305 <li><ins>
8306 If the call to <tt>operator new[](<i>size</i>)</tt> returns normally, returns
8307 the result of that call, else
8308 </ins></li>
8309 <li><ins>
8310 if the call to <tt>operator new[](<i>size</i>)</tt> throws an exception, returns
8311 a null pointer.
8312 </ins></li>
8313 </ul>
8314 </blockquote>
8315
8316 <pre>void operator delete[](void* <i>ptr</i>) throw(); 
8317 void operator delete[](void* <i>ptr</i>, const std::nothrow_t&amp;) throw();
8318 </pre>
8319
8320 <blockquote>
8321 <p>
8322 -9- <i>Effects:</i> The <i>deallocation function</i> (3.7.4.2) called by the
8323 array form of a <i>delete-expression</i> to render the value of
8324 <tt><i>ptr</i></tt> invalid.
8325 </p>
8326
8327 <p>
8328 -10- <i>Replaceable:</i> a C++ program can define a function with this function
8329 signature that displaces the default version defined by the C++ Standard
8330 library.
8331 </p>
8332
8333 <p>
8334 -11- <i>Requires:</i> the value of
8335 <tt><i>ptr</i></tt> is null or the value returned by an earlier call to
8336 <tt>operator new[](std::size_t)</tt> or <tt>operator new[](std::size_t, const
8337 std::nothrow_t&amp;)</tt>.
8338 </p>
8339
8340 <p>
8341 -12- <i>Default behavior:</i> Calls <tt>operator delete(<i>ptr</i>)</tt> or
8342 <tt>operator delete<ins>[]</ins>(<i>ptr</i><del>, std::nothrow</del>)</tt> respectively.
8343 </p>
8344 </blockquote>
8345
8346 </blockquote>
8347
8348
8349
8350 <p><b>Rationale:</b></p>
8351 <p>Yes, they may become unlinked, and that is by design. If a user
8352 replaces one, the user should also replace the other.</p>
8353
8354 <p><i>[
8355 Reopened due to a gcc conversation between Howard, Martin and Gaby.  Forwarding
8356 or not is visible behavior to the client and it would be useful for the client
8357 to know which behavior it could depend on.
8358 ]</i></p>
8359
8360
8361 <p><i>[
8362 Batavia: Robert voiced serious reservations about backwards compatibility for
8363 his customers.
8364 ]</i></p>
8365
8366
8367
8368
8369
8370
8371 <hr>
8372 <h3><a name="208"></a>208. Unnecessary restriction on past-the-end iterators</h3>
8373 <p><b>Section:</b> 24.1 [iterator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8374  <b>Submitter:</b> Stephen Cleary <b>Date:</b> 2000-02-02</p>
8375 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#iterator.requirements">active issues</a> in [iterator.requirements].</p>
8376 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iterator.requirements">issues</a> in [iterator.requirements].</p>
8377 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8378 <p><b>Discussion:</b></p>
8379 <p>In 24.1 paragraph 5, it is stated ". . . Dereferenceable and
8380 past-the-end values are always non-singular."</p>
8381 <p>This places an unnecessary restriction on past-the-end iterators for
8382 containers with forward iterators (for example, a singly-linked list). If the
8383 past-the-end value on such a container was a well-known singular value, it would
8384 still satisfy all forward iterator requirements.</p>
8385 <p>Removing this restriction would allow, for example, a singly-linked list
8386 without a "footer" node.</p>
8387 <p>This would have an impact on existing code that expects past-the-end
8388 iterators obtained from different (generic) containers being not equal.</p>
8389
8390
8391 <p><b>Proposed resolution:</b></p>
8392 <p>Change 24.1 [iterator.requirements] paragraph 5, the last sentence, from:</p>
8393 <blockquote>
8394 <p>Dereferenceable and past-the-end values are always non-singular.</p>
8395 </blockquote>
8396 <p>to:</p>
8397 <blockquote>
8398 <p>Dereferenceable values are always non-singular.&nbsp;</p>
8399 </blockquote>
8400
8401
8402 <p><b>Rationale:</b></p>
8403 <p>For some kinds of containers, including singly linked lists and
8404 zero-length vectors, null pointers are perfectly reasonable past-the-end
8405 iterators.  Null pointers are singular.
8406 </p>
8407
8408
8409
8410
8411 <hr>
8412 <h3><a name="209"></a>209. basic_string declarations inconsistent</h3>
8413 <p><b>Section:</b> 21.3 [basic.string] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8414  <b>Submitter:</b> Igor Stauder <b>Date:</b> 2000-02-11</p>
8415 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
8416 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.string">issues</a> in [basic.string].</p>
8417 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8418 <p><b>Discussion:</b></p>
8419 <p>In Section 21.3 [basic.string] the basic_string member function
8420 declarations use a consistent style except for the following functions:</p>
8421 <blockquote>
8422   <pre>void push_back(const charT);
8423 basic_string&amp; assign(const basic_string&amp;);
8424 void swap(basic_string&lt;charT,traits,Allocator&gt;&amp;);</pre>
8425 </blockquote>
8426 <p>- push_back, assign, swap: missing argument name&nbsp;<br>
8427 - push_back: use of const with charT (i.e. POD type passed by value
8428 not by reference - should be charT or const charT&amp; )<br>
8429 - swap: redundant use of template parameters in argument
8430 basic_string&lt;charT,traits,Allocator&gt;&amp;</p>
8431
8432
8433 <p><b>Proposed resolution:</b></p>
8434 <p>In Section 21.3 [basic.string] change the basic_string member
8435 function declarations push_back, assign, and swap to:</p>
8436 <blockquote>
8437   <pre>void push_back(charT c); 
8438
8439 basic_string&amp; assign(const basic_string&amp; str);
8440 void swap(basic_string&amp; str);</pre>
8441 </blockquote>
8442
8443
8444 <p><b>Rationale:</b></p>
8445 <p>Although the standard is in general not consistent in declaration
8446 style, the basic_string declarations are consistent other than the
8447 above.  The LWG felt that this was sufficient reason to merit the
8448 change.
8449 </p>
8450
8451
8452
8453
8454 <hr>
8455 <h3><a name="210"></a>210. distance first and last confused</h3>
8456 <p><b>Section:</b> 25 [algorithms] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8457  <b>Submitter:</b> Lisa Lippincott <b>Date:</b> 2000-02-15</p>
8458 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#algorithms">issues</a> in [algorithms].</p>
8459 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8460 <p><b>Discussion:</b></p>
8461 <p>In paragraph 9 of section 25 [algorithms], it is written:</p>
8462 <blockquote>
8463   <p>      In the description of the algorithms operators + and - are used
8464            for some of the iterator categories for which they do not have to
8465            be defined. In these cases the semantics of [...] a-b is the same
8466            as of<br>
8467   <br>
8468   &nbsp;&nbsp;&nbsp;&nbsp; <tt>return distance(a, b);</tt></p>
8469 </blockquote>
8470
8471
8472 <p><b>Proposed resolution:</b></p>
8473 <p>On the last line of paragraph 9 of section 25 [algorithms] change
8474 <tt>"a-b"</tt> to <tt>"b-a".</tt></p>
8475
8476
8477 <p><b>Rationale:</b></p>
8478 <p>There are two ways to fix the defect; change the description to b-a
8479 or change the return to distance(b,a).  The LWG preferred the
8480 former for consistency.</p>
8481
8482
8483
8484
8485 <hr>
8486 <h3><a name="211"></a>211. operator&gt;&gt;(istream&amp;, string&amp;) doesn't set failbit</h3>
8487 <p><b>Section:</b> 21.3.8.9 [string.io] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8488  <b>Submitter:</b> Scott Snyder <b>Date:</b> 2000-02-04</p>
8489 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.io">issues</a> in [string.io].</p>
8490 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8491 <p><b>Discussion:</b></p>
8492 <p>The description of the stream extraction operator for std::string (section
8493 21.3.7.9 [lib.string.io]) does not contain a requirement that failbit be set in
8494 the case that the operator fails to extract any characters from the input
8495 stream.</p>
8496 <p>This implies that the typical construction</p>
8497 <blockquote>
8498   <pre>std::istream is;
8499 std::string str;
8500 ...
8501 while (is &gt;&gt; str) ... ;</pre>
8502 </blockquote>
8503 <p>(which tests failbit) is not required to terminate at EOF.</p>
8504 <p>Furthermore, this is inconsistent with other extraction operators,
8505 which do include this requirement. (See sections 27.6.1.2 [istream.formatted] and 27.6.1.3 [istream.unformatted]), where this
8506 requirement is present, either explicitly or implicitly, for the
8507 extraction operators. It is also present explicitly in the description
8508 of getline (istream&amp;, string&amp;, charT) in section 21.3.8.9 [string.io] paragraph 8.)</p>
8509
8510
8511 <p><b>Proposed resolution:</b></p>
8512 <p>Insert new paragraph after paragraph 2 in section 21.3.8.9 [string.io]:</p>
8513 <blockquote>
8514
8515 <p>If the function extracts no characters, it calls
8516 is.setstate(ios::failbit) which may throw ios_base::failure
8517 (27.4.4.3).</p>
8518 </blockquote>
8519
8520
8521
8522
8523 <hr>
8524 <h3><a name="212"></a>212. Empty range behavior unclear for several algorithms</h3>
8525 <p><b>Section:</b> 25.3.7 [alg.min.max] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8526  <b>Submitter:</b> Nico Josuttis <b>Date:</b> 2000-02-26</p>
8527 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.min.max">issues</a> in [alg.min.max].</p>
8528 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8529 <p><b>Discussion:</b></p>
8530 <p>The standard doesn't specify what min_element() and max_element() shall
8531 return if the range is empty (first equals last). The usual implementations
8532 return last. This problem seems also apply to partition(), stable_partition(),
8533 next_permutation(), and prev_permutation().</p>
8534
8535
8536 <p><b>Proposed resolution:</b></p>
8537 <p>In 25.3.7 [alg.min.max] - Minimum and maximum, paragraphs 7 and
8538 9, append: Returns last if first==last.</p>
8539
8540
8541 <p><b>Rationale:</b></p>
8542 <p>The LWG looked in some detail at all of the above mentioned
8543 algorithms, but believes that except for min_element() and
8544 max_element() it is already clear that last is returned if first ==
8545 last.</p>
8546
8547
8548
8549
8550 <hr>
8551 <h3><a name="214"></a>214. set::find() missing const overload</h3>
8552 <p><b>Section:</b> 23.3.3 [set], 23.3.4 [multiset] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
8553  <b>Submitter:</b> Judy Ward <b>Date:</b> 2000-02-28</p>
8554 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#set">issues</a> in [set].</p>
8555 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
8556 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#450">450</a></p>
8557 <p><b>Discussion:</b></p>
8558 <p>The specification for the associative container requirements in
8559 Table 69 state that the find member function should "return
8560 iterator; const_iterator for constant a". The map and multimap
8561 container descriptions have two overloaded versions of find, but set
8562 and multiset do not, all they have is:</p>
8563 <blockquote>
8564   <pre>iterator find(const key_type &amp; x) const;</pre>
8565 </blockquote>
8566
8567
8568 <p><b>Proposed resolution:</b></p>
8569 <p>Change the prototypes for find(), lower_bound(), upper_bound(), and
8570 equal_range() in section 23.3.3 [set] and section 23.3.4 [multiset] to each have two overloads:</p>
8571 <blockquote>
8572   <pre>iterator find(const key_type &amp; x);
8573 const_iterator find(const key_type &amp; x) const;</pre>
8574   <pre>iterator lower_bound(const key_type &amp; x);
8575 const_iterator lower_bound(const key_type &amp; x) const;</pre>
8576   <pre>iterator upper_bound(const key_type &amp; x);
8577 const_iterator upper_bound(const key_type &amp; x) const;</pre>
8578   <pre>pair&lt;iterator, iterator&gt; equal_range(const key_type &amp; x);
8579 pair&lt;const_iterator, const_iterator&gt; equal_range(const key_type &amp; x) const;</pre>
8580 </blockquote>
8581
8582 <p><i>[Tokyo: At the request of the LWG, Judy Ward provided wording
8583 extending the proposed resolution to lower_bound, upper_bound, and
8584 equal_range.]</i></p>
8585
8586
8587
8588
8589
8590
8591 <hr>
8592 <h3><a name="217"></a>217. Facets example (Classifying Japanese characters) contains errors</h3>
8593 <p><b>Section:</b> 22.2.8 [facets.examples] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8594  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-02-29</p>
8595 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facets.examples">issues</a> in [facets.examples].</p>
8596 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8597 <p><b>Discussion:</b></p>
8598 <p>The example in 22.2.8, paragraph 11 contains the following errors:</p>
8599 <p>1) The member function `My::JCtype::is_kanji()' is non-const; the function
8600 must be const in order for it to be callable on a const object (a reference to
8601 which which is what std::use_facet&lt;&gt;() returns).</p>
8602 <p>2) In file filt.C, the definition of `JCtype::id' must be qualified with the
8603 name of the namespace `My'.</p>
8604 <p>3) In the definition of `loc' and subsequently in the call to use_facet&lt;&gt;()
8605 in main(), the name of the facet is misspelled: it should read `My::JCtype'
8606 rather than `My::JCType'.</p>
8607
8608
8609 <p><b>Proposed resolution:</b></p>
8610 <p>Replace the "Classifying Japanese characters" example in 22.2.8,
8611 paragraph 11 with the following:</p>
8612 <pre>#include &lt;locale&gt;</pre>
8613 <pre>namespace My {
8614     using namespace std;
8615     class JCtype : public locale::facet {
8616     public:
8617         static locale::id id;     //  required for use as a new locale facet
8618         bool is_kanji (wchar_t c) const;
8619         JCtype() {}
8620     protected:
8621         ~JCtype() {}
8622     };
8623 }</pre>
8624 <pre>//  file:  filt.C
8625 #include &lt;iostream&gt;
8626 #include &lt;locale&gt;
8627 #include "jctype"                 //  above
8628 std::locale::id My::JCtype::id;   //  the static  JCtype  member
8629 declared above.</pre>
8630 <pre>int main()
8631 {
8632     using namespace std;
8633     typedef ctype&lt;wchar_t&gt; wctype;
8634     locale loc(locale(""),              //  the user's preferred locale...
8635                new My::JCtype);         //  and a new feature ...
8636     wchar_t c = use_facet&lt;wctype&gt;(loc).widen('!');
8637     if (!use_facet&lt;My::JCtype&gt;(loc).is_kanji(c))
8638         cout &lt;&lt; "no it isn't!" &lt;&lt; endl;
8639     return 0;
8640 }</pre>
8641
8642
8643
8644
8645 <hr>
8646 <h3><a name="220"></a>220. ~ios_base() usage valid?</h3>
8647 <p><b>Section:</b> 27.4.2.7 [ios.base.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8648  <b>Submitter:</b> Jonathan Schilling, Howard Hinnant <b>Date:</b> 2000-03-13</p>
8649 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8650 <p><b>Discussion:</b></p>
8651 <p>The pre-conditions for the ios_base destructor are described in 27.4.2.7
8652 paragraph 2:</p>
8653 <blockquote>
8654   <p>Effects: Destroys an object of class ios_base. Calls each registered
8655   callback pair (fn,index) (27.4.2.6) as (*fn)(erase_event,*this,index) at such
8656   time that any ios_base member function called from within fn has well defined
8657   results.</p>
8658 </blockquote>
8659 <p>But what is not clear is: If no callback functions were ever registered, does
8660 it matter whether the ios_base members were ever initialized?</p>
8661 <p>For instance, does this program have defined behavior:</p>
8662 <blockquote>
8663   <pre>#include &lt;ios&gt;</pre>
8664   <pre>class D : public std::ios_base { };</pre>
8665   <pre>int main() { D d; }</pre>
8666 </blockquote>
8667 <p>It seems that registration of a callback function would surely affect the
8668 state of an ios_base. That is, when you register a callback function with an
8669 ios_base, the ios_base must record that fact somehow.</p>
8670 <p>But if after construction the ios_base is in an indeterminate state, and that
8671 state is not made determinate before the destructor is called, then how would
8672 the destructor know if any callbacks had indeed been registered? And if the
8673 number of callbacks that had been registered is indeterminate, then is not the
8674 behavior of the destructor undefined?</p>
8675 <p>By comparison, the basic_ios class description in 27.4.4.1 paragraph 2 makes
8676 it explicit that destruction before initialization results in undefined
8677 behavior.</p>
8678
8679
8680 <p><b>Proposed resolution:</b></p>
8681 <p>Modify 27.4.2.7 paragraph 1 from</p>
8682 <blockquote>
8683   <p>Effects: Each ios_base member has an indeterminate value after
8684   construction.</p>
8685 </blockquote>
8686 <p>to</p>
8687 <blockquote>
8688   <p>Effects: Each ios_base member has an indeterminate
8689 value after construction. These members must be initialized by calling
8690 basic_ios::init. If an ios_base object is destroyed before these
8691 initializations have taken place, the behavior is undefined.</p>
8692 </blockquote>
8693
8694
8695
8696
8697 <hr>
8698 <h3><a name="221"></a>221. num_get&lt;&gt;::do_get stage 2 processing broken</h3>
8699 <p><b>Section:</b> 22.2.2.1.2 [facet.num.get.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
8700  <b>Submitter:</b> Matt Austern <b>Date:</b> 2000-03-14</p>
8701 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#facet.num.get.virtuals">active issues</a> in [facet.num.get.virtuals].</p>
8702 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.virtuals">issues</a> in [facet.num.get.virtuals].</p>
8703 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
8704 <p><b>Discussion:</b></p>
8705 <p>Stage 2 processing of numeric conversion is broken.</p>
8706
8707 <p>Table 55 in 22.2.2.1.2 says that when basefield is 0 the integral
8708 conversion specifier is %i. A %i specifier determines a number's base
8709 by its prefix (0 for octal, 0x for hex), so the intention is clearly
8710 that a 0x prefix is allowed.  Paragraph 8 in the same section,
8711 however, describes very precisely how characters are processed. (It
8712 must be done "as if" by a specified code fragment.) That
8713 description does not allow a 0x prefix to be recognized.</p>
8714
8715 <p>Very roughly, stage 2 processing reads a char_type ct. It converts
8716 ct to a char, not by using narrow but by looking it up in a
8717 translation table that was created by widening the string literal
8718 "0123456789abcdefABCDEF+-". The character "x" is
8719 not found in that table, so it can't be recognized by stage 2
8720 processing.</p>
8721
8722
8723 <p><b>Proposed resolution:</b></p>
8724 <p>In 22.2.2.1.2 paragraph 8, replace the line:</p>
8725 <blockquote>
8726   <pre>static const char src[] = "0123456789abcdefABCDEF+-";</pre>
8727 </blockquote>
8728 <p>with the line:</p>
8729 <blockquote>
8730   <pre>static const char src[] = "0123456789abcdefxABCDEFX+-";</pre>
8731 </blockquote>
8732
8733
8734 <p><b>Rationale:</b></p>
8735 <p>If we're using the technique of widening a string literal, the
8736 string literal must contain every character we wish to recognize.
8737 This technique has the consequence that alternate representations
8738 of digits will not be recognized.  This design decision was made
8739 deliberately, with full knowledge of that limitation.</p>
8740
8741
8742
8743
8744
8745 <hr>
8746 <h3><a name="222"></a>222. Are throw clauses necessary if a throw is already implied by the effects clause?</h3>
8747 <p><b>Section:</b> 17.3.1.3 [structure.specifications] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8748  <b>Submitter:</b> Judy Ward <b>Date:</b> 2000-03-17</p>
8749 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#structure.specifications">issues</a> in [structure.specifications].</p>
8750 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8751 <p><b>Discussion:</b></p>
8752 <p>Section 21.3.6.8 describes the basic_string::compare function this way:</p>
8753 <blockquote>
8754   <pre>21.3.6.8 - basic_string::compare [lib.string::compare]
8755
8756 int compare(size_type pos1, size_type n1,
8757                 const basic_string&lt;charT,traits,Allocator&gt;&amp;  str ,
8758                 size_type  pos2 , size_type  n2 ) const;
8759
8760 -4- Returns: 
8761
8762     basic_string&lt;charT,traits,Allocator&gt;(*this,pos1,n1).compare(
8763                  basic_string&lt;charT,traits,Allocator&gt;(str,pos2,n2)) .</pre>
8764 </blockquote>
8765 <p>and the constructor that's implicitly called by the above is
8766 defined to throw an out-of-range exception if pos &gt; str.size(). See
8767 section 21.3.1 [string.require] paragraph 4.</p>
8768
8769 <p>On the other hand, the compare function descriptions themselves don't have
8770 "Throws: " clauses and according to 17.3.1.3, paragraph 3, elements
8771 that do not apply to a function are omitted.</p>
8772 <p>So it seems there is an inconsistency in the standard -- are the
8773 "Effects" clauses correct, or are the "Throws" clauses
8774 missing?</p>
8775
8776
8777 <p><b>Proposed resolution:</b></p>
8778 <p>In 17.3.1.3 [structure.specifications] paragraph 3, the footnote 148 attached to
8779 the sentence "Descriptions of function semantics contain the
8780 following elements (as appropriate):", insert the word
8781 "further" so that the foot note reads:</p>
8782 <blockquote>
8783   <p>To save space, items that do not apply to a function are
8784   omitted. For example, if a function does not specify any further
8785   preconditions, there will be no "Requires" paragraph.</p>
8786 </blockquote>
8787
8788
8789 <p><b>Rationale:</b></p>
8790 <p>The standard is somewhat inconsistent, but a failure to note a
8791 throw condition in a throws clause does not grant permission not to
8792 throw.  The inconsistent wording is in a footnote, and thus
8793 non-normative. The proposed resolution from the LWG clarifies the
8794 footnote.</p>
8795
8796
8797
8798
8799 <hr>
8800 <h3><a name="223"></a>223. reverse algorithm should use iter_swap rather than swap</h3>
8801 <p><b>Section:</b> 25.2.10 [alg.reverse] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8802  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2000-03-21</p>
8803 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8804 <p><b>Discussion:</b></p>
8805 <p>Shouldn't the effects say "applies iter_swap to all pairs..."?</p>
8806
8807
8808 <p><b>Proposed resolution:</b></p>
8809 <p>In 25.2.10 [alg.reverse], replace:</p>
8810   <blockquote><p>
8811   Effects: For each non-negative integer i &lt;= (last - first)/2, 
8812   applies swap to all pairs of iterators first + i, (last - i) - 1.
8813   </p></blockquote>
8814 <p>with:</p>
8815   <blockquote><p>
8816   Effects: For each non-negative integer i &lt;= (last - first)/2, 
8817   applies iter_swap to all pairs of iterators first + i, (last - i) - 1.
8818   </p></blockquote>
8819
8820
8821
8822
8823 <hr>
8824 <h3><a name="224"></a>224. clear() complexity for associative containers refers to undefined N</h3>
8825 <p><b>Section:</b> 23.1.4 [associative.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
8826  <b>Submitter:</b> Ed Brey <b>Date:</b> 2000-03-23</p>
8827 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
8828 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
8829 <p><b>Discussion:</b></p>
8830 <p>In the associative container requirements table in 23.1.2 paragraph 7,
8831 a.clear() has complexity "log(size()) + N". However, the meaning of N
8832 is not defined.</p>
8833
8834
8835 <p><b>Proposed resolution:</b></p>
8836 <p>In the associative container requirements table in 23.1.2 paragraph
8837 7, the complexity of a.clear(), change "log(size()) + N" to
8838 "linear in <tt>size()</tt>".</p>
8839
8840
8841 <p><b>Rationale:</b></p>
8842 <p>It's the "log(size())", not the "N", that is in
8843 error: there's no difference between <i>O(N)</i> and <i>O(N +
8844 log(N))</i>.  The text in the standard is probably an incorrect
8845 cut-and-paste from the range version of <tt>erase</tt>.</p>
8846
8847
8848
8849
8850 <hr>
8851 <h3><a name="225"></a>225. std:: algorithms use of other unqualified algorithms</h3>
8852 <p><b>Section:</b> 17.4.4.3 [global.functions] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
8853  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2000-04-01</p>
8854 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#global.functions">issues</a> in [global.functions].</p>
8855 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
8856 <p><b>Discussion:</b></p>
8857 <p>Are algorithms in std:: allowed to use other algorithms without qualification, so functions in
8858 user namespaces might be found through Koenig lookup?</p>
8859 <p>For example, a popular standard library implementation includes this
8860 implementation of std::unique:</p>
8861 <blockquote>
8862 <pre>namespace std {
8863     template &lt;class _ForwardIter&gt;
8864     _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
8865       __first = adjacent_find(__first, __last);
8866       return unique_copy(__first, __last, __first);
8867     }
8868     }</pre>
8869 </blockquote>
8870 <p>Imagine two users on opposite sides of town, each using unique on his own
8871 sequences bounded by my_iterators . User1 looks at his standard library
8872 implementation and says, "I know how to implement a more efficient
8873 unique_copy for my_iterators", and writes:</p>
8874 <blockquote>
8875 <pre>namespace user1 {
8876     class my_iterator;
8877     // faster version for my_iterator
8878     my_iterator unique_copy(my_iterator, my_iterator, my_iterator);
8879     }</pre>
8880 </blockquote>
8881 <p>user1::unique_copy() is selected by Koenig lookup, as he intended.</p>
8882 <p>User2 has other needs, and writes:</p>
8883 <blockquote>
8884 <pre>namespace user2 {
8885     class my_iterator;
8886     // Returns true iff *c is a unique copy of *a and *b.
8887     bool unique_copy(my_iterator a, my_iterator b, my_iterator c);
8888     }</pre>
8889 </blockquote>
8890 <p>User2 is shocked to find later that his fully-qualified use of
8891 std::unique(user2::my_iterator, user2::my_iterator, user2::my_iterator) fails to
8892 compile (if he's lucky). Looking in the standard, he sees the following Effects
8893 clause for unique():</p>
8894 <blockquote>
8895   <p>Effects: Eliminates all but the first element from every consecutive group
8896   of equal elements referred to by the iterator i in the range [first, last) for
8897   which the following corresponding conditions hold: *i == *(i - 1) or pred(*i,
8898   *(i - 1)) != false</p>
8899 </blockquote>
8900 <p>The standard gives user2 absolutely no reason to think he can interfere with
8901 std::unique by defining names in namespace user2. His standard library has been
8902 built with the template export feature, so he is unable to inspect the
8903 implementation. User1 eventually compiles his code with another compiler, and
8904 his version of unique_copy silently stops being called. Eventually, he realizes
8905 that he was depending on an implementation detail of his library and had no
8906 right to expect his unique_copy() to be called portably.</p>
8907 <p>On the face of it, and given above scenario, it may seem obvious that the
8908 implementation of unique() shown is non-conforming because it uses unique_copy()
8909 rather than ::std::unique_copy(). Most standard library implementations,
8910 however, seem to disagree with this notion.</p>
8911 <p> <i>[Tokyo:&nbsp; Steve Adamczyk from
8912 the core working group indicates that "std::" is sufficient;&nbsp;
8913 leading "::" qualification is not required because any namespace
8914 qualification is sufficient to suppress Koenig lookup.]</i></p>
8915
8916
8917 <p><b>Proposed resolution:</b></p>
8918 <p>Add a paragraph and a note at the end of 
8919 17.4.4.3 [global.functions]:</p>
8920 <blockquote>
8921
8922 <p>Unless otherwise specified, no global or non-member function in the
8923 standard library shall use a function from another namespace which is
8924 found through <i>argument-dependent name lookup</i> (3.4.2 [basic.lookup.argdep]).</p>
8925
8926 <p>[Note: the phrase "unless otherwise specified" is intended to
8927 allow Koenig lookup in cases like that of ostream_iterators:<br>
8928
8929 <br>
8930   Effects:</p>
8931   <blockquote>
8932 <p>*out_stream &lt;&lt; value;<br>
8933       if(delim != 0) *out_stream &lt;&lt; delim;<br>
8934       return (*this);</p>
8935     <p>--end note]</p>
8936   </blockquote>
8937 </blockquote>
8938
8939 <p><i>[Tokyo: The LWG agrees that this is a defect in the standard, but
8940 is as yet unsure if the proposed resolution is the best
8941 solution. Furthermore, the LWG believes that the same problem of
8942 unqualified library names applies to wording in the standard itself,
8943 and has opened issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#229">229</a> accordingly. Any resolution of
8944 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#225">225</a> should be coordinated with the resolution of
8945 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#229">229</a>.]</i></p>
8946
8947
8948 <p><i>[Toronto: The LWG is not sure if this is a defect in the
8949 standard.  Most LWG members believe that an implementation of
8950 <tt>std::unique</tt> like the one quoted in this issue is already
8951 illegal, since, under certain circumstances, its semantics are not
8952 those specified in the standard.  The standard's description of
8953 <tt>unique</tt> does not say that overloading <tt>adjacent_find</tt>
8954 should have any effect.]</i></p>
8955
8956
8957 <p><i>[Curaçao: An LWG-subgroup spent an afternoon working on issues
8958 225, 226, and 229.  Their conclusion was that the issues should be
8959 separated into an LWG portion (Howard's paper, N1387=02-0045), and a
8960 EWG portion (Dave will write a proposal). The LWG and EWG had
8961 (separate) discussions of this plan the next day.  The proposed
8962 resolution for this issue is in accordance with Howard's paper.]</i></p>
8963
8964
8965
8966
8967 <p><b>Rationale:</b></p>
8968 <p>It could be argued that this proposed isn't strictly necessary,
8969   that the Standard doesn't grant implementors license to write a
8970   standard function that behaves differently than specified in the
8971   Standard just because of an unrelated user-defined name in some
8972   other namespace.  However, this is at worst a clarification.  It is
8973   surely right that algorithsm shouldn't pick up random names, that
8974   user-defined names should have no effect unless otherwise specified.
8975   Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#226">226</a> deals with the question of when it is
8976   appropriate for the standard to explicitly specify otherwise.</p>
8977
8978
8979
8980
8981
8982 <hr>
8983 <h3><a name="226"></a>226. User supplied specializations or overloads of namespace std function templates</h3>
8984 <p><b>Section:</b> 17.4.3.2 [reserved.names] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
8985  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2000-04-01</p>
8986 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#reserved.names">issues</a> in [reserved.names].</p>
8987 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
8988 <p><b>Discussion:</b></p>
8989 <p>The issues are:&nbsp;</p>
8990 <p>1. How can a 3rd party library implementor (lib1) write a version of a standard
8991 algorithm which is specialized to work with his own class template?&nbsp;</p>
8992 <p>2. How can another library implementor (lib2) write a generic algorithm which 
8993 will take advantage of the specialized algorithm in lib1?</p>
8994 <p>This appears to be the only viable answer under current language rules:</p>
8995 <blockquote>
8996   <pre>namespace lib1
8997 {
8998     // arbitrary-precision numbers using T as a basic unit
8999     template &lt;class T&gt;
9000     class big_num { //...
9001     };
9002     </pre>
9003   <pre>    // defining this in namespace std is illegal (it would be an
9004     // overload), so we hope users will rely on Koenig lookup
9005     template &lt;class T&gt;
9006     void swap(big_int&lt;T&gt;&amp;, big_int&lt;T&gt;&amp;);
9007 }</pre>
9008   <pre>#include &lt;algorithm&gt;
9009 namespace lib2
9010 {
9011     template &lt;class T&gt;
9012     void generic_sort(T* start, T* end)
9013     {
9014             ...
9015         // using-declaration required so we can work on built-in types
9016         using std::swap;
9017         // use Koenig lookup to find specialized algorithm if available
9018         swap(*x, *y);
9019     }
9020 }</pre>
9021 </blockquote>
9022 <p>This answer has some drawbacks. First of all, it makes writing lib2 difficult
9023 and somewhat slippery. The implementor needs to remember to write the
9024 using-declaration, or generic_sort will fail to compile when T is a built-in
9025 type. The second drawback is that the use of this style in lib2 effectively
9026 "reserves" names in any namespace which defines types which may
9027 eventually be used with lib2. This may seem innocuous at first when applied to
9028 names like swap, but consider more ambiguous names like unique_copy() instead.
9029 It is easy to imagine the user wanting to define these names differently in his
9030 own namespace. A definition with semantics incompatible with the standard
9031 library could cause serious problems (see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#225">225</a>).</p>
9032 <p>Why, you may ask, can't we just partially specialize std::swap()? It's
9033 because the language doesn't allow for partial specialization of function
9034 templates. If you write:</p>
9035 <blockquote>
9036   <pre>namespace std
9037 {
9038     template &lt;class T&gt;
9039     void swap(lib1::big_int&lt;T&gt;&amp;, lib1::big_int&lt;T&gt;&amp;);
9040 }</pre>
9041 </blockquote>
9042 <p>You have just overloaded std::swap, which is illegal under the current
9043 language rules. On the other hand, the following full specialization is legal:</p>
9044 <blockquote>
9045   <pre>namespace std
9046 {
9047     template &lt;&gt;
9048     void swap(lib1::other_type&amp;, lib1::other_type&amp;);
9049 }</pre>
9050 </blockquote>
9051
9052 <p>This issue reflects concerns raised by the "Namespace issue
9053 with specialized swap" thread on comp.lang.c++.moderated. A
9054 similar set of concerns was earlier raised on the boost.org mailing
9055 list and the ACCU-general mailing list.  Also see library reflector
9056 message c++std-lib-7354.</p>
9057
9058 <p>
9059 J. C. van Winkel points out (in c++std-lib-9565) another unexpected
9060 fact: it's impossible to output a container of std::pair's using copy
9061 and an ostream_iterator, as long as both pair-members are built-in or
9062 std:: types.  That's because a user-defined operator&lt;&lt; for (for
9063 example) std::pair&lt;const std::string, int&gt; will not be found:
9064 lookup for operator&lt;&lt; will be performed only in namespace std.
9065 Opinions differed on whether or not this was a defect, and, if so,
9066 whether the defect is that something is wrong with user-defined
9067 functionality and std, or whether it's that the standard library does
9068 not provide an operator&lt;&lt; for std::pair&lt;&gt;.
9069 </p>
9070
9071
9072
9073 <p><b>Proposed resolution:</b></p>
9074
9075 <p>Adopt the wording proposed in Howard Hinnant's paper
9076   N1523=03-0106, "Proposed Resolution To LWG issues 225, 226, 229".</p>
9077
9078
9079 <p><i>[Tokyo: Summary, "There is no conforming way to extend
9080 std::swap for user defined templates."&nbsp; The LWG agrees that
9081 there is a problem.  Would like more information before
9082 proceeding. This may be a core issue.  Core issue 229 has been opened
9083 to discuss the core aspects of this problem. It was also noted that
9084 submissions regarding this issue have been received from several
9085 sources, but too late to be integrated into the issues list.
9086 ]</i></p>
9087
9088
9089 <p><i>[Post-Tokyo: A paper with several proposed resolutions,
9090 J16/00-0029==WG21/N1252, "Shades of namespace std functions
9091 " by Alan Griffiths, is in the Post-Tokyo mailing. It
9092 should be considered a part of this issue.]</i></p>
9093
9094
9095 <p><i>[Toronto: Dave Abrahams and Peter Dimov have proposed a
9096 resolution that involves core changes: it would add partial
9097 specialization of function template.  The Core Working Group is
9098 reluctant to add partial specialization of function templates.  It is
9099 viewed as a large change, CWG believes that proposal presented leaves
9100 some syntactic issues unanswered; if the CWG does add partial
9101 specialization of function templates, it wishes to develop its own
9102 proposal.  The LWG continues to believe that there is a serious
9103 problem: there is no good way for users to force the library to use
9104 user specializations of generic standard library functions, and in
9105 certain cases (e.g. transcendental functions called by
9106 <tt>valarray</tt> and <tt>complex</tt>) this is important.  Koenig
9107 lookup isn't adequate, since names within the library must be
9108 qualified with <tt>std</tt> (see issue 225), specialization doesn't
9109 work (we don't have partial specialization of function templates), and
9110 users aren't permitted to add overloads within namespace std.
9111 ]</i></p>
9112
9113
9114 <p><i>[Copenhagen: Discussed at length, with no consensus.  Relevant
9115 papers in the pre-Copenhagen mailing: N1289, N1295, N1296.  Discussion
9116 focused on four options. (1) Relax restrictions on overloads within
9117 namespace std. (2) Mandate that the standard library use unqualified
9118 calls for <tt>swap</tt> and possibly other functions.  (3) Introduce
9119 helper class templates for <tt>swap</tt> and possibly other functions.
9120 (4) Introduce partial specialization of function templates.  Every
9121 option had both support and opposition.  Straw poll (first number is
9122 support, second is strongly opposed): (1) 6, 4; (2) 6, 7; (3) 3, 8;
9123 (4) 4, 4.]</i></p>
9124
9125
9126 <p><i>[Redmond: Discussed, again no consensus.  Herb presented an
9127 argument that a user who is defining a type <tt>T</tt> with an
9128 associated <tt>swap</tt> should not be expected to put that
9129 <tt>swap</tt> in namespace std, either by overloading or by partial
9130 specialization.  The argument is that <tt>swap</tt> is part of
9131 <tt>T</tt>'s interface, and thus should to in the same namespace as
9132 <tt>T</tt> and only in that namespace.  If we accept this argument,
9133 the consequence is that standard library functions should use
9134 unqualified call of <tt>swap</tt>.  (And which other functions? Any?)
9135 A small group (Nathan, Howard, Jeremy, Dave, Matt, Walter, Marc) will
9136 try to put together a proposal before the next meeting.]</i></p>
9137
9138
9139 <p><i>[Curaçao: An LWG-subgroup spent an afternoon working on issues
9140 225, 226, and 229.  Their conclusion was that the issues should be
9141 separated into an LWG portion (Howard's paper, N1387=02-0045), and a
9142 EWG portion (Dave will write a proposal). The LWG and EWG had
9143 (separate) discussions of this plan the next day.  The proposed
9144 resolution is the one proposed by Howard.]</i></p>
9145
9146
9147 <p><i>[Santa Cruz: the LWG agreed with the general direction of
9148   Howard's paper, N1387.  (Roughly: Koenig lookup is disabled unless
9149   we say otherwise; this issue is about when we do say otherwise.)
9150   However, there were concerns about wording.  Howard will provide new
9151   wording.  Bill and Jeremy will review it.]</i></p>
9152
9153
9154 <p><i>[Kona: Howard proposed the new wording.  The LWG accepted his
9155   proposed resolution.]</i></p>
9156
9157
9158
9159
9160 <p><b>Rationale:</b></p>
9161 <p>Informally: introduce a Swappable concept, and specify that the
9162   value types of the iterators passed to certain standard algorithms
9163   (such as iter_swap, swap_ranges, reverse, rotate, and sort) conform
9164   to that concept.  The Swappable concept will make it clear that
9165   these algorithms use unqualified lookup for the calls
9166   to <tt>swap</tt>.  Also, in 26.5.3.3 [valarray.transcend] paragraph 1,
9167   state that the valarray transcendentals use unqualified lookup.</p>
9168
9169
9170
9171
9172
9173 <hr>
9174 <h3><a name="227"></a>227. std::swap() should require CopyConstructible or DefaultConstructible arguments</h3>
9175 <p><b>Section:</b> 25.2.3 [alg.swap] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TC">TC</a>
9176  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2000-04-09</p>
9177 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.swap">issues</a> in [alg.swap].</p>
9178 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TC">TC</a> status.</p>
9179 <p><b>Discussion:</b></p>
9180 <p>25.2.2 reads:</p>
9181 <blockquote>
9182   <p><tt>  template&lt;class T&gt; void swap(T&amp; a, T&amp; b);</tt><br>
9183   <br>
9184   Requires:    Type T is Assignable (_lib.container.requirements_).<br>
9185   Effects:    Exchanges values stored in two locations.</p>
9186 </blockquote>
9187 <p>The only reasonable** generic implementation of swap requires construction of a 
9188    new temporary copy of one of its arguments:</p>
9189 <blockquote>
9190 <pre>template&lt;class T&gt; void swap(T&amp; a, T&amp; b);
9191   {
9192       T tmp(a);
9193       a = b;
9194       b = tmp;
9195   }</pre>
9196 </blockquote>
9197 <p>But a type which is only Assignable cannot be swapped by this implementation.</p>
9198 <p>**Yes, there's also an unreasonable implementation which would require T to be 
9199    DefaultConstructible instead of CopyConstructible. I don't think this is worthy 
9200    of consideration:</p>
9201 <blockquote>
9202 <pre>template&lt;class T&gt; void swap(T&amp; a, T&amp; b);
9203 {
9204     T tmp;
9205     tmp = a;
9206     a = b;
9207     b = tmp;
9208 }</pre>
9209 </blockquote>
9210
9211
9212 <p><b>Proposed resolution:</b></p>
9213 <p>Change 25.2.2 paragraph 1 from:</p>
9214 <blockquote>
9215 <p>  Requires: Type T is Assignable (23.1).</p>
9216 </blockquote>
9217 <p>to:</p>
9218 <blockquote>
9219 <p>  Requires: Type T is CopyConstructible (20.1.3) and Assignable (23.1)</p>
9220 </blockquote>
9221
9222
9223
9224
9225
9226 <hr>
9227 <h3><a name="228"></a>228. Incorrect specification of "..._byname" facets</h3>
9228 <p><b>Section:</b> 22.2 [locale.categories] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9229  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 2000-04-20</p>
9230 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#locale.categories">active issues</a> in [locale.categories].</p>
9231 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.categories">issues</a> in [locale.categories].</p>
9232 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9233 <p><b>Discussion:</b></p>
9234 <p>The sections 22.2.1.2 [locale.ctype.byname], 22.2.1.5
9235 [locale.codecvt.byname],
9236 sref ref="22.2.1.6", 22.2.3.2 [locale.numpunct.byname], 22.2.4.2
9237 [locale.collate.byname], 22.2.5.4 [locale.time.put.byname], 22.2.6.4
9238 [locale.moneypunct.byname], and 22.2.7.2 [locale.messages.byname]
9239 overspecify the
9240 definitions of the "..._byname" classes by listing a bunch
9241 of virtual functions. At the same time, no semantics of these
9242 functions are defined. Real implementations do not define these
9243 functions because the functional part of the facets is actually
9244 implemented in the corresponding base classes and the constructor of
9245 the "..._byname" version just provides suitable date used by
9246 these implementations. For example, the 'numpunct' methods just return
9247 values from a struct. The base class uses a statically initialized
9248 struct while the derived version reads the contents of this struct
9249 from a table. However, no virtual function is defined in
9250 'numpunct_byname'.</p>
9251
9252 <p>For most classes this does not impose a problem but specifically
9253 for 'ctype' it does: The specialization for 'ctype_byname&lt;char&gt;'
9254 is required because otherwise the semantics would change due to the
9255 virtual functions defined in the general version for 'ctype_byname':
9256 In 'ctype&lt;char&gt;' the method 'do_is()' is not virtual but it is
9257 made virtual in both 'ctype&lt;cT&gt;' and 'ctype_byname&lt;cT&gt;'.
9258 Thus, a class derived from 'ctype_byname&lt;char&gt;' can tell whether
9259 this class is specialized or not under the current specification:
9260 Without the specialization, 'do_is()' is virtual while with
9261 specialization it is not virtual.</p>
9262
9263
9264 <p><b>Proposed resolution:</b></p>
9265 <p>&nbsp; Change section 22.2.1.2 (lib.locale.ctype.byname) to become:</p>
9266 <pre>     namespace std {
9267        template &lt;class charT&gt;
9268        class ctype_byname : public ctype&lt;charT&gt; {
9269        public:
9270          typedef ctype&lt;charT&gt;::mask mask;
9271          explicit ctype_byname(const char*, size_t refs = 0);
9272        protected:
9273         ~ctype_byname();             //  virtual
9274        };
9275      }</pre>
9276 <p>&nbsp; Change section 22.2.1.6 (lib.locale.codecvt.byname) to become:</p>
9277 <pre>    namespace std {
9278       template &lt;class internT, class externT, class stateT&gt;
9279       class codecvt_byname : public codecvt&lt;internT, externT, stateT&gt; {
9280       public:
9281        explicit codecvt_byname(const char*, size_t refs = 0);
9282       protected:
9283       ~codecvt_byname();             //  virtual
9284        };
9285      }
9286 </pre>
9287 <p>&nbsp; Change section 22.2.3.2 (lib.locale.numpunct.byname) to become:</p>
9288 <pre>     namespace std {
9289        template &lt;class charT&gt;
9290        class numpunct_byname : public numpunct&lt;charT&gt; {
9291      //  this class is specialized for  char  and  wchar_t.
9292        public:
9293          typedef charT                char_type;
9294          typedef basic_string&lt;charT&gt;  string_type;
9295          explicit numpunct_byname(const char*, size_t refs = 0);
9296        protected:
9297         ~numpunct_byname();          //  virtual
9298        };
9299      }</pre>
9300 <p>&nbsp; Change section 22.2.4.2 (lib.locale.collate.byname) to become:</p>
9301 <pre>     namespace std {
9302        template &lt;class charT&gt;
9303        class collate_byname : public collate&lt;charT&gt; {
9304        public:
9305          typedef basic_string&lt;charT&gt; string_type;
9306          explicit collate_byname(const char*, size_t refs = 0);
9307        protected:
9308         ~collate_byname();           //  virtual
9309        };
9310      }</pre>
9311 <p>&nbsp; Change section 22.2.5.2 (lib.locale.time.get.byname) to become:</p>
9312 <pre>     namespace std {
9313        template &lt;class charT, class InputIterator = istreambuf_iterator&lt;charT&gt; &gt;
9314        class time_get_byname : public time_get&lt;charT, InputIterator&gt; {
9315        public:
9316          typedef time_base::dateorder dateorder;
9317          typedef InputIterator        iter_type</pre>
9318 <pre>         explicit time_get_byname(const char*, size_t refs = 0);
9319        protected:
9320         ~time_get_byname();          //  virtual
9321        };
9322      }</pre>
9323 <p>&nbsp; Change section 22.2.5.4 (lib.locale.time.put.byname) to become:</p>
9324 <pre>     namespace std {
9325        template &lt;class charT, class OutputIterator = ostreambuf_iterator&lt;charT&gt; &gt;
9326        class time_put_byname : public time_put&lt;charT, OutputIterator&gt;
9327        {
9328        public:
9329          typedef charT          char_type;
9330          typedef OutputIterator iter_type;</pre>
9331 <pre>         explicit time_put_byname(const char*, size_t refs = 0);
9332        protected:
9333         ~time_put_byname();          //  virtual
9334        };
9335      }"</pre>
9336 <p>&nbsp; Change section 22.2.6.4 (lib.locale.moneypunct.byname) to become:</p>
9337 <pre>     namespace std {
9338        template &lt;class charT, bool Intl = false&gt;
9339        class moneypunct_byname : public moneypunct&lt;charT, Intl&gt; {
9340        public:
9341          typedef money_base::pattern pattern;
9342          typedef basic_string&lt;charT&gt; string_type;</pre>
9343 <pre>         explicit moneypunct_byname(const char*, size_t refs = 0);
9344        protected:
9345         ~moneypunct_byname();        //  virtual
9346        };
9347      }</pre>
9348 <p>&nbsp; Change section 22.2.7.2 (lib.locale.messages.byname) to become:</p>
9349 <pre>     namespace std {
9350        template &lt;class charT&gt;
9351        class messages_byname : public messages&lt;charT&gt; {
9352        public:
9353          typedef messages_base::catalog catalog;
9354          typedef basic_string&lt;charT&gt;    string_type;</pre>
9355 <pre>         explicit messages_byname(const char*, size_t refs = 0);
9356        protected:
9357         ~messages_byname();          //  virtual
9358        };
9359      }</pre>
9360 <p>Remove section 22.2.1.4 [locale.codecvt] completely (because in
9361 this case only those members are defined to be virtual which are
9362 defined to be virtual in 'ctype&lt;cT&gt;'.)</p>
9363
9364 <p><i>[Post-Tokyo: Dietmar Kühl submitted this issue at the request of
9365 the LWG to solve the underlying problems raised by issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#138">138</a>.]</i></p>
9366
9367
9368 <p><i>[Copenhagen: proposed resolution was revised slightly, to remove
9369 three last virtual functions from <tt>messages_byname</tt>.]</i></p>
9370
9371
9372
9373
9374
9375
9376
9377 <hr>
9378 <h3><a name="229"></a>229. Unqualified references of other library entities</h3>
9379 <p><b>Section:</b> 17.4.1.1 [contents] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9380  <b>Submitter:</b> Steve Clamage <b>Date:</b> 2000-04-19</p>
9381 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9382 <p><b>Discussion:</b></p>
9383 <p>Throughout the library chapters, the descriptions of library entities refer
9384 to other library entities without necessarily qualifying the names.</p>
9385
9386 <p>For example, section 25.2.2 "Swap" describes the effect of
9387 swap_ranges in terms of the unqualified name "swap". This section
9388 could reasonably be interpreted to mean that the library must be implemented so
9389 as to do a lookup of the unqualified name "swap", allowing users to
9390 override any ::std::swap function when Koenig lookup applies.</p>
9391
9392 <p>Although it would have been best to use explicit qualification with
9393 "::std::" throughout, too many lines in the standard would have to be
9394 adjusted to make that change in a Technical Corrigendum.</p>
9395
9396 <p>Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#182">182</a>, which addresses qualification of
9397 <tt>size_t</tt>, is a special case of this.
9398 </p>
9399
9400
9401 <p><b>Proposed resolution:</b></p>
9402 <p>To section 17.4.1.1 "Library contents" Add the following paragraph:</p>
9403 <blockquote>
9404   <p>Whenever a name x defined in the standard library is mentioned, the name x
9405   is assumed to be fully qualified as ::std::x, unless explicitly described
9406   otherwise. For example, if the Effects section for library function F is
9407   described as calling library function G, the function ::std::G is meant.</p>
9408 </blockquote>
9409
9410 <p><i>[Post-Tokyo: Steve Clamage submitted this issue at the request of
9411 the LWG to solve a problem in the standard itself similar to the
9412 problem within implementations of library identified by issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#225">225</a>.  Any resolution of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#225">225</a> should be
9413 coordinated with the resolution of this issue.]</i></p>
9414
9415
9416 <p><i>[post-Toronto: Howard is undecided about whether it is
9417 appropriate for all standard library function names referred to in
9418 other standard library functions to be explicitly qualified by
9419 <tt>std</tt>: it is common advice that users should define global
9420 functions that operate on their class in the same namespace as the 
9421 class, and this requires argument-dependent lookup if those functions
9422 are intended to be called by library code.  Several LWG members are
9423 concerned that valarray appears to require argument-dependent lookup,
9424 but that the wording may not be clear enough to fall under
9425 "unless explicitly described otherwise".]</i></p>
9426
9427
9428 <p><i>[Curaçao: An LWG-subgroup spent an afternoon working on issues
9429 225, 226, and 229.  Their conclusion was that the issues should be
9430 separated into an LWG portion (Howard's paper, N1387=02-0045), and a
9431 EWG portion (Dave will write a proposal). The LWG and EWG had
9432 (separate) discussions of this plan the next day.  This paper resolves
9433 issues 225 and 226.  In light of that resolution, the proposed
9434 resolution for the current issue makes sense.]</i></p>
9435
9436
9437
9438
9439
9440
9441
9442 <hr>
9443 <h3><a name="230"></a>230. Assignable specified without also specifying CopyConstructible</h3>
9444 <p><b>Section:</b> 17 [library] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9445  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2000-04-26</p>
9446 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#library">issues</a> in [library].</p>
9447 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9448 <p><b>Discussion:</b></p>
9449 <p>Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#227">227</a> identified an instance (std::swap) where
9450 Assignable was specified without also specifying
9451 CopyConstructible. The LWG asked that the standard be searched to
9452 determine if the same defect existed elsewhere.</p>
9453
9454 <p>There are a number of places (see proposed resolution below) where
9455 Assignable is specified without also specifying
9456 CopyConstructible. There are also several cases where both are
9457 specified. For example, 26.4.1 [rand.req].</p>
9458
9459
9460 <p><b>Proposed resolution:</b></p>
9461 <p>In  23.1 [container.requirements] table 65 for value_type:
9462 change "T is Assignable" to "T is CopyConstructible and
9463 Assignable"
9464 </p>
9465
9466 <p>In 23.1.4 [associative.reqmts] table 69 X::key_type; change
9467 "Key is Assignable" to "Key is
9468 CopyConstructible and Assignable"<br>
9469 </p>
9470
9471 <p>In 24.1.2 [output.iterators] paragraph 1, change:
9472 </p>
9473 <blockquote>
9474 <p> A class or a built-in type X satisfies the requirements of an
9475 output iterator if X is an Assignable type (23.1) and also the
9476 following expressions are valid, as shown in Table 73:
9477 </p>
9478 </blockquote>
9479 <p>to:
9480 </p>
9481 <blockquote>
9482 <p> A class or a built-in type X satisfies the requirements of an
9483 output iterator if X is a CopyConstructible (20.1.3) and Assignable
9484 type (23.1) and also the following expressions are valid, as shown in
9485 Table 73:
9486 </p>
9487 </blockquote>
9488
9489 <p><i>[Post-Tokyo: Beman Dawes submitted this issue at the request of
9490 the LWG.  He asks that the 25.2.5 [alg.replace] and 25.2.6 [alg.fill] changes be studied carefully, as it is not clear that
9491 CopyConstructible is really a requirement and may be
9492 overspecification.]</i></p>
9493
9494
9495 <p><i>[Portions of the resolution for issue 230 have been superceded by
9496 the resolution of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#276">276</a>.]</i></p>
9497
9498
9499
9500
9501 <p><b>Rationale:</b></p>
9502 <p>The original proposed resolution also included changes to input
9503 iterator, fill, and replace.  The LWG believes that those changes are
9504 not necessary.  The LWG considered some blanket statement, where an
9505 Assignable type was also required to be Copy Constructible, but
9506 decided against this because fill and replace really don't require the
9507 Copy Constructible property.</p>
9508
9509
9510
9511
9512 <hr>
9513 <h3><a name="231"></a>231. Precision in iostream?</h3>
9514 <p><b>Section:</b> 22.2.2.2.2 [facet.num.put.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9515  <b>Submitter:</b> James Kanze, Stephen Clamage <b>Date:</b> 2000-04-25</p>
9516 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.put.virtuals">issues</a> in [facet.num.put.virtuals].</p>
9517 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9518 <p><b>Discussion:</b></p>
9519 <p>What is the following program supposed to output?</p>
9520 <pre>#include &lt;iostream&gt;
9521
9522     int
9523     main()
9524     {
9525         std::cout.setf( std::ios::scientific , std::ios::floatfield ) ;
9526         std::cout.precision( 0 ) ;
9527         std::cout &lt;&lt; 1.00 &lt;&lt; '\n' ;
9528         return 0 ;
9529     }</pre>
9530 <p>From my C experience, I would expect "1e+00"; this is what 
9531 <tt>printf("%.0e" , 1.00 );</tt> does. G++ outputs 
9532 "1.000000e+00".</p>
9533
9534 <p>The only indication I can find in the standard is 22.2.2.2.2/11,
9535 where it says "For conversion from a floating-point type, if
9536 (flags &amp; fixed) != 0 or if str.precision() &gt; 0, then
9537 str.precision() is specified in the conversion specification."
9538 This is an obvious error, however, fixed is not a mask for a field,
9539 but a value that a multi-bit field may take -- the results of and'ing
9540 fmtflags with ios::fixed are not defined, at least not if
9541 ios::scientific has been set. G++'s behavior corresponds to what might
9542 happen if you do use (flags &amp; fixed) != 0 with a typical
9543 implementation (floatfield == 3 &lt;&lt; something, fixed == 1
9544 &lt;&lt; something, and scientific == 2 &lt;&lt; something).</p>
9545
9546 <p>Presumably, the intent is either (flags &amp; floatfield) != 0, or
9547 (flags &amp; floatfield) == fixed; the first gives something more or
9548 less like the effect of precision in a printf floating point
9549 conversion. Only more or less, of course. In order to implement printf
9550 formatting correctly, you must know whether the precision was
9551 explicitly set or not. Say by initializing it to -1, instead of 6, and
9552 stating that for floating point conversions, if precision &lt; -1, 6
9553 will be used, for fixed point, if precision &lt; -1, 1 will be used,
9554 etc. Plus, of course, if precision == 0 and flags &amp; floatfield ==
9555 0, 1 should be = used. But it probably isn't necessary to emulate all
9556 of the anomalies of printf:-).</p>
9557
9558
9559 <p><b>Proposed resolution:</b></p>
9560 <p>
9561 Replace 22.2.2.2.2 [facet.num.put.virtuals], paragraph 11, with the following 
9562 sentence:
9563 </p>
9564 <blockquote><p>
9565 For conversion from a floating-point type,
9566 <tt><i>str</i>.precision()</tt> is specified in the conversion
9567 specification.
9568 </p></blockquote>
9569
9570
9571 <p><b>Rationale:</b></p>
9572 <p>The floatfield determines whether numbers are formatted as if
9573 with %f, %e, or %g.  If the <tt>fixed</tt> bit is set, it's %f,
9574 if <tt>scientific</tt> it's %e, and if both bits are set, or 
9575 neither, it's %g.</p>
9576 <p>Turning to the C standard, a precision of 0 is meaningful
9577 for %f and %e.  For %g, precision 0 is taken to be the same as 
9578 precision 1.</p>
9579 <p>The proposed resolution has the effect that if neither
9580 <tt>fixed</tt> nor <tt>scientific</tt> is set we'll be
9581 specifying a precision of 0, which will be internally
9582 turned into 1.  There's no need to call it out as a special
9583 case.</p>
9584 <p>The output of the above program will be "1e+00".</p>
9585
9586 <p><i>[Post-Curaçao: Howard provided improved wording covering the case
9587 where precision is 0 and mode is %g.]</i></p>
9588
9589
9590
9591
9592
9593
9594
9595 <hr>
9596 <h3><a name="232"></a>232. "depends" poorly defined in 17.4.3.1</h3>
9597 <p><b>Section:</b> 17.4.3.2 [reserved.names] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9598  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2000-04-18</p>
9599 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#reserved.names">issues</a> in [reserved.names].</p>
9600 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9601 <p><b>Discussion:</b></p>
9602 <p>17.4.3.1/1 uses the term "depends" to limit the set of allowed
9603 specializations of standard templates to those that "depend on a
9604 user-defined name of external linkage."</p>
9605 <p>This term, however, is not adequately defined, making it possible to
9606 construct a specialization that is, I believe, technically legal according to
9607 17.4.3.1/1, but that specializes a standard template for a built-in type such as
9608 'int'.</p>
9609 <p>The following code demonstrates the problem:</p>
9610 <blockquote>
9611   <pre>#include &lt;algorithm&gt;</pre>
9612   <pre>template&lt;class T&gt; struct X
9613 {
9614  typedef T type;
9615 };</pre>
9616   <pre>namespace std
9617 {
9618  template&lt;&gt; void swap(::X&lt;int&gt;::type&amp; i, ::X&lt;int&gt;::type&amp; j);
9619 }</pre>
9620 </blockquote>
9621
9622
9623 <p><b>Proposed resolution:</b></p>
9624 <p>Change "user-defined name" to "user-defined
9625 type".</p>
9626
9627
9628 <p><b>Rationale:</b></p>
9629 <p>This terminology is used in section 2.5.2 and 4.1.1 of <i>The C++
9630 Programming Language</i>.  It disallows the example in the issue,
9631 since the underlying type itself is not user-defined.  The only
9632 possible problem I can see is for non-type templates, but there's no
9633 possible way for a user to come up with a specialization for bitset,
9634 for example, that might not have already been specialized by the
9635 implementor?</p>
9636
9637 <p><i>[Toronto: this may be related to issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#120">120</a>.]</i></p>
9638
9639
9640 <p><i>[post-Toronto: Judy provided the above proposed resolution and
9641 rationale.]</i></p>
9642
9643
9644
9645
9646
9647
9648 <hr>
9649 <h3><a name="233"></a>233. Insertion hints in associative containers</h3>
9650 <p><b>Section:</b> 23.1.4 [associative.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9651  <b>Submitter:</b> Andrew Koenig <b>Date:</b> 2000-04-30</p>
9652 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
9653 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9654 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#192">192</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#246">246</a></p>
9655 <p><b>Discussion:</b></p>
9656 <p>
9657 If <tt>mm</tt> is a multimap and <tt>p</tt> is an iterator
9658 into the multimap, then <tt>mm.insert(p, x)</tt> inserts
9659 <tt>x</tt> into <tt>mm</tt> with <tt>p</tt> as a hint as
9660 to where it should go.  Table 69 claims that the execution time is
9661 amortized constant if the insert winds up taking place adjacent to
9662 <tt>p</tt>, but does not say when, if ever, this is guaranteed to
9663 happen.  All it says it that <tt>p</tt> is a hint as to where to
9664 insert.
9665 </p>
9666 <p>
9667 The question is whether there is any guarantee about the relationship
9668 between <tt>p</tt> and the insertion point, and, if so, what it
9669 is.
9670 </p>
9671 <p>
9672 I believe the present state is that there is no guarantee: The user
9673 can supply <tt>p</tt>, and the implementation is allowed to
9674 disregard it entirely.
9675 </p>
9676
9677 <p><b>Additional comments from Nathan:</b><br>
9678
9679 The vote [in Redmond] was on whether to elaborately specify the use of
9680 the hint, or to require behavior only if the value could be inserted
9681 adjacent to the hint.  I would like to ensure that we have a chance to
9682 vote for a deterministic treatment: "before, if possible, otherwise
9683 after, otherwise anywhere appropriate", as an alternative to the
9684 proposed "before or after, if possible, otherwise [...]".
9685 </p>
9686
9687 <p><i>[Toronto: there was general agreement that this is a real defect:
9688 when inserting an element x into a multiset that already contains
9689 several copies of x, there is no way to know whether the hint will be
9690 used.  The proposed resolution was that the new element should always
9691 be inserted as close to the hint as possible.  So, for example, if
9692 there is a subsequence of equivalent values, then providing a.begin()
9693 as the hint means that the new element should be inserted before the
9694 subsequence even if a.begin() is far away.  JC van Winkel supplied
9695 precise wording for this proposed resolution, and also for an
9696 alternative resolution in which hints are only used when they are
9697 adjacent to the insertion point.]</i></p>
9698
9699
9700 <p><i>[Copenhagen: the LWG agreed to the original proposed resolution,
9701 in which an insertion hint would be used even when it is far from the
9702 insertion point.  This was contingent on seeing a example
9703 implementation showing that it is possible to implement this
9704 requirement without loss of efficiency.  John Potter provided such a
9705 example implementation.]</i></p>
9706
9707
9708 <p><i>[Redmond: The LWG was reluctant to adopt the proposal that
9709 emerged from Copenhagen: it seemed excessively complicated, and went
9710 beyond fixing the defect that we identified in Toronto.  PJP provided
9711 the new wording described in this issue.  Nathan agrees that we
9712 shouldn't adopt the more detailed semantics, and notes: "we know that
9713 you can do it efficiently enough with a red-black tree, but there are
9714 other (perhaps better) balanced tree techniques that might differ
9715 enough to make the detailed semantics hard to satisfy."]</i></p>
9716
9717
9718 <p><i>[Curaçao: Nathan should give us the alternative wording he
9719 suggests so the LWG can decide between the two options.]</i></p>
9720
9721
9722 <p><i>[Lillehammer: The LWG previously rejected the more detailed
9723   semantics, because it seemed more loike a new feature than like
9724   defect fixing.  We're now more sympathetic to it, but we (especially
9725   Bill) are still worried about performance.  N1780 describes a naive
9726   algorithm, but it's not clear whether there is a non-naive
9727   implementation. Is it possible to implement this as efficently as
9728   the current version of insert?]</i></p>
9729
9730
9731 <p><i>[Post Lillehammer:
9732 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1780.html">N1780</a>
9733 updated in post meeting mailing with
9734 feedback from Lillehammer with more information regarding performance.
9735 ]</i></p>
9736
9737
9738 <p><i>[
9739 Batavia:
9740 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1780.html">1780</a>
9741 accepted with minor wording changes in the proposed wording (reflected in the
9742 proposed resolution below).  Concerns about the performance of the algorithm
9743 were satisfactorily met by
9744 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1780.html">1780</a>.
9745 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#371">371</a> already handles the stability of equal ranges
9746 and so that part of the resolution from
9747 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1780.html">1780</a>
9748 is no longer needed (or reflected in the proposed wording below).
9749 ]</i></p>
9750
9751
9752
9753
9754 <p><b>Proposed resolution:</b></p>
9755
9756 <p>
9757 Change the indicated rows of the "Associative container requirements" Table in
9758 23.1.4 [associative.reqmts] to:
9759 </p>
9760
9761 <p></p><center>
9762 <table border="1">
9763 <caption>Associative container requirements</caption>
9764 <tbody><tr><th>expression</th> <th>return type</th>
9765 <th>assertion/note<br>pre/post-condition</th>
9766 <th>complexity</th></tr>
9767 <tr><td><tt>a_eq.insert(t)</tt></td>
9768 <td><tt>iterator</tt></td>
9769 <td>
9770 inserts <tt>t</tt> and returns the iterator pointing to the newly inserted
9771 element. <ins>If a range containing elements equivalent to <tt>t</tt> exists in
9772 <tt>a_eq</tt>, <tt>t</tt> is inserted at the end of that range.</ins>
9773 </td>
9774 <td>
9775 logarithmic
9776 </td></tr>
9777 <tr><td><tt>a.insert(p,t)</tt></td>
9778 <td><tt>iterator</tt></td>
9779 <td>
9780 inserts <tt>t</tt> if and only if there is no element with key equivalent to the
9781 key of <tt>t</tt> in containers with unique keys; always inserts <tt>t</tt> in containers
9782 with equivalent keys. always returns the iterator pointing to the element with key
9783 equivalent to the key of <tt>t</tt>. <del>iterator <tt>p</tt> is a hint pointing to where
9784 the insert should start to search.</del> <ins><tt>t</tt> is inserted as close as possible
9785 to the position just prior to <tt>p</tt>.</ins>
9786 </td>
9787 <td>
9788 logarithmic in general, but amortized constant if <tt>t</tt> is inserted right <del>after</del>
9789  <ins>before</ins> <tt>p</tt>.
9790 </td></tr>
9791 </tbody></table>
9792 </center>
9793
9794
9795
9796
9797
9798
9799 <hr>
9800 <h3><a name="234"></a>234. Typos in allocator definition</h3>
9801 <p><b>Section:</b> 20.7.5.1 [allocator.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9802  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 2000-04-24</p>
9803 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.members">issues</a> in [allocator.members].</p>
9804 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9805 <p><b>Discussion:</b></p>
9806 <p>In paragraphs 12 and 13 the effects of <tt>construct()</tt> and
9807 <tt>destruct()</tt> are described as returns but the functions actually
9808 return <tt>void</tt>.</p>
9809
9810
9811 <p><b>Proposed resolution:</b></p>
9812 <p>Substitute "Returns" by "Effect".</p>
9813
9814
9815
9816
9817 <hr>
9818 <h3><a name="235"></a>235. No specification of default ctor for reverse_iterator</h3>
9819 <p><b>Section:</b> 24.4.1.1 [reverse.iterator] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9820  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 2000-04-24</p>
9821 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9822 <p><b>Discussion:</b></p>
9823 <p>The declaration of <tt>reverse_iterator</tt> lists a default
9824 constructor.  However, no specification is given what this constructor
9825 should do.</p>
9826
9827
9828 <p><b>Proposed resolution:</b></p>
9829   <p>In section 24.4.1.3.1 [reverse.iter.cons] add the following
9830   paragraph:</p>
9831       <blockquote>
9832       <p><tt>reverse_iterator()</tt></p>
9833
9834       <p>Default initializes <tt>current</tt>. Iterator operations
9835       applied to the resulting iterator have defined behavior if and
9836       only if the corresponding operations are defined on a default
9837       constructed iterator of type <tt>Iterator</tt>.</p>
9838       </blockquote>
9839   <p><i>[pre-Copenhagen: Dietmar provide wording for proposed
9840   resolution.]</i></p>
9841
9842
9843
9844
9845
9846
9847 <hr>
9848 <h3><a name="237"></a>237. Undefined expression in complexity specification</h3>
9849 <p><b>Section:</b> 23.2.2.1 [deque.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9850  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 2000-04-24</p>
9851 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#deque.cons">issues</a> in [deque.cons].</p>
9852 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9853 <p><b>Discussion:</b></p>
9854 <p>The complexity specification in paragraph 6 says that the complexity
9855 is linear in <tt>first - last</tt>. Even if <tt>operator-()</tt> is
9856 defined on iterators this term is in general undefined because it
9857 would have to be <tt>last - first</tt>.</p>
9858
9859
9860 <p><b>Proposed resolution:</b></p>
9861   <p>Change paragraph 6 from</p>
9862      <blockquote><p>Linear in <i>first - last</i>.</p></blockquote>
9863   <p>to become</p>
9864      <blockquote><p>Linear in <i>distance(first, last)</i>.</p></blockquote>
9865
9866
9867
9868
9869 <hr>
9870 <h3><a name="238"></a>238. Contradictory results of stringbuf initialization.</h3>
9871 <p><b>Section:</b> 27.7.1.1 [stringbuf.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9872  <b>Submitter:</b> Dietmar Kühl <b>Date:</b> 2000-05-11</p>
9873 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9874 <p><b>Discussion:</b></p>
9875 <p>In 27.7.1.1 paragraph 4 the results of calling the constructor of
9876 'basic_stringbuf' are said to be <tt>str() == str</tt>. This is fine
9877 that far but consider this code:</p>
9878
9879 <pre>  std::basic_stringbuf&lt;char&gt; sbuf("hello, world", std::ios_base::openmode(0));
9880   std::cout &lt;&lt; "'" &lt;&lt; sbuf.str() &lt;&lt; "'\n";
9881 </pre>
9882
9883 <p>Paragraph 3 of 27.7.1.1 basically says that in this case neither
9884 the output sequence nor the input sequence is initialized and
9885 paragraph 2 of 27.7.1.2 basically says that <tt>str()</tt> either
9886 returns the input or the output sequence. None of them is initialized,
9887 ie. both are empty, in which case the return from <tt>str()</tt> is
9888 defined to be <tt>basic_string&lt;cT&gt;()</tt>.</p>
9889
9890 <p>However, probably only test cases in some testsuites will detect this
9891 "problem"...</p>
9892
9893
9894 <p><b>Proposed resolution:</b></p>
9895 <p>Remove 27.7.1.1 paragraph 4.</p>
9896
9897
9898 <p><b>Rationale:</b></p>
9899 <p>We could fix 27.7.1.1 paragraph 4, but there would be no point.  If
9900 we fixed it, it would say just the same thing as text that's already
9901 in the standard.</p>
9902
9903
9904
9905
9906 <hr>
9907 <h3><a name="239"></a>239. Complexity of unique() and/or unique_copy incorrect</h3>
9908 <p><b>Section:</b> 25.2.9 [alg.unique] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9909  <b>Submitter:</b> Angelika Langer <b>Date:</b> 2000-05-15</p>
9910 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.unique">issues</a> in [alg.unique].</p>
9911 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9912 <p><b>Discussion:</b></p>
9913 <p>The complexity of unique and unique_copy are inconsistent with each
9914 other and inconsistent with the implementations.&nbsp; The standard
9915 specifies:</p>
9916
9917 <p>for unique():</p>
9918
9919 <blockquote><p>-3- Complexity: If the range (last - first) is not empty, exactly
9920 (last - first) - 1 applications of the corresponding predicate, otherwise
9921 no applications of the predicate.</p></blockquote>
9922
9923 <p>for unique_copy():</p>
9924
9925 <blockquote><p>-7- Complexity: Exactly last - first applications of the corresponding
9926 predicate.</p></blockquote>
9927
9928 <p>
9929 The implementations do it the other way round: unique() applies the
9930 predicate last-first times and unique_copy() applies it last-first-1
9931 times.</p>
9932
9933 <p>As both algorithms use the predicate for pair-wise comparison of
9934 sequence elements I don't see a justification for unique_copy()
9935 applying the predicate last-first times, especially since it is not
9936 specified to which pair in the sequence the predicate is applied
9937 twice.</p>
9938
9939
9940 <p><b>Proposed resolution:</b></p>
9941 <p>Change both complexity sections in 25.2.9 [alg.unique] to:</p>
9942
9943 <blockquote><p>Complexity: For nonempty ranges, exactly last - first - 1
9944 applications of the corresponding predicate.</p></blockquote>
9945
9946
9947
9948
9949
9950
9951 <hr>
9952 <h3><a name="240"></a>240. Complexity of adjacent_find() is meaningless</h3>
9953 <p><b>Section:</b> 25.1.8 [alg.adjacent.find] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
9954  <b>Submitter:</b> Angelika Langer <b>Date:</b> 2000-05-15</p>
9955 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
9956 <p><b>Discussion:</b></p>
9957 <p>The complexity section of adjacent_find is defective:</p>
9958
9959 <blockquote>
9960 <pre>template &lt;class ForwardIterator&gt;
9961 ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last
9962                               BinaryPredicate pred);
9963 </pre>
9964
9965 <p>-1- Returns: The first iterator i such that both i and i + 1 are in
9966 the range [first, last) for which the following corresponding
9967 conditions hold: *i == *(i + 1), pred(*i, *(i + 1)) != false. Returns
9968 last if no such iterator is found.</p>
9969
9970 <p>-2- Complexity: Exactly find(first, last, value) - first applications
9971 of the corresponding predicate.
9972 </p>
9973 </blockquote>
9974
9975 <p>In the Complexity section, it is not defined what "value"
9976 is supposed to mean. My best guess is that "value" means an
9977 object for which one of the conditions pred(*i,value) or
9978 pred(value,*i) is true, where i is the iterator defined in the Returns
9979 section. However, the value type of the input sequence need not be
9980 equality-comparable and for this reason the term find(first, last,
9981 value) - first is meaningless.</p>
9982
9983 <p>A term such as find_if(first, last, bind2nd(pred,*i)) - first or
9984 find_if(first, last, bind1st(pred,*i)) - first might come closer to
9985 the intended specification.  Binders can only be applied to function
9986 objects that have the function call operator declared const, which is
9987 not required of predicates because they can have non-const data
9988 members. For this reason, a specification using a binder could only be
9989 an "as-if" specification.</p>
9990
9991
9992 <p><b>Proposed resolution:</b></p>
9993 <p>Change the complexity section in 25.1.8 [alg.adjacent.find] to:</p>
9994 <blockquote><p>
9995 For a nonempty range, exactly <tt>min((<i>i</i> - <i>first</i>) + 1,
9996 (<i>last</i> - <i>first</i>) - 1)</tt> applications of the
9997 corresponding predicate, where <i>i</i> is <tt>adjacent_find</tt>'s
9998 return value.
9999 </p></blockquote>
10000
10001 <p><i>[Copenhagen: the original resolution specified an upper
10002 bound.  The LWG preferred an exact count.]</i></p>
10003
10004
10005
10006
10007
10008
10009
10010 <hr>
10011 <h3><a name="241"></a>241. Does unique_copy() require CopyConstructible and Assignable?</h3>
10012 <p><b>Section:</b> 25.2.9 [alg.unique] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10013  <b>Submitter:</b> Angelika Langer <b>Date:</b> 2000-05-15</p>
10014 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.unique">issues</a> in [alg.unique].</p>
10015 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10016 <p><b>Discussion:</b></p>
10017
10018 <p>Some popular implementations of unique_copy() create temporary
10019 copies of values in the input sequence, at least if the input iterator
10020 is a pointer.  Such an implementation is built on the assumption that
10021 the value type is CopyConstructible and Assignable.</p>
10022
10023 <p>It is common practice in the standard that algorithms explicitly
10024 specify any additional requirements that they impose on any of the
10025 types used by the algorithm. An example of an algorithm that creates
10026 temporary copies and correctly specifies the additional requirements
10027 is accumulate(), 26.4.1 [rand.req].</p>
10028
10029 <p>Since the specifications of unique() and unique_copy() do not
10030 require CopyConstructible and Assignable of the InputIterator's value
10031 type the above mentioned implementations are not standard-compliant. I
10032 cannot judge whether this is a defect in the standard or a defect in
10033 the implementations.</p>
10034
10035
10036 <p><b>Proposed resolution:</b></p>
10037 <p>In 25.2.8 change:</p>
10038
10039 <blockquote><p>
10040 -4- Requires: The ranges [first, last) and [result, result+(last-first))
10041 shall not overlap.
10042 </p></blockquote>
10043
10044 <p>to:</p>
10045
10046 <blockquote>
10047   <p>-4- Requires: The ranges [first, last) and [result,
10048   result+(last-first)) shall not overlap. The expression *result =
10049   *first must be valid. If neither InputIterator nor OutputIterator
10050   meets the requirements of forward iterator then the value type of
10051   InputIterator must be copy constructible. Otherwise copy
10052   constructible is not required. </p>
10053 </blockquote>
10054
10055 <p><i>[Redmond: the original proposed resolution didn't impose an
10056 explicit requirement that the iterator's value type must be copy
10057 constructible, on the grounds that an input iterator's value type must
10058 always be copy constructible.  Not everyone in the LWG thought that
10059 this requirement was clear from table 72.  It has been suggested that
10060 it might be possible to implement <tt>unique_copy</tt> without
10061 requiring assignability, although current implementations do impose
10062 that requirement.  Howard provided new wording.]</i></p>
10063
10064
10065 <p><i>[
10066 Curaçao: The LWG changed the PR editorially to specify
10067 "neither...nor...meet..." as clearer than
10068 "both...and...do not meet...". Change believed to be so
10069 minor as not to require re-review.
10070 ]</i></p>
10071
10072
10073
10074
10075
10076
10077
10078
10079 <hr>
10080 <h3><a name="242"></a>242. Side effects of function objects</h3>
10081 <p><b>Section:</b> 25.2.4 [alg.transform], 26.4 [rand] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10082  <b>Submitter:</b> Angelika Langer <b>Date:</b> 2000-05-15</p>
10083 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.transform">issues</a> in [alg.transform].</p>
10084 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10085 <p><b>Discussion:</b></p>
10086 <p>The algorithms transform(), accumulate(), inner_product(),
10087 partial_sum(), and adjacent_difference() require that the function
10088 object supplied to them shall not have any side effects.</p>
10089
10090 <p>The standard defines a side effect in 1.9 [intro.execution] as:</p>
10091 <blockquote><p>-7- Accessing an object designated by a volatile lvalue (basic.lval),
10092 modifying an object, calling a library I/O function, or calling a function
10093 that does any of those operations are all side effects, which are changes
10094 in the state of the execution environment.</p></blockquote>
10095
10096 <p>As a consequence, the function call operator of a function object supplied
10097 to any of the algorithms listed above cannot modify data members, cannot
10098 invoke any function that has a side effect, and cannot even create and
10099 modify temporary objects.&nbsp; It is difficult to imagine a function object
10100 that is still useful under these severe limitations. For instance, any
10101 non-trivial transformator supplied to transform() might involve creation
10102 and modification of temporaries, which is prohibited according to the current
10103 wording of the standard.</p>
10104
10105 <p>On the other hand, popular implementations of these algorithms exhibit
10106 uniform and predictable behavior when invoked with a side-effect-producing
10107 function objects. It looks like the strong requirement is not needed for
10108 efficient implementation of these algorithms.</p>
10109
10110 <p>The requirement of&nbsp; side-effect-free function objects could be
10111 replaced by a more relaxed basic requirement (which would hold for all
10112 function objects supplied to any algorithm in the standard library):</p>
10113 <blockquote><p>A function objects supplied to an algorithm shall not invalidate
10114 any iterator or sequence that is used by the algorithm. Invalidation of
10115 the sequence includes destruction of the sorting order if the algorithm
10116 relies on the sorting order (see section 25.3 - Sorting and related operations
10117 [lib.alg.sorting]).</p></blockquote>
10118
10119 <p>I can't judge whether it is intended that the function objects supplied
10120 to transform(), accumulate(), inner_product(), partial_sum(), or adjacent_difference()
10121 shall not modify sequence elements through dereferenced iterators.</p>
10122
10123 <p>It is debatable whether this issue is a defect or a change request.
10124 Since the consequences for user-supplied function objects are drastic and
10125 limit the usefulness of the algorithms significantly I would consider it
10126 a defect.</p>
10127
10128
10129 <p><b>Proposed resolution:</b></p>
10130
10131 <p><i>Things to notice about these changes:</i></p>
10132
10133 <ol>
10134 <li> <i>The fully-closed ("[]" as opposed to half-closed "[)" ranges
10135      are intentional. we want to prevent side-effects from
10136      invalidating the end iterators.</i></li>
10137
10138 <li> <i>That has the unintentional side-effect of prohibiting
10139      modification of the end element as a side-effect. This could
10140      conceivably be significant in some cases.</i></li>
10141
10142 <li> <i>The wording also prevents side-effects from modifying elements
10143      of the output sequence. I can't imagine why anyone would want
10144      to do this, but it is arguably a restriction that implementors
10145      don't need to place on users.</i></li>
10146
10147 <li> <i>Lifting the restrictions imposed in #2 and #3 above is possible
10148      and simple, but would require more verbiage.</i></li>
10149 </ol>
10150
10151 <p>Change 25.2.3/2 from:</p>
10152
10153 <blockquote><p>
10154    -2- Requires: op and binary_op shall not have any side effects.
10155 </p></blockquote>
10156
10157 <p>to:</p>
10158
10159 <blockquote><p>
10160   -2- Requires: in the ranges [first1, last1], [first2, first2 +
10161   (last1 - first1)] and [result, result + (last1- first1)], op and
10162   binary_op shall neither modify elements nor invalidate iterators or
10163   subranges.
10164   [Footnote: The use of fully closed ranges is intentional --end footnote]
10165 </p></blockquote>
10166
10167
10168 <p>Change 25.2.3/2 from:</p>
10169
10170 <blockquote><p>
10171    -2- Requires: op and binary_op shall not have any side effects. 
10172 </p></blockquote>
10173
10174 <p>to:</p>
10175
10176 <blockquote><p>
10177   -2- Requires: op and binary_op shall not invalidate iterators or
10178    subranges, or modify elements in the ranges [first1, last1],
10179    [first2, first2 + (last1 - first1)], and [result, result + (last1
10180    - first1)].
10181   [Footnote: The use of fully closed ranges is intentional --end footnote]
10182 </p></blockquote>
10183
10184
10185 <p>Change 26.4.1/2 from:</p>
10186
10187 <blockquote><p>
10188   -2- Requires: T must meet the requirements of CopyConstructible
10189    (lib.copyconstructible) and Assignable (lib.container.requirements)
10190    types. binary_op shall not cause side effects.
10191 </p></blockquote>
10192
10193 <p>to:</p>
10194
10195 <blockquote><p>
10196   -2- Requires: T must meet the requirements of CopyConstructible
10197    (lib.copyconstructible) and Assignable
10198    (lib.container.requirements) types. In the range [first, last],
10199    binary_op shall neither modify elements nor invalidate iterators
10200    or subranges.
10201   [Footnote: The use of a fully closed range is intentional --end footnote]
10202 </p></blockquote>
10203
10204 <p>Change 26.4.2/2 from:</p>
10205
10206 <blockquote><p>
10207   -2- Requires: T must meet the requirements of CopyConstructible
10208    (lib.copyconstructible) and Assignable (lib.container.requirements)
10209    types. binary_op1 and binary_op2 shall not cause side effects.
10210 </p></blockquote>
10211
10212 <p>to:</p>
10213
10214 <blockquote><p>
10215   -2- Requires: T must meet the requirements of CopyConstructible
10216    (lib.copyconstructible) and Assignable (lib.container.requirements)
10217    types. In the ranges [first, last] and [first2, first2 + (last -
10218    first)], binary_op1 and binary_op2 shall neither modify elements
10219    nor invalidate iterators or subranges.
10220   [Footnote: The use of fully closed ranges is intentional --end footnote]
10221 </p></blockquote>
10222
10223
10224 <p>Change 26.4.3/4 from:</p>
10225
10226 <blockquote><p>
10227   -4- Requires: binary_op is expected not to have any side effects.
10228 </p></blockquote>
10229
10230 <p>to:</p>
10231
10232 <blockquote><p>
10233   -4- Requires: In the ranges [first, last] and [result, result +
10234    (last - first)], binary_op shall neither modify elements nor
10235    invalidate iterators or subranges.
10236   [Footnote: The use of fully closed ranges is intentional --end footnote]
10237 </p></blockquote>
10238
10239 <p>Change 26.4.4/2 from:</p>
10240
10241 <blockquote><p>
10242   -2- Requires: binary_op shall not have any side effects.
10243 </p></blockquote>
10244
10245 <p>to:</p>
10246
10247 <blockquote><p>
10248   -2- Requires: In the ranges [first, last] and [result, result +
10249    (last - first)], binary_op shall neither modify elements nor
10250    invalidate iterators or subranges.
10251   [Footnote: The use of fully closed ranges is intentional --end footnote]
10252 </p></blockquote>
10253
10254 <p><i>[Toronto: Dave Abrahams supplied wording.]</i></p>
10255
10256
10257 <p><i>[Copenhagen: Proposed resolution was modified slightly. Matt
10258 added footnotes pointing out that the use of closed ranges was
10259 intentional.]</i></p>
10260
10261
10262
10263
10264
10265
10266
10267 <hr>
10268 <h3><a name="243"></a>243. <tt>get</tt> and <tt>getline</tt> when sentry reports failure</h3>
10269 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10270  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-05-15</p>
10271 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
10272 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10273 <p><b>Discussion:</b></p>
10274 <p>basic_istream&lt;&gt;::get(), and basic_istream&lt;&gt;::getline(),
10275 are unclear with respect to the behavior and side-effects of the named
10276 functions in case of an error.</p>
10277
10278 <p>27.6.1.3, p1 states that "... If the sentry object returns
10279 true, when converted to a value of type bool, the function endeavors
10280 to obtain the requested input..." It is not clear from this (or
10281 the rest of the paragraph) what precisely the behavior should be when
10282 the sentry ctor exits by throwing an exception or when the sentry
10283 object returns false.  In particular, what is the number of characters
10284 extracted that gcount() returns supposed to be?</p>
10285
10286 <p>27.6.1.3 p8 and p19 say about the effects of get() and getline():
10287 "...  In any case, it then stores a null character (using
10288 charT()) into the next successive location of the array." Is not
10289 clear whether this sentence applies if either of the conditions above
10290 holds (i.e., when sentry fails).</p>
10291
10292
10293 <p><b>Proposed resolution:</b></p>
10294 <p>Add to 27.6.1.3, p1 after the sentence</p>
10295
10296 <blockquote><p>
10297 "... If the sentry object returns true, when converted to a value of
10298 type bool, the function endeavors to obtain the requested input."
10299 </p></blockquote>
10300
10301 <p>the following</p>
10302
10303
10304 <blockquote><p>
10305 "Otherwise, if the sentry constructor exits by throwing an exception or
10306 if the sentry object returns false, when converted to a value of type
10307 bool, the function returns without attempting to obtain any input. In
10308 either case the number of extracted characters is set to 0; unformatted
10309 input functions taking a character array of non-zero size as an argument
10310 shall also store a null character (using charT()) in the first location
10311 of the array."
10312 </p></blockquote>
10313
10314
10315 <p><b>Rationale:</b></p>
10316 <p>Although the general philosophy of the input functions is that the
10317 argument should not be modified upon failure, <tt>getline</tt>
10318 historically added a terminating null unconditionally.  Most
10319 implementations still do that.  Earlier versions of the draft standard
10320 had language that made this an unambiguous requirement; those words
10321 were moved to a place where their context made them less clear.  See
10322 Jerry Schwarz's message c++std-lib-7618.</p>
10323
10324
10325
10326
10327 <hr>
10328 <h3><a name="247"></a>247. <tt>vector</tt>, <tt>deque::insert</tt> complexity</h3>
10329 <p><b>Section:</b> 23.2.6.4 [vector.modifiers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10330  <b>Submitter:</b> Lisa Lippincott <b>Date:</b> 2000-06-06</p>
10331 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector.modifiers">issues</a> in [vector.modifiers].</p>
10332 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10333 <p><b>Discussion:</b></p>
10334 <p>Paragraph 2 of 23.2.6.4 [vector.modifiers] describes the complexity
10335 of <tt>vector::insert</tt>:</p>
10336
10337    <blockquote><p>
10338    Complexity: If first and last are forward iterators, bidirectional
10339    iterators, or random access iterators, the complexity is linear in
10340    the number of elements in the range [first, last) plus the distance
10341    to the end of the vector. If they are input iterators, the complexity
10342    is proportional to the number of elements in the range [first, last)
10343    times the distance to the end of the vector.
10344    </p></blockquote>
10345
10346 <p>First, this fails to address the non-iterator forms of
10347 <tt>insert</tt>.</p>
10348
10349 <p>Second, the complexity for input iterators misses an edge case --
10350 it requires that an arbitrary number of elements can be added at
10351 the end of a <tt>vector</tt> in constant time.</p>
10352
10353 <p>I looked to see if <tt>deque</tt> had a similar problem, and was
10354 surprised to find that <tt>deque</tt> places no requirement on the
10355 complexity of inserting multiple elements (23.2.2.3 [deque.modifiers],
10356 paragraph 3):</p>
10357
10358    <blockquote><p>
10359    Complexity: In the worst case, inserting a single element into a
10360    deque takes time linear in the minimum of the distance from the
10361    insertion point to the beginning of the deque and the distance
10362    from the insertion point to the end of the deque. Inserting a
10363    single element either at the beginning or end of a deque always
10364    takes constant time and causes a single call to the copy constructor
10365    of T.
10366    </p></blockquote>
10367
10368
10369 <p><b>Proposed resolution:</b></p>
10370
10371 <p>Change Paragraph 2 of 23.2.6.4 [vector.modifiers] to</p>
10372    <blockquote><p>
10373    Complexity: The complexity is linear in the number of elements 
10374    inserted plus the distance to the end of the vector.
10375    </p></blockquote>
10376
10377    <p><i>[For input iterators, one may achieve this complexity by first
10378    inserting at the end of the <tt>vector</tt>, and then using
10379    <tt>rotate</tt>.]</i></p>
10380
10381
10382 <p>Change 23.2.2.3 [deque.modifiers], paragraph 3, to:</p>
10383
10384    <blockquote><p>
10385    Complexity: The complexity is linear in the number of elements 
10386    inserted plus the shorter of the distances to the beginning and
10387    end of the deque.  Inserting a single element at either the
10388    beginning or the end of a deque causes a single call to the copy
10389    constructor of T.
10390    </p></blockquote>
10391
10392
10393
10394 <p><b>Rationale:</b></p>
10395 <p>This is a real defect, and proposed resolution fixes it: some
10396   complexities aren't specified that should be.  This proposed
10397   resolution does constrain deque implementations (it rules out the
10398   most naive possible implementations), but the LWG doesn't see a
10399   reason to permit that implementation.</p>
10400
10401
10402
10403
10404
10405 <hr>
10406 <h3><a name="248"></a>248. time_get fails to set eofbit</h3>
10407 <p><b>Section:</b> 22.2.5 [category.time] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10408  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-06-22</p>
10409 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10410 <p><b>Discussion:</b></p>
10411 <p>There is no requirement that any of time_get member functions set
10412 ios::eofbit when they reach the end iterator while parsing their input.
10413 Since members of both the num_get and money_get facets are required to
10414 do so (22.2.2.1.2, and 22.2.6.1.2, respectively), time_get members
10415 should follow the same requirement for consistency.</p>
10416
10417
10418 <p><b>Proposed resolution:</b></p>
10419 <p>Add paragraph 2 to section 22.2.5.1 with the following text:</p>
10420
10421 <blockquote><p>
10422 If the end iterator is reached during parsing by any of the get()
10423 member functions, the member sets ios_base::eofbit in err.
10424 </p></blockquote>
10425
10426
10427 <p><b>Rationale:</b></p>
10428 <p>Two alternative resolutions were proposed.  The LWG chose this one
10429 because it was more consistent with the way eof is described for other
10430 input facets.</p>
10431
10432
10433
10434
10435 <hr>
10436 <h3><a name="250"></a>250. splicing invalidates iterators</h3>
10437 <p><b>Section:</b> 23.2.4.4 [list.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10438  <b>Submitter:</b> Brian Parker  <b>Date:</b> 2000-07-14</p>
10439 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#list.ops">issues</a> in [list.ops].</p>
10440 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10441 <p><b>Discussion:</b></p>
10442 <p>
10443 Section 23.2.4.4 [list.ops] states that
10444 </p>
10445 <pre>  void splice(iterator position, list&lt;T, Allocator&gt;&amp; x);
10446 </pre>
10447 <p>
10448 <i>invalidates</i> all iterators and references to list <tt>x</tt>.
10449 </p>
10450
10451 <p>
10452 This is unnecessary and defeats an important feature of splice. In
10453 fact, the SGI STL guarantees that iterators to <tt>x</tt> remain valid
10454 after <tt>splice</tt>.
10455 </p>
10456
10457
10458 <p><b>Proposed resolution:</b></p>
10459
10460 <p>Add a footnote to 23.2.4.4 [list.ops], paragraph 1:</p>
10461 <blockquote><p>
10462 [<i>Footnote:</i> As specified in  [default.con.req], paragraphs
10463 4-5, the semantics described in this clause applies only to the case
10464 where allocators compare equal.  --end footnote]
10465 </p></blockquote>
10466
10467 <p>In 23.2.4.4 [list.ops], replace paragraph 4 with:</p>
10468 <blockquote><p>
10469 Effects: Inserts the contents of x before position and x becomes 
10470 empty.  Pointers and references to the moved elements of x now refer to 
10471 those same elements but as members of *this.  Iterators referring to the 
10472 moved elements will continue to refer to their elements, but they now 
10473 behave as iterators into *this, not into x.
10474 </p></blockquote>
10475
10476 <p>In 23.2.4.4 [list.ops], replace paragraph 7 with:</p>
10477 <blockquote><p>
10478 Effects: Inserts an element pointed to by i from list x before 
10479 position and removes the element from x. The result is unchanged if 
10480 position == i or position == ++i.  Pointers and references to *i continue 
10481 to refer to this same element but as a member of *this.  Iterators to *i 
10482 (including i itself) continue to refer to the same element, but now 
10483 behave as iterators into *this, not into x.
10484 </p></blockquote>
10485
10486 <p>In 23.2.4.4 [list.ops], replace paragraph 12 with:</p>
10487 <blockquote><p>
10488 Requires: [first, last) is a valid range in x. The result is 
10489 undefined if position is an iterator in the range [first, last).  
10490 Pointers and references to the moved elements of x now refer to those 
10491 same elements but as members of *this.  Iterators referring to the moved 
10492 elements will continue to refer to their elements, but they now behave as 
10493 iterators into *this, not into x.
10494 </p></blockquote>
10495
10496 <p><i>[pre-Copenhagen: Howard provided wording.]</i></p>
10497
10498
10499
10500 <p><b>Rationale:</b></p>
10501 <p>The original proposed resolution said that iterators and references
10502 would remain "valid".  The new proposed resolution clarifies what that
10503 means.  Note that this only applies to the case of equal allocators.
10504 From  [default.con.req] paragraph 4, the behavior of list when
10505 allocators compare nonequal is outside the scope of the standard.</p>
10506
10507
10508
10509
10510 <hr>
10511 <h3><a name="251"></a>251. basic_stringbuf missing allocator_type</h3>
10512 <p><b>Section:</b> 27.7.1 [stringbuf] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10513  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-07-28</p>
10514 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10515 <p><b>Discussion:</b></p>
10516 <p>The synopsis for the template class <tt>basic_stringbuf</tt>
10517 doesn't list a typedef for the template parameter
10518 <tt>Allocator</tt>. This makes it impossible to determine the type of
10519 the allocator at compile time. It's also inconsistent with all other
10520 template classes in the library that do provide a typedef for the
10521 <tt>Allocator</tt> parameter.</p>
10522
10523
10524 <p><b>Proposed resolution:</b></p>
10525 <p>Add to the synopses of the class templates basic_stringbuf (27.7.1),
10526 basic_istringstream (27.7.2), basic_ostringstream (27.7.3), and 
10527 basic_stringstream (27.7.4) the typedef:</p>
10528 <pre>  typedef Allocator allocator_type;
10529 </pre>
10530
10531
10532
10533
10534 <hr>
10535 <h3><a name="252"></a>252. missing casts/C-style casts used in iostreams</h3>
10536 <p><b>Section:</b> 27.7 [string.streams] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10537  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-07-28</p>
10538 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.streams">issues</a> in [string.streams].</p>
10539 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10540 <p><b>Discussion:</b></p>
10541 <p>27.7.2.2, p1 uses a C-style cast rather than the more appropriate
10542 const_cast&lt;&gt; in the Returns clause for basic_istringstream&lt;&gt;::rdbuf().
10543 The same C-style cast is being used in 27.7.3.2, p1, D.7.2.2, p1, and
10544 D.7.3.2, p1, and perhaps elsewhere. 27.7.6, p1 and D.7.2.2, p1 are missing
10545 the cast altogether.</p>
10546
10547 <p>C-style casts have not been deprecated, so the first part of this
10548 issue is stylistic rather than a matter of correctness.</p>
10549
10550
10551 <p><b>Proposed resolution:</b></p>
10552 <p>In 27.7.2.2, p1 replace </p>
10553 <pre>  -1- Returns: (basic_stringbuf&lt;charT,traits,Allocator&gt;*)&amp;sb.</pre>
10554
10555 <p>with</p>
10556 <pre>  -1- Returns: const_cast&lt;basic_stringbuf&lt;charT,traits,Allocator&gt;*&gt;(&amp;sb).</pre>
10557
10558
10559 <p>In 27.7.3.2, p1 replace</p>
10560 <pre>  -1- Returns: (basic_stringbuf&lt;charT,traits,Allocator&gt;*)&amp;sb.</pre>
10561
10562 <p>with</p>
10563 <pre>  -1- Returns: const_cast&lt;basic_stringbuf&lt;charT,traits,Allocator&gt;*&gt;(&amp;sb).</pre>
10564
10565 <p>In 27.7.6, p1, replace</p>
10566 <pre>  -1- Returns: &amp;sb</pre>
10567
10568 <p>with</p>
10569 <pre>  -1- Returns: const_cast&lt;basic_stringbuf&lt;charT,traits,Allocator&gt;*&gt;(&amp;sb).</pre>
10570
10571 <p>In D.7.2.2, p1 replace</p>
10572 <pre>  -2- Returns: &amp;sb. </pre>
10573
10574 <p>with</p>
10575 <pre>  -2- Returns: const_cast&lt;strstreambuf*&gt;(&amp;sb).</pre>
10576
10577
10578
10579
10580 <hr>
10581 <h3><a name="253"></a>253. valarray helper functions are almost entirely useless</h3>
10582 <p><b>Section:</b> 26.5.2.1 [valarray.cons], 26.5.2.2 [valarray.assign] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10583  <b>Submitter:</b> Robert Klarer <b>Date:</b> 2000-07-31</p>
10584 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#valarray.cons">active issues</a> in [valarray.cons].</p>
10585 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#valarray.cons">issues</a> in [valarray.cons].</p>
10586 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10587 <p><b>Discussion:</b></p>
10588 <p>This discussion is adapted from message c++std-lib-7056 posted
10589 November 11, 1999.  I don't think that anyone can reasonably claim
10590 that the problem described below is NAD.</p>
10591
10592 <p>These valarray constructors can never be called:</p>
10593
10594 <pre>   template &lt;class T&gt;
10595          valarray&lt;T&gt;::valarray(const slice_array&lt;T&gt; &amp;);
10596    template &lt;class T&gt;
10597          valarray&lt;T&gt;::valarray(const gslice_array&lt;T&gt; &amp;);
10598    template &lt;class T&gt;
10599          valarray&lt;T&gt;::valarray(const mask_array&lt;T&gt; &amp;);
10600    template &lt;class T&gt;
10601          valarray&lt;T&gt;::valarray(const indirect_array&lt;T&gt; &amp;);
10602 </pre>
10603
10604 <p>Similarly, these valarray assignment operators cannot be
10605 called:</p>
10606
10607 <pre>     template &lt;class T&gt;
10608      valarray&lt;T&gt; valarray&lt;T&gt;::operator=(const slice_array&lt;T&gt; &amp;);
10609      template &lt;class T&gt;
10610      valarray&lt;T&gt; valarray&lt;T&gt;::operator=(const gslice_array&lt;T&gt; &amp;);
10611      template &lt;class T&gt;
10612      valarray&lt;T&gt; valarray&lt;T&gt;::operator=(const mask_array&lt;T&gt; &amp;);
10613      template &lt;class T&gt;
10614      valarray&lt;T&gt; valarray&lt;T&gt;::operator=(const indirect_array&lt;T&gt; &amp;);
10615 </pre>
10616
10617 <p>Please consider the following example:</p>
10618
10619 <pre>   #include &lt;valarray&gt;
10620    using namespace std;
10621
10622    int main()
10623    {
10624        valarray&lt;double&gt; va1(12);
10625        valarray&lt;double&gt; va2(va1[slice(1,4,3)]); // line 1
10626    }
10627 </pre>
10628
10629
10630 <p>Since the valarray va1 is non-const, the result of the sub-expression
10631 va1[slice(1,4,3)] at line 1 is an rvalue of type const
10632 std::slice_array&lt;double&gt;.  This slice_array rvalue is then used to
10633 construct va2.  The constructor that is used to construct va2 is
10634 declared like this:</p>
10635
10636 <pre>     template &lt;class T&gt;
10637      valarray&lt;T&gt;::valarray(const slice_array&lt;T&gt; &amp;);
10638 </pre>
10639
10640 <p>Notice the constructor's const reference parameter.  When the
10641 constructor is called, a slice_array must be bound to this reference.
10642 The rules for binding an rvalue to a const reference are in 8.5.3,
10643 paragraph 5 (see also 13.3.3.1.4).  Specifically, paragraph 5
10644 indicates that a second slice_array rvalue is constructed (in this
10645 case copy-constructed) from the first one; it is this second rvalue
10646 that is bound to the reference parameter.  Paragraph 5 also requires
10647 that the constructor that is used for this purpose be callable,
10648 regardless of whether the second rvalue is elided.  The
10649 copy-constructor in this case is not callable, however, because it is
10650 private.  Therefore, the compiler should report an error.</p>
10651
10652 <p>Since slice_arrays are always rvalues, the valarray constructor that has a
10653 parameter of type const slice_array&lt;T&gt; &amp; can never be called.  The
10654 same reasoning applies to the three other constructors and the four
10655 assignment operators that are listed at the beginning of this post.
10656 Furthermore, since these functions cannot be called, the valarray helper
10657 classes are almost entirely useless.</p>
10658
10659
10660 <p><b>Proposed resolution:</b></p>
10661 <p>slice_array:</p>
10662 <ul>
10663 <li> Make the copy constructor and copy-assignment operator declarations
10664      public in the slice_array class template definition in 26.5.5 [template.slice.array] </li>
10665 <li> remove paragraph 3 of 26.5.5 [template.slice.array]</li>
10666 <li> remove the copy constructor declaration from  [cons.slice.arr]</li>
10667 <li> change paragraph 1 of  [cons.slice.arr] to read "This constructor is declared
10668     to be private.  This constructor need not be defined."</li>
10669 <li> remove the first sentence of paragraph 1 of 26.5.5.1 [slice.arr.assign]</li>
10670 <li> Change the first three words of the second sentence of paragraph 1 of
10671     26.5.5.1 [slice.arr.assign] to "These assignment operators have"</li>
10672 </ul>
10673
10674 <p>gslice_array:</p>
10675 <ul>
10676 <li> Make the copy constructor and copy-assignment operator declarations
10677     public in the gslice_array class template definition in 26.5.7 [template.gslice.array] </li>
10678 <li> remove the note in paragraph 3 of 26.5.7 [template.gslice.array]</li>
10679 <li> remove the copy constructor declaration from  [gslice.array.cons]</li>
10680 <li> change paragraph 1 of  [gslice.array.cons] to read "This constructor is declared
10681     to be private.  This constructor need not be defined."</li>
10682 <li> remove the first sentence of paragraph 1 of 26.5.7.1 [gslice.array.assign]</li>
10683 <li> Change the first three words of the second sentence of paragraph 1 of
10684     26.5.7.1 [gslice.array.assign] to "These assignment operators have"</li>
10685 </ul>
10686
10687 <p>mask_array:</p>
10688 <ul>
10689 <li> Make the copy constructor and copy-assignment operator declarations
10690     public in the mask_array class template definition in 26.5.8 [template.mask.array] </li>
10691 <li> remove the note in paragraph 2 of 26.5.8 [template.mask.array]</li>
10692 <li> remove the copy constructor declaration from  [mask.array.cons]</li>
10693 <li> change paragraph 1 of  [mask.array.cons] to read "This constructor is declared
10694     to be private.  This constructor need not be defined."</li>
10695 <li> remove the first sentence of paragraph 1 of 26.5.8.1 [mask.array.assign]</li>
10696 <li> Change the first three words of the second sentence of paragraph 1 of
10697     26.5.8.1 [mask.array.assign] to "These assignment operators have"</li>
10698 </ul>
10699
10700 <p>indirect_array:</p>
10701 <ul>
10702 <li>Make the copy constructor and copy-assignment operator declarations
10703     public in the indirect_array class definition in 26.5.9 [template.indirect.array]</li>
10704 <li> remove the note in paragraph 2 of 26.5.9 [template.indirect.array]</li>
10705 <li> remove the copy constructor declaration from  [indirect.array.cons]</li>
10706 <li> change the descriptive text in  [indirect.array.cons] to read "This constructor is
10707     declared to be private.  This constructor need not be defined."</li>
10708 <li> remove the first sentence of paragraph 1 of 26.5.9.1 [indirect.array.assign]</li>
10709 <li> Change the first three words of the second sentence of paragraph 1 of
10710     26.5.9.1 [indirect.array.assign] to "These assignment operators have"</li>
10711 </ul>
10712 <p><i>[Proposed resolution was modified in Santa Cruz: explicitly make
10713 copy constructor and copy assignment operators public, instead of
10714 removing them.]</i></p>
10715
10716
10717
10718 <p><b>Rationale:</b></p>
10719 <p>Keeping the valarray constructors private is untenable.  Merely
10720 making valarray a friend of the helper classes isn't good enough,
10721 because access to the copy constructor is checked in the user's
10722 environment.</p>
10723
10724 <p>Making the assignment operator public is not strictly necessary to
10725 solve this problem.  A majority of the LWG <i>(straw poll: 13-4)</i>
10726 believed we should make the assignment operators public, in addition
10727 to the copy constructors, for reasons of symmetry and user
10728 expectation.</p>
10729
10730
10731
10732
10733
10734 <hr>
10735 <h3><a name="254"></a>254. Exception types in clause 19 are constructed from <tt>std::string</tt></h3>
10736 <p><b>Section:</b> 19.1 [std.exceptions], 27.4.2.1.1 [ios::failure] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
10737  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2000-08-01</p>
10738 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
10739 <p><b>Discussion:</b></p>
10740 <p>
10741 Many of the standard exception types which implementations are
10742 required to throw are constructed with a const std::string&amp;
10743 parameter. For example:
10744 </p>
10745
10746 <pre>     19.1.5  Class out_of_range                          [lib.out.of.range]
10747      namespace std {
10748        class out_of_range : public logic_error {
10749        public:
10750          explicit out_of_range(const string&amp; what_arg);
10751        };
10752      }
10753
10754    1 The class out_of_range defines the type of objects  thrown  as  excep-
10755      tions to report an argument value not in its expected range.
10756
10757      out_of_range(const string&amp; what_arg);
10758
10759      Effects:
10760        Constructs an object of class out_of_range.
10761      Postcondition:
10762        strcmp(what(), what_arg.c_str()) == 0.
10763 </pre>
10764
10765 <p>
10766 There are at least two problems with this:
10767 </p>
10768 <ol>
10769 <li>A program which is low on memory may end up throwing
10770 std::bad_alloc instead of out_of_range because memory runs out while
10771 constructing the exception object.</li>
10772 <li>An obvious implementation which stores a std::string data member
10773 may end up invoking terminate() during exception unwinding because the
10774 exception object allocates memory (or rather fails to) as it is being
10775 copied.</li>
10776 </ol>
10777
10778 <p>
10779 There may be no cure for (1) other than changing the interface to
10780 out_of_range, though one could reasonably argue that (1) is not a
10781 defect. Personally I don't care that much if out-of-memory is reported
10782 when I only have 20 bytes left, in the case when out_of_range would
10783 have been reported. People who use exception-specifications might care
10784 a lot, though.
10785 </p>
10786
10787 <p>
10788 There is a cure for (2), but it isn't completely obvious. I think a
10789 note for implementors should be made in the standard. Avoiding
10790 possible termination in this case shouldn't be left up to chance.  The
10791 cure is to use a reference-counted "string" implementation
10792 in the exception object. I am not necessarily referring to a
10793 std::string here; any simple reference-counting scheme for a NTBS
10794 would do.
10795 </p>
10796
10797 <p><b>Further discussion, in email:</b></p>
10798
10799 <p>
10800 ...I'm not so concerned about (1). After all, a library implementation
10801 can add const char* constructors as an extension, and users don't
10802 <i>need</i> to avail themselves of the standard exceptions, though this is
10803 a lame position to be forced into.  FWIW, std::exception and
10804 std::bad_alloc don't require a temporary basic_string.
10805 </p>
10806
10807 <p>
10808 ...I don't think the fixed-size buffer is a solution to the problem,
10809 strictly speaking, because you can't satisfy the postcondition
10810 <br>
10811     <tt>&nbsp;&nbsp;strcmp(what(), what_arg.c_str()) == 0</tt>
10812 <br>
10813 For all values of what_arg (i.e. very long values). That means that
10814 the only truly conforming solution requires a dynamic allocation.
10815 </p>
10816
10817 <p><b>Further discussion, from Redmond:</b></p>
10818
10819 <p>The most important progress we made at the Redmond meeting was
10820 realizing that there are two separable issues here: the const
10821 string&amp; constructor, and the copy constructor.  If a user writes
10822 something like <tt>throw std::out_of_range("foo")</tt>, the const
10823 string&amp; constructor is invoked before anything gets thrown.  The
10824 copy constructor is potentially invoked during stack unwinding.</p>
10825
10826 <p>The copy constructor is a more serious problem, becuase failure
10827 during stack unwinding invokes <tt>terminate</tt>.  The copy
10828 constructor must be nothrow. <i>Curaçao: Howard thinks this
10829 requirement may already be present.</i></p>
10830
10831 <p>The fundamental problem is that it's difficult to get the nothrow
10832 requirement to work well with the requirement that the exception
10833 objects store a string of unbounded size, particularly if you also try
10834 to make the const string&amp; constructor nothrow.  Options discussed
10835 include:</p>
10836
10837 <ul>
10838 <li>Limit the size of a string that exception objects are required to
10839 throw: change the postconditions of 19.1.2 [domain.error] paragraph 3
10840 and 19.1.6 [runtime.error] paragraph 3 to something like this:
10841 "strncmp(what(), what_arg._str(), N) == 0, where N is an
10842 implementation defined constant no smaller than 256".</li>
10843 <li>Allow the const string&amp; constructor to throw, but not the
10844 copy constructor.  It's the implementor's responsibility to get it
10845 right.  (An implementor might use a simple refcount class.)</li>
10846 <li>Compromise between the two: an implementation is not allowed to
10847 throw if the string's length is less than some N, but, if it doesn't
10848 throw, the string must compare equal to the argument.</li>
10849 <li>Add a new constructor that takes a const char*</li>
10850 </ul>
10851
10852 <p>(Not all of these options are mutually exclusive.)</p>
10853
10854
10855
10856 <p><b>Proposed resolution:</b></p>
10857
10858 <p>
10859 Change 19.1.1 [logic.error]
10860 </p>
10861
10862 <blockquote>
10863 <pre>namespace std {
10864   class logic_error : public exception {
10865   public:
10866     explicit logic_error(const string&amp; <i>what_arg</i>);
10867     <ins>explicit logic_error(const char* <i>what_arg</i>);</ins>
10868   };
10869 }
10870 </pre>
10871 <p>...</p>
10872 <p>
10873 <ins><tt>logic_error(const char* <i>what_arg</i>);</tt></ins>
10874 </p>
10875 <blockquote>
10876 <p><ins>
10877 -4- <i>Effects:</i> Constructs an object of class <tt>logic_error</tt>.
10878 </ins></p>
10879 <p><ins>
10880 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
10881 </ins></p>
10882 </blockquote>
10883
10884 </blockquote>
10885
10886 <p>
10887 Change 19.1.2 [domain.error]
10888 </p>
10889
10890 <blockquote>
10891 <pre>namespace std {
10892   class domain_error : public logic_error {
10893   public:
10894     explicit domain_error(const string&amp; <i>what_arg</i>);
10895     <ins>explicit domain_error(const char* <i>what_arg</i>);</ins>
10896   };
10897 }
10898 </pre>
10899 <p>...</p>
10900 <p>
10901 <ins><tt>domain_error(const char* <i>what_arg</i>);</tt></ins>
10902 </p>
10903 <blockquote>
10904 <p><ins>
10905 -4- <i>Effects:</i> Constructs an object of class <tt>domain_error</tt>.
10906 </ins></p>
10907 <p><ins>
10908 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
10909 </ins></p>
10910
10911 </blockquote>
10912 </blockquote>
10913
10914 <p>
10915 Change 19.1.3 [invalid.argument]
10916 </p>
10917
10918 <blockquote>
10919 <pre>namespace std {
10920   class invalid_argument : public logic_error {
10921   public:
10922     explicit invalid_argument(const string&amp; <i>what_arg</i>);
10923     <ins>explicit invalid_argument(const char* <i>what_arg</i>);</ins>
10924   };
10925 }
10926 </pre>
10927 <p>...</p>
10928 <p>
10929 <ins><tt>invalid_argument(const char* <i>what_arg</i>);</tt></ins>
10930 </p>
10931 <blockquote>
10932 <p><ins>
10933 -4- <i>Effects:</i> Constructs an object of class <tt>invalid_argument</tt>.
10934 </ins></p>
10935 <p><ins>
10936 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
10937 </ins></p>
10938 </blockquote>
10939
10940 </blockquote>
10941
10942 <p>
10943 Change 19.1.4 [length.error]
10944 </p>
10945
10946 <blockquote>
10947 <pre>namespace std {
10948   class length_error : public logic_error {
10949   public:
10950     explicit length_error(const string&amp; <i>what_arg</i>);
10951     <ins>explicit length_error(const char* <i>what_arg</i>);</ins>
10952   };
10953 }
10954 </pre>
10955 <p>...</p>
10956 <p>
10957 <ins><tt>length_error(const char* <i>what_arg</i>);</tt></ins>
10958 </p>
10959 <blockquote>
10960 <p><ins>
10961 -4- <i>Effects:</i> Constructs an object of class <tt>length_error</tt>.
10962 </ins></p>
10963 <p><ins>
10964 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
10965 </ins></p>
10966 </blockquote>
10967
10968 </blockquote>
10969
10970 <p>
10971 Change 19.1.5 [out.of.range]
10972 </p>
10973
10974 <blockquote>
10975 <pre>namespace std {
10976   class out_of_range : public logic_error {
10977   public:
10978     explicit out_of_range(const string&amp; <i>what_arg</i>);
10979     <ins>explicit out_of_range(const char* <i>what_arg</i>);</ins>
10980   };
10981 }
10982 </pre>
10983 <p>...</p>
10984 <p>
10985 <ins><tt>out_of_range(const char* <i>what_arg</i>);</tt></ins>
10986 </p>
10987 <blockquote>
10988 <p><ins>
10989 -4- <i>Effects:</i> Constructs an object of class <tt>out_of_range</tt>.
10990 </ins></p>
10991 <p><ins>
10992 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
10993 </ins></p>
10994 </blockquote>
10995
10996 </blockquote>
10997
10998 <p>
10999 Change 19.1.6 [runtime.error]
11000 </p>
11001
11002 <blockquote>
11003 <pre>namespace std {
11004   class runtime_error : public exception {
11005   public:
11006     explicit runtime_error(const string&amp; <i>what_arg</i>);
11007     <ins>explicit runtime_error(const char* <i>what_arg</i>);</ins>
11008   };
11009 }
11010 </pre>
11011 <p>...</p>
11012 <p>
11013 <ins><tt>runtime_error(const char* <i>what_arg</i>);</tt></ins>
11014 </p>
11015 <blockquote>
11016 <p><ins>
11017 -4- <i>Effects:</i> Constructs an object of class <tt>runtime_error</tt>.
11018 </ins></p>
11019 <p><ins>
11020 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
11021 </ins></p>
11022 </blockquote>
11023
11024 </blockquote>
11025
11026 <p>
11027 Change 19.1.7 [range.error]
11028 </p>
11029
11030 <blockquote>
11031 <pre>namespace std {
11032   class range_error : public runtime_error {
11033   public:
11034     explicit range_error(const string&amp; <i>what_arg</i>);
11035     <ins>explicit range_error(const char* <i>what_arg</i>);</ins>
11036   };
11037 }
11038 </pre>
11039 <p>...</p>
11040 <p>
11041 <ins><tt>range_error(const char* <i>what_arg</i>);</tt></ins>
11042 </p>
11043 <blockquote>
11044 <p><ins>
11045 -4- <i>Effects:</i> Constructs an object of class <tt>range_error</tt>.
11046 </ins></p>
11047 <p><ins>
11048 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
11049 </ins></p>
11050 </blockquote>
11051
11052 </blockquote>
11053
11054 <p>
11055 Change 19.1.8 [overflow.error]
11056 </p>
11057
11058 <blockquote>
11059 <pre>namespace std {
11060   class overflow_error : public runtime_error {
11061   public:
11062     explicit overflow_error(const string&amp; <i>what_arg</i>);
11063     <ins>explicit overflow_error(const char* <i>what_arg</i>);</ins>
11064   };
11065 }
11066 </pre>
11067 <p>...</p>
11068 <p>
11069 <ins><tt>overflow_error(const char* <i>what_arg</i>);</tt></ins>
11070 </p>
11071 <blockquote>
11072 <p><ins>
11073 -4- <i>Effects:</i> Constructs an object of class <tt>overflow_error</tt>.
11074 </ins></p>
11075 <p><ins>
11076 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
11077 </ins></p>
11078 </blockquote>
11079
11080 </blockquote>
11081
11082 <p>
11083 Change 19.1.9 [underflow.error]
11084 </p>
11085
11086 <blockquote>
11087 <pre>namespace std {
11088   class underflow_error : public runtime_error {
11089   public:
11090     explicit underflow_error(const string&amp; <i>what_arg</i>);
11091     <ins>explicit underflow_error(const char* <i>what_arg</i>);</ins>
11092   };
11093 }
11094 </pre>
11095 <p>...</p>
11096 <p>
11097 <ins><tt>underflow_error(const char* <i>what_arg</i>);</tt></ins>
11098 </p>
11099 <blockquote>
11100 <p><ins>
11101 -4- <i>Effects:</i> Constructs an object of class <tt>underflow_error</tt>.
11102 </ins></p>
11103 <p><ins>
11104 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>what_arg</i>) == 0</tt>.
11105 </ins></p>
11106 </blockquote>
11107
11108 </blockquote>
11109
11110 <p>
11111 Change 27.4.2.1.1 [ios::failure]
11112 </p>
11113
11114 <blockquote>
11115 <pre>namespace std {
11116   class ios_base::failure : public exception {
11117   public:
11118     explicit failure(const string&amp; <i>msg</i>);
11119     <ins>explicit failure(const char* <i>msg</i>);</ins>
11120     virtual const char* what() const throw();
11121 };
11122 }
11123 </pre>
11124 <p>...</p>
11125 <p>
11126 <ins><tt>failure(const char* <i>msg</i>);</tt></ins>
11127 </p>
11128 <blockquote>
11129 <p><ins>
11130 -4- <i>Effects:</i> Constructs an object of class <tt>failure</tt>.
11131 </ins></p>
11132 <p><ins>
11133 -5- <i>Postcondition:</i> <tt>strcmp(what(), <i>msg</i>) == 0</tt>.
11134 </ins></p>
11135 </blockquote>
11136
11137 </blockquote>
11138
11139
11140
11141 <p><b>Rationale:</b></p>
11142
11143 <p>Throwing a bad_alloc while trying to construct a message for another
11144 exception-derived class is not necessarily a bad thing.  And the
11145 bad_alloc constructor already has a no throw spec on it (18.4.2.1).</p>
11146
11147 <p><b>Future:</b></p>
11148
11149 <p>All involved would like to see const char* constructors added, but
11150 this should probably be done for C++0X as opposed to a DR.</p>
11151
11152 <p>I believe the no throw specs currently decorating these functions
11153 could be improved by some kind of static no throw spec checking
11154 mechanism (in a future C++ language).  As they stand, the copy
11155 constructors might fail via a call to unexpected.  I think what is
11156 intended here is that the copy constructors can't fail.</p>
11157
11158 <p><i>[Pre-Sydney: reopened at the request of Howard Hinnant.
11159   Post-Redmond: James Kanze noticed that the copy constructors of
11160   exception-derived classes do not have nothrow clauses.  Those
11161   classes have no copy constructors declared, meaning the
11162   compiler-generated implicit copy constructors are used, and those
11163   compiler-generated constructors might in principle throw anything.]</i></p>
11164
11165
11166 <p><i>[
11167 Batavia:  Merged copy constructor and assignment operator spec into <tt>exception</tt>
11168 and added <tt>ios::failure</tt> into the proposed resolution.
11169 ]</i></p>
11170
11171
11172 <p><i>[
11173 Oxford:  The proposed resolution simply addresses the issue of constructing
11174 the exception objects with <tt>const char*</tt> and string literals without
11175 the need to explicit include or construct a <tt>std::string</tt>.
11176 ]</i></p>
11177
11178
11179
11180
11181
11182
11183
11184 <hr>
11185 <h3><a name="256"></a>256. typo in 27.4.4.2, p17: copy_event does not exist</h3>
11186 <p><b>Section:</b> 27.4.4.2 [basic.ios.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11187  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-08-21</p>
11188 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.ios.members">active issues</a> in [basic.ios.members].</p>
11189 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.ios.members">issues</a> in [basic.ios.members].</p>
11190 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11191 <p><b>Discussion:</b></p>
11192 <p>
11193 27.4.4.2, p17 says
11194 </p>
11195
11196 <blockquote><p>
11197 -17- Before copying any parts of rhs, calls each registered callback
11198 pair (fn,index) as (*fn)(erase_event,*this,index). After all parts but
11199 exceptions() have been replaced, calls each callback pair that was
11200 copied from rhs as (*fn)(copy_event,*this,index). 
11201 </p></blockquote>
11202
11203 <p>
11204 The name copy_event isn't defined anywhere. The intended name was
11205 copyfmt_event.
11206 </p>
11207
11208
11209 <p><b>Proposed resolution:</b></p>
11210 <p>Replace copy_event with copyfmt_event in the named paragraph.</p>
11211
11212
11213
11214
11215 <hr>
11216 <h3><a name="258"></a>258. Missing allocator requirement</h3>
11217 <p><b>Section:</b> 20.1.2 [allocator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11218  <b>Submitter:</b> Matt Austern <b>Date:</b> 2000-08-22</p>
11219 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#allocator.requirements">active issues</a> in [allocator.requirements].</p>
11220 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.requirements">issues</a> in [allocator.requirements].</p>
11221 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11222 <p><b>Discussion:</b></p>
11223 <p>
11224 From lib-7752:
11225 </p>
11226
11227 <p>
11228 I've been assuming (and probably everyone else has been assuming) that
11229 allocator instances have a particular property, and I don't think that
11230 property can be deduced from anything in Table 32.
11231 </p>
11232
11233 <p>
11234 I think we have to assume that allocator type conversion is a
11235 homomorphism.  That is, if x1 and x2 are of type X, where
11236 X::value_type is T, and if type Y is X::template
11237 rebind&lt;U&gt;::other, then Y(x1) == Y(x2) if and only if x1 == x2.
11238 </p>
11239
11240 <p>
11241 Further discussion: Howard Hinnant writes, in lib-7757:
11242 </p>
11243
11244 <p>
11245 I think I can prove that this is not provable by Table 32.  And I agree 
11246 it needs to be true except for the "and only if".  If x1 != x2, I see no 
11247 reason why it can't be true that Y(x1) == Y(x2).  Admittedly I can't 
11248 think of a practical instance where this would happen, or be valuable.  
11249 But I also don't see a need to add that extra restriction.  I think we 
11250 only need:
11251 </p>
11252
11253 <blockquote><p>
11254      if (x1 == x2) then Y(x1) == Y(x2)
11255 </p></blockquote>
11256
11257 <p>
11258 If we decide that == on allocators is transitive, then I think I can 
11259 prove the above.  But I don't think == is necessarily transitive on 
11260 allocators.  That is:
11261 </p>
11262
11263 <p>
11264 Given x1 == x2  and x2 == x3, this does not mean x1 == x3.
11265 </p>
11266
11267 <p>Example:</p>
11268
11269 <blockquote>
11270 <p>
11271 x1 can deallocate pointers from:  x1, x2, x3    <br>
11272 x2 can deallocate pointers from:  x1, x2, x4    <br>
11273 x3 can deallocate pointers from:  x1, x3        <br>
11274 x4 can deallocate pointers from:  x2, x4 
11275 </p>
11276
11277 <p>
11278 x1 == x2, and x2 == x4, but x1 != x4
11279 </p>
11280 </blockquote>
11281 <p><i>[Toronto: LWG members offered multiple opinions.  One
11282 opinion is that it should not be required that <tt>x1 == x2</tt>
11283 implies <tt>Y(x1) == Y(x2)</tt>, and that it should not even be
11284 required that <tt>X(x1) == x1</tt>.  Another opinion is that 
11285 the second line from the bottom in table 32 already implies the
11286 desired property.  This issue should be considered in light of
11287 other issues related to allocator instances.]</i></p>
11288
11289
11290
11291 <p><b>Proposed resolution:</b></p>
11292 <p>
11293 Accept proposed wording from
11294 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2436.pdf">N2436</a> part 3.
11295 </p>
11296
11297
11298 <p><i>[Lillehammer: Same conclusion as before: this should be
11299   considered as part of an allocator redesign, not solved on its own.]</i></p>
11300
11301
11302 <p><i>[
11303 Batavia:  An allocator redesign is not forthcoming and thus we fixed this one issue.
11304 ]</i></p>
11305
11306
11307 <p><i>[
11308 Toronto:  Reopened at the request of the project editor (Pete) because the proposed
11309 wording did not fit within the indicated table.  The intent of the resolution remains
11310 unchanged.  Pablo to work with Pete on improved wording.
11311 ]</i></p>
11312
11313
11314 <p><i>[
11315 Kona (2007): The LWG adopted the proposed resolution of N2387 for this issue which
11316 was subsequently split out into a separate paper N2436 for the purposes of voting.
11317 The resolution in N2436 addresses this issue.  The LWG voted to accelerate this
11318 issue to Ready status to be voted into the WP at Kona.
11319 ]</i></p>
11320
11321
11322
11323
11324
11325 <hr>
11326 <h3><a name="259"></a>259. <tt>basic_string::operator[]</tt> and const correctness</h3>
11327 <p><b>Section:</b> 21.3.4 [string.capacity] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11328  <b>Submitter:</b> Chris Newton  <b>Date:</b> 2000-08-27</p>
11329 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.capacity">issues</a> in [string.capacity].</p>
11330 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11331 <p><b>Discussion:</b></p>
11332 <p>
11333 <i>Paraphrased from a message that Chris Newton posted to comp.std.c++:</i>
11334 </p>
11335
11336 <p>
11337 The standard's description of <tt>basic_string&lt;&gt;::operator[]</tt>
11338 seems to violate const correctness.
11339 </p>
11340
11341 <p>
11342 The standard (21.3.4/1) says that "If <tt>pos &lt; size()</tt>,
11343 returns <tt>data()[pos]</tt>." The types don't work.  The
11344 return value of <tt>data()</tt> is <tt>const charT*</tt>, but
11345 <tt>operator[]</tt> has a non-const version whose return type is <tt>reference</tt>.
11346 </p>
11347
11348
11349 <p><b>Proposed resolution:</b></p>
11350 <p>
11351 In section 21.3.4, paragraph 1, change
11352 "<tt>data()[<i>pos</i>]</tt>" to "<tt>*(begin() +
11353 <i>pos</i>)</tt>".
11354 </p>
11355
11356
11357
11358
11359 <hr>
11360 <h3><a name="260"></a>260. Inconsistent return type of <tt>istream_iterator::operator++(int)</tt></h3>
11361 <p><b>Section:</b> 24.5.1.2 [istream.iterator.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11362  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-08-27</p>
11363 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.iterator.ops">issues</a> in [istream.iterator.ops].</p>
11364 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11365 <p><b>Discussion:</b></p>
11366 <p>The synopsis of istream_iterator::operator++(int) in 24.5.1 shows
11367 it as returning the iterator by value. 24.5.1.2, p5 shows the same
11368 operator as returning the iterator by reference. That's incorrect
11369 given the Effects clause below (since a temporary is returned). The
11370 `&amp;' is probably just a typo.</p>
11371
11372
11373 <p><b>Proposed resolution:</b></p>
11374 <p>Change the declaration in 24.5.1.2, p5 from</p>
11375  <pre> istream_iterator&lt;T,charT,traits,Distance&gt;&amp; operator++(int);
11376  </pre>
11377 <p>to</p>
11378  <pre> istream_iterator&lt;T,charT,traits,Distance&gt; operator++(int);
11379  </pre>
11380 <p>(that is, remove the `&amp;').</p>
11381
11382
11383
11384
11385 <hr>
11386 <h3><a name="261"></a>261. Missing description of <tt>istream_iterator::operator!=</tt></h3>
11387 <p><b>Section:</b> 24.5.1.2 [istream.iterator.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11388  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-08-27</p>
11389 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.iterator.ops">issues</a> in [istream.iterator.ops].</p>
11390 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11391 <p><b>Discussion:</b></p>
11392 <p>
11393 24.5.1, p3 lists the synopsis for
11394 </p>
11395
11396 <pre>   template &lt;class T, class charT, class traits, class Distance&gt;
11397         bool operator!=(const istream_iterator&lt;T,charT,traits,Distance&gt;&amp; x,
11398                         const istream_iterator&lt;T,charT,traits,Distance&gt;&amp; y);
11399 </pre>
11400
11401 <p>
11402 but there is no description of what the operator does (i.e., no Effects
11403 or Returns clause) in 24.5.1.2.
11404 </p>
11405
11406
11407 <p><b>Proposed resolution:</b></p>
11408 <p>
11409 Add paragraph 7 to the end of section 24.5.1.2 with the following text:
11410 </p>
11411
11412 <pre>   template &lt;class T, class charT, class traits, class Distance&gt;
11413         bool operator!=(const istream_iterator&lt;T,charT,traits,Distance&gt;&amp; x,
11414                         const istream_iterator&lt;T,charT,traits,Distance&gt;&amp; y);
11415 </pre>
11416
11417 <p>-7- Returns: !(x == y).</p>
11418
11419
11420
11421
11422 <hr>
11423 <h3><a name="262"></a>262. Bitmask operator ~ specified incorrectly</h3>
11424 <p><b>Section:</b> 17.3.2.1.2 [bitmask.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11425  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2000-09-03</p>
11426 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11427 <p><b>Discussion:</b></p>
11428 <p>
11429 The ~ operation should be applied after the cast to int_type.
11430 </p>
11431
11432
11433 <p><b>Proposed resolution:</b></p>
11434 <p>
11435 Change 17.3.2.1.2 [lib.bitmask.types] operator~ from:
11436 </p>
11437
11438 <pre>   bitmask operator~ ( bitmask X )
11439      { return static_cast&lt; bitmask&gt;(static_cast&lt;int_type&gt;(~ X)); }
11440 </pre>
11441
11442 <p>
11443 to:
11444 </p>
11445
11446 <pre>   bitmask operator~ ( bitmask X )
11447      { return static_cast&lt; bitmask&gt;(~static_cast&lt;int_type&gt;(X)); }
11448 </pre>
11449
11450
11451
11452
11453 <hr>
11454 <h3><a name="263"></a>263. Severe restriction on <tt>basic_string</tt> reference counting</h3>
11455 <p><b>Section:</b> 21.3 [basic.string] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11456  <b>Submitter:</b> Kevlin Henney <b>Date:</b> 2000-09-04</p>
11457 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
11458 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.string">issues</a> in [basic.string].</p>
11459 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11460 <p><b>Discussion:</b></p>
11461 <p>
11462 The note in paragraph 6 suggests that the invalidation rules for
11463 references, pointers, and iterators in paragraph 5 permit a reference-
11464 counted implementation (actually, according to paragraph 6, they permit
11465 a "reference counted implementation", but this is a minor editorial fix).
11466 </p>
11467
11468 <p>
11469 However, the last sub-bullet is so worded as to make a reference-counted
11470 implementation unviable. In the following example none of the
11471 conditions for iterator invalidation are satisfied:
11472 </p>
11473
11474 <pre>    // first example: "*******************" should be printed twice
11475     string original = "some arbitrary text", copy = original;
11476     const string &amp; alias = original;
11477
11478     string::const_iterator i = alias.begin(), e = alias.end();
11479     for(string::iterator j = original.begin(); j != original.end(); ++j)
11480         *j = '*';
11481     while(i != e)
11482         cout &lt;&lt; *i++;
11483     cout &lt;&lt; endl;
11484     cout &lt;&lt; original &lt;&lt; endl;
11485 </pre>
11486
11487 <p>
11488 Similarly, in the following example:
11489 </p>
11490
11491 <pre>    // second example: "some arbitrary text" should be printed out
11492     string original = "some arbitrary text", copy = original;
11493     const string &amp; alias = original;
11494
11495     string::const_iterator i = alias.begin();
11496     original.begin();
11497     while(i != alias.end())
11498         cout &lt;&lt; *i++;
11499 </pre>
11500
11501 <p>
11502 I have tested this on three string implementations, two of which were
11503 reference counted. The reference-counted implementations gave
11504 "surprising behavior" because they invalidated iterators on
11505 the first call to non-const begin since construction. The current
11506 wording does not permit such invalidation because it does not take
11507 into account the first call since construction, only the first call
11508 since various member and non-member function calls.
11509 </p>
11510
11511
11512 <p><b>Proposed resolution:</b></p>
11513 <p>
11514 Change the following sentence in 21.3 paragraph 5 from
11515 </p>
11516
11517 <blockquote><p>
11518     Subsequent to any of the above uses except the forms of insert() and
11519     erase() which return iterators, the first call to non-const member
11520     functions operator[](), at(), begin(), rbegin(), end(), or rend().
11521 </p></blockquote>
11522
11523 <p>to</p>
11524
11525 <blockquote><p>
11526     Following construction or any of the above uses, except the forms of
11527     insert() and erase() that return iterators, the first call to non-
11528     const member functions operator[](), at(), begin(), rbegin(), end(),
11529     or rend().
11530 </p></blockquote>
11531
11532
11533
11534
11535 <hr>
11536 <h3><a name="264"></a>264. Associative container <tt>insert(i, j)</tt> complexity requirements are not feasible.</h3>
11537 <p><b>Section:</b> 23.1.4 [associative.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11538  <b>Submitter:</b> John Potter <b>Date:</b> 2000-09-07</p>
11539 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
11540 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11541 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#102">102</a></p>
11542 <p><b>Discussion:</b></p>
11543 <p>
11544 Table 69 requires linear time if [i, j) is sorted.  Sorted is necessary but not sufficient.
11545 Consider inserting a sorted range of even integers into a set&lt;int&gt; containing the odd
11546 integers in the same range.
11547 </p>
11548
11549 <p><i>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#102">102</a></i></p>
11550
11551
11552 <p><b>Proposed resolution:</b></p>
11553 <p>
11554 In Table 69, in section 23.1.2, change the complexity clause for
11555 insertion of a range from "N log(size() + N) (N is the distance
11556 from i to j) in general; linear if [i, j) is sorted according to
11557 value_comp()" to "N log(size() + N), where N is the distance
11558 from i to j".
11559 </p>
11560
11561 <p><i>[Copenhagen: Minor fix in proposed resolution: fixed unbalanced
11562 parens in the revised wording.]</i></p>
11563
11564
11565
11566
11567 <p><b>Rationale:</b></p>
11568 <p>
11569 Testing for valid insertions could be less efficient than simply
11570 inserting the elements when the range is not both sorted and between
11571 two adjacent existing elements; this could be a QOI issue.
11572 </p>
11573
11574 <p> 
11575 The LWG considered two other options: (a) specifying that the
11576 complexity was linear if [i, j) is sorted according to value_comp()
11577 and between two adjacent existing elements; or (b) changing to
11578 Klog(size() + N) + (N - K) (N is the distance from i to j and K is the
11579 number of elements which do not insert immediately after the previous
11580 element from [i, j) including the first).  The LWG felt that, since
11581 we can't guarantee linear time complexity whenever the range to be
11582 inserted is sorted, it's more trouble than it's worth to say that it's
11583 linear in some special cases.
11584 </p>
11585
11586
11587
11588
11589 <hr>
11590 <h3><a name="265"></a>265. std::pair::pair() effects overly restrictive</h3>
11591 <p><b>Section:</b> 20.2.3 [pairs] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11592  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-09-11</p>
11593 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#pairs">issues</a> in [pairs].</p>
11594 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11595 <p><b>Discussion:</b></p>
11596 <p>
11597 I don't see any requirements on the types of the elements of the
11598 std::pair container in 20.2.2. From the descriptions of the member
11599 functions it appears that they must at least satisfy the requirements of
11600 20.1.3 [lib.copyconstructible] and 20.1.4 [lib.default.con.req], and in
11601 the case of the [in]equality operators also the requirements of 20.1.1
11602 [lib.equalitycomparable] and 20.1.2 [lib.lessthancomparable].
11603 </p>
11604
11605 <p>
11606 I believe that the the CopyConstructible requirement is unnecessary in
11607 the case of 20.2.2, p2.
11608 </p>
11609
11610
11611 <p><b>Proposed resolution:</b></p>
11612 <p>Change the Effects clause in 20.2.2, p2 from</p>
11613
11614 <blockquote><p>
11615 -2- <b>Effects</b>: Initializes its members as if implemented: <tt> pair() :
11616 first(T1()), second(T2()) {} </tt>
11617 </p></blockquote>
11618
11619 <p>to</p>
11620
11621 <blockquote><p>
11622 -2- <b>Effects</b>: Initializes its members as if implemented: <tt> pair() :
11623 first(), second() {} </tt>
11624 </p></blockquote>
11625
11626
11627 <p><b>Rationale:</b></p>
11628 <p>The existing specification of pair's constructor appears to be a
11629 historical artifact: there was concern that pair's members be properly
11630 zero-initialized when they are built-in types.  At one time there was
11631 uncertainty about whether they would be zero-initialized if the
11632 default constructor was written the obvious way.  This has been
11633 clarified by core issue 178, and there is no longer any doubt that
11634 the straightforward implementation is correct.</p>
11635
11636
11637
11638
11639 <hr>
11640 <h3><a name="266"></a>266. bad_exception::~bad_exception() missing Effects clause</h3>
11641 <p><b>Section:</b> 18.7.2.1 [bad.exception] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11642  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-09-24</p>
11643 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11644 <p><b>Discussion:</b></p>
11645 <p>
11646 The synopsis for std::bad_exception lists the function ~bad_exception()
11647 but there is no description of what the function does (the Effects
11648 clause is missing).
11649 </p>
11650
11651
11652 <p><b>Proposed resolution:</b></p>
11653 <p>
11654 Remove the destructor from the class synopses of 
11655 <tt>bad_alloc</tt> (18.5.2.1 [bad.alloc]),
11656 <tt>bad_cast</tt> (18.6.2 [bad.cast]),
11657 <tt>bad_typeid</tt> (18.6.3 [bad.typeid]),
11658 and <tt>bad_exception</tt> (18.7.2.1 [bad.exception]).
11659 </p>
11660
11661
11662 <p><b>Rationale:</b></p>
11663 <p>
11664 This is a general problem with the exception classes in clause 18. 
11665 The proposed resolution is to remove the destructors from the class
11666 synopses, rather than to document the destructors' behavior, because
11667 removing them is more consistent with how exception classes are
11668 described in clause 19.
11669 </p>
11670
11671
11672
11673
11674 <hr>
11675 <h3><a name="268"></a>268. Typo in locale synopsis</h3>
11676 <p><b>Section:</b> 22.1.1 [locale] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11677  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-10-05</p>
11678 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale">issues</a> in [locale].</p>
11679 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11680 <p><b>Discussion:</b></p>
11681 <p>The synopsis of the class std::locale in 22.1.1 contains two typos:
11682 the semicolons after the declarations of the default ctor
11683 locale::locale() and the copy ctor locale::locale(const locale&amp;)
11684 are missing.</p>
11685
11686
11687 <p><b>Proposed resolution:</b></p>
11688 <p>Add the missing semicolons, i.e., change</p>
11689
11690 <pre>    //  construct/copy/destroy:
11691         locale() throw()
11692         locale(const locale&amp; other) throw()
11693 </pre>
11694
11695 <p>in the synopsis in 22.1.1 to</p>
11696
11697 <pre>    //  construct/copy/destroy:
11698         locale() throw();
11699         locale(const locale&amp; other) throw();
11700 </pre>
11701
11702
11703
11704
11705 <hr>
11706 <h3><a name="270"></a>270. Binary search requirements overly strict</h3>
11707 <p><b>Section:</b> 25.3.3 [alg.binary.search] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11708  <b>Submitter:</b> Matt Austern <b>Date:</b> 2000-10-18</p>
11709 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.binary.search">issues</a> in [alg.binary.search].</p>
11710 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11711 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#472">472</a></p>
11712 <p><b>Discussion:</b></p>
11713 <p>
11714 Each of the four binary search algorithms (lower_bound, upper_bound,
11715 equal_range, binary_search) has a form that allows the user to pass a
11716 comparison function object.  According to 25.3, paragraph 2, that
11717 comparison function object has to be a strict weak ordering.
11718 </p>
11719
11720 <p>
11721 This requirement is slightly too strict.  Suppose we are searching
11722 through a sequence containing objects of type X, where X is some
11723 large record with an integer key.  We might reasonably want to look
11724 up a record by key, in which case we would want to write something
11725 like this:
11726 </p>
11727 <pre>    struct key_comp {
11728       bool operator()(const X&amp; x, int n) const {
11729         return x.key() &lt; n;
11730       }
11731     }
11732
11733     std::lower_bound(first, last, 47, key_comp());
11734 </pre>
11735
11736 <p>
11737 key_comp is not a strict weak ordering, but there is no reason to
11738 prohibit its use in lower_bound.
11739 </p>
11740
11741 <p>
11742 There's no difficulty in implementing lower_bound so that it allows
11743 the use of something like key_comp.  (It will probably work unless an
11744 implementor takes special pains to forbid it.)  What's difficult is
11745 formulating language in the standard to specify what kind of
11746 comparison function is acceptable.  We need a notion that's slightly
11747 more general than that of a strict weak ordering, one that can encompass
11748 a comparison function that involves different types.  Expressing that
11749 notion may be complicated.
11750 </p>
11751
11752 <p><i>Additional questions raised at the Toronto meeting:</i></p>
11753 <ul>
11754 <li> Do we really want to specify what ordering the implementor must
11755      use when calling the function object?  The standard gives 
11756      specific expressions when describing these algorithms, but it also
11757      says that other expressions (with different argument order) are
11758      equivalent.</li>
11759 <li> If we are specifying ordering, note that the standard uses both
11760      orderings when describing <tt>equal_range</tt>.</li>
11761 <li> Are we talking about requiring these algorithms to work properly
11762      when passed a binary function object whose two argument types
11763      are not the same, or are we talking about requirements when
11764      they are passed a binary function object with several overloaded
11765      versions of <tt>operator()</tt>?</li>
11766 <li> The definition of a strict weak ordering does not appear to give
11767      any guidance on issues of overloading; it only discusses expressions,
11768      and all of the values in these expressions are of the same type.
11769      Some clarification would seem to be in order.</li>
11770 </ul>
11771
11772 <p><i>Additional discussion from Copenhagen:</i></p>
11773 <ul>
11774 <li>It was generally agreed that there is a real defect here: if
11775 the predicate is merely required to be a Strict Weak Ordering, then
11776 it's possible to pass in a function object with an overloaded
11777 operator(), where the version that's actually called does something
11778 completely inappropriate.  (Such as returning a random value.)</li>
11779
11780 <li>An alternative formulation was presented in a paper distributed by
11781 David Abrahams at the meeting, "Binary Search with Heterogeneous
11782 Comparison", J16-01/0027 = WG21 N1313: Instead of viewing the
11783 predicate as a Strict Weak Ordering acting on a sorted sequence, view
11784 the predicate/value pair as something that partitions a sequence.
11785 This is almost equivalent to saying that we should view binary search
11786 as if we are given a unary predicate and a sequence, such that f(*p)
11787 is true for all p below a specific point and false for all p above it.
11788 The proposed resolution is based on that alternative formulation.</li>
11789 </ul>
11790
11791
11792 <p><b>Proposed resolution:</b></p>
11793
11794 <p>Change 25.3 [lib.alg.sorting] paragraph 3 from:</p>
11795
11796 <blockquote><p>
11797   3 For all algorithms that take Compare, there is a version that uses
11798   operator&lt; instead. That is, comp(*i, *j) != false defaults to *i &lt;
11799   *j != false. For the algorithms to work correctly, comp has to
11800   induce a strict weak ordering on the values.
11801 </p></blockquote>
11802
11803 <p>to:</p>
11804
11805 <blockquote><p>
11806   3 For all algorithms that take Compare, there is a version that uses
11807   operator&lt; instead. That is, comp(*i, *j) != false defaults to *i
11808   &lt; *j != false. For algorithms other than those described in
11809   lib.alg.binary.search (25.3.3) to work correctly, comp has to induce
11810   a strict weak ordering on the values.
11811 </p></blockquote>
11812
11813 <p>Add the following paragraph after 25.3 [lib.alg.sorting] paragraph 5:</p>
11814
11815 <blockquote><p>
11816   -6- A sequence [start, finish) is partitioned with respect to an
11817   expression f(e) if there exists an integer n such that
11818   for all 0 &lt;= i &lt; distance(start, finish), f(*(begin+i)) is true if
11819   and only if i &lt; n.
11820 </p></blockquote>
11821
11822 <p>Change 25.3.3 [lib.alg.binary.search] paragraph 1 from:</p>
11823
11824 <blockquote><p>
11825   -1- All of the algorithms in this section are versions of binary
11826    search and assume that the sequence being searched is in order
11827    according to the implied or explicit comparison function. They work
11828    on non-random access iterators minimizing the number of
11829    comparisons, which will be logarithmic for all types of
11830    iterators. They are especially appropriate for random access
11831    iterators, because these algorithms do a logarithmic number of
11832    steps through the data structure. For non-random access iterators
11833    they execute a linear number of steps.
11834 </p></blockquote>
11835
11836 <p>to:</p>
11837
11838 <blockquote><p>
11839    -1- All of the algorithms in this section are versions of binary
11840     search and assume that the sequence being searched is partitioned
11841     with respect to an expression formed by binding the search key to
11842     an argument of the implied or explicit comparison function. They
11843     work on non-random access iterators minimizing the number of
11844     comparisons, which will be logarithmic for all types of
11845     iterators. They are especially appropriate for random access
11846     iterators, because these algorithms do a logarithmic number of
11847     steps through the data structure. For non-random access iterators
11848     they execute a linear number of steps.
11849 </p></blockquote>
11850
11851 <p>Change 25.3.3.1 [lib.lower.bound] paragraph 1 from:</p>
11852
11853 <blockquote><p>
11854    -1- Requires: Type T is LessThanComparable
11855     (lib.lessthancomparable). 
11856 </p></blockquote>
11857
11858 <p>to:</p>
11859
11860 <blockquote><p>
11861    -1- Requires: The elements e of [first, last) are partitioned with
11862    respect to the expression e &lt; value or comp(e, value)
11863 </p></blockquote>
11864
11865
11866 <p>Remove 25.3.3.1 [lib.lower.bound] paragraph 2:</p>
11867
11868 <blockquote><p>
11869    -2- Effects: Finds the first position into which value can be
11870     inserted without violating the ordering. 
11871 </p></blockquote>
11872
11873 <p>Change 25.3.3.2 [lib.upper.bound] paragraph 1 from:</p>
11874
11875 <blockquote><p>
11876   -1- Requires: Type T is LessThanComparable (lib.lessthancomparable).
11877 </p></blockquote>
11878
11879 <p>to:</p>
11880
11881 <blockquote><p>
11882    -1- Requires: The elements e of [first, last) are partitioned with
11883    respect to the expression !(value &lt; e) or !comp(value, e)
11884 </p></blockquote>
11885
11886 <p>Remove 25.3.3.2 [lib.upper.bound] paragraph 2:</p>
11887
11888 <blockquote><p>
11889    -2- Effects: Finds the furthermost position into which value can be
11890     inserted without violating the ordering.
11891 </p></blockquote>
11892
11893 <p>Change 25.3.3.3 [lib.equal.range] paragraph 1 from:</p>
11894
11895 <blockquote><p>
11896    -1- Requires: Type T is LessThanComparable
11897     (lib.lessthancomparable).
11898 </p></blockquote>
11899
11900 <p>to:</p>
11901
11902 <blockquote><p>
11903    -1- Requires: The elements e of [first, last) are partitioned with
11904    respect to the expressions e &lt; value and !(value &lt; e) or
11905    comp(e, value) and !comp(value, e).  Also, for all elements e of
11906    [first, last), e &lt; value implies !(value &lt; e) or comp(e,
11907    value) implies !comp(value, e)
11908 </p></blockquote>
11909
11910 <p>Change 25.3.3.3 [lib.equal.range] paragraph 2 from:</p>
11911
11912 <blockquote><p>
11913    -2- Effects: Finds the largest subrange [i, j) such that the value
11914     can be inserted at any iterator k in it without violating the
11915     ordering. k satisfies the corresponding conditions: !(*k &lt; value)
11916     &amp;&amp; !(value &lt; *k) or comp(*k, value) == false &amp;&amp; comp(value, *k) ==
11917     false.
11918 </p></blockquote>
11919
11920 <p>to:</p>
11921
11922 <pre>   -2- Returns: 
11923          make_pair(lower_bound(first, last, value),
11924                    upper_bound(first, last, value))
11925        or
11926          make_pair(lower_bound(first, last, value, comp),
11927                    upper_bound(first, last, value, comp))
11928 </pre>
11929
11930 <p>Change 25.3.3.3 [lib.binary.search] paragraph 1 from:</p>
11931
11932 <blockquote><p>
11933    -1- Requires: Type T is LessThanComparable
11934     (lib.lessthancomparable).
11935 </p></blockquote>
11936
11937 <p>to:</p>
11938
11939 <blockquote><p>
11940    -1- Requires: The elements e of [first, last) are partitioned with
11941    respect to the expressions e &lt; value and !(value &lt; e) or comp(e,
11942    value) and !comp(value, e). Also, for all elements e of [first,
11943    last), e &lt; value implies !(value &lt; e) or comp(e, value) implies
11944    !comp(value, e)
11945 </p></blockquote>
11946
11947 <p><i>[Copenhagen: Dave Abrahams provided this wording]</i></p>
11948
11949
11950 <p><i>[Redmond: Minor changes in wording.  (Removed "non-negative", and
11951 changed the "other than those described in" wording.) Also, the LWG
11952 decided to accept the "optional" part.]</i></p>
11953
11954
11955
11956
11957 <p><b>Rationale:</b></p>
11958 <p>The proposed resolution reinterprets binary search. Instead of
11959 thinking about searching for a value in a sorted range, we view that
11960 as an important special case of a more general algorithm: searching
11961 for the partition point in a partitioned range.</p>
11962
11963 <p>We also add a guarantee that the old wording did not: we ensure
11964 that the upper bound is no earlier than the lower bound, that
11965 the pair returned by equal_range is a valid range, and that the first
11966 part of that pair is the lower bound.</p>
11967
11968
11969
11970
11971
11972 <hr>
11973 <h3><a name="271"></a>271. basic_iostream missing typedefs</h3>
11974 <p><b>Section:</b> 27.6.1.5 [iostreamclass] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
11975  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-11-02</p>
11976 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
11977 <p><b>Discussion:</b></p>
11978 <p>
11979 Class template basic_iostream has no typedefs.  The typedefs it
11980 inherits from its base classes can't be used, since (for example)
11981 basic_iostream&lt;T&gt;::traits_type is ambiguous.
11982 </p>
11983
11984
11985 <p><b>Proposed resolution:</b></p>
11986
11987 <p>Add the following to basic_iostream's class synopsis in 
11988 27.6.1.5 [iostreamclass], immediately after <tt>public</tt>:</p>
11989
11990 <pre>  // types:
11991   typedef charT                     char_type;
11992   typedef typename traits::int_type int_type;
11993   typedef typename traits::pos_type pos_type;
11994   typedef typename traits::off_type off_type;
11995   typedef traits                    traits_type;
11996 </pre>
11997
11998
11999
12000
12001 <hr>
12002 <h3><a name="272"></a>272. Missing parentheses around subexpression</h3>
12003 <p><b>Section:</b> 27.4.4.3 [iostate.flags] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12004  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-11-02</p>
12005 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostate.flags">issues</a> in [iostate.flags].</p>
12006 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12007 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#569">569</a></p>
12008 <p><b>Discussion:</b></p>
12009 <p>
12010 27.4.4.3, p4 says about the postcondition of the function: If
12011 rdbuf()!=0 then state == rdstate(); otherwise
12012 rdstate()==state|ios_base::badbit.
12013 </p>
12014
12015 <p>
12016 The expression on the right-hand-side of the operator==() needs to be
12017 parenthesized in order for the whole expression to ever evaluate to
12018 anything but non-zero.
12019 </p>
12020
12021
12022 <p><b>Proposed resolution:</b></p>
12023 <p>
12024 Add parentheses like so: rdstate()==(state|ios_base::badbit).
12025 </p>
12026
12027
12028
12029
12030 <hr>
12031 <h3><a name="273"></a>273. Missing ios_base qualification on members of a dependent class</h3>
12032 <p><b>Section:</b> 27 [input.output] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12033  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-11-02</p>
12034 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#input.output">issues</a> in [input.output].</p>
12035 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12036 <p><b>Discussion:</b></p>
12037 <p>27.5.2.4.2, p4, and 27.8.1.6, p2, 27.8.1.7, p3, 27.8.1.9, p2,
12038 27.8.1.10, p3 refer to in and/or out w/o ios_base:: qualification.
12039 That's incorrect since the names are members of a dependent base
12040 class (14.6.2 [temp.dep]) and thus not visible.</p>
12041
12042
12043 <p><b>Proposed resolution:</b></p>
12044 <p>Qualify the names with the name of the class of which they are
12045 members, i.e., ios_base.</p>
12046
12047
12048
12049
12050 <hr>
12051 <h3><a name="274"></a>274. a missing/impossible allocator requirement</h3>
12052 <p><b>Section:</b> 20.1.2 [allocator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12053  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-11-02</p>
12054 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#allocator.requirements">active issues</a> in [allocator.requirements].</p>
12055 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.requirements">issues</a> in [allocator.requirements].</p>
12056 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12057 <p><b>Discussion:</b></p>
12058 <p>
12059 I see that table 31 in 20.1.5, p3 allows T in std::allocator&lt;T&gt; to be of
12060 any type. But the synopsis in 20.4.1 calls for allocator&lt;&gt;::address() to
12061 be overloaded on reference and const_reference, which is ill-formed for
12062 all T = const U. In other words, this won't work:
12063 </p>
12064
12065 <p>
12066 template class std::allocator&lt;const int&gt;;
12067 </p>
12068
12069 <p>
12070 The obvious solution is to disallow specializations of allocators on
12071 const types. However, while containers' elements are required to be
12072 assignable (which rules out specializations on const T's), I think that
12073 allocators might perhaps be potentially useful for const values in other
12074 contexts. So if allocators are to allow const types a partial
12075 specialization of std::allocator&lt;const T&gt; would probably have to be
12076 provided.
12077 </p>
12078
12079
12080 <p><b>Proposed resolution:</b></p>
12081 <p>Change the text in row 1, column 2 of table 32 in 20.1.5, p3 from</p>
12082
12083     <blockquote><p>
12084     any type
12085     </p></blockquote>
12086
12087 <p>to</p>
12088     <blockquote><p>
12089     any non-const, non-reference type
12090     </p></blockquote>
12091
12092 <p><i>[Redmond: previous proposed resolution was "any non-const,
12093 non-volatile, non-reference type".  Got rid of the "non-volatile".]</i></p>
12094
12095
12096
12097
12098 <p><b>Rationale:</b></p>
12099 <p>
12100 Two resolutions were originally proposed: one that partially
12101 specialized std::allocator for const types, and one that said an
12102 allocator's value type may not be const.  The LWG chose the second.
12103 The first wouldn't be appropriate, because allocators are intended for
12104 use by containers, and const value types don't work in containers.
12105 Encouraging the use of allocators with const value types would only
12106 lead to unsafe code.
12107 </p>
12108 <p>
12109 The original text for proposed resolution 2 was modified so that it
12110 also forbids volatile types and reference types.
12111 </p>
12112
12113 <p><i>[Curaçao: LWG double checked and believes volatile is correctly
12114 excluded from the PR.]</i></p>
12115
12116
12117
12118
12119
12120
12121
12122 <hr>
12123 <h3><a name="275"></a>275. Wrong type in num_get::get() overloads</h3>
12124 <p><b>Section:</b> 22.2.2.1.1 [facet.num.get.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12125  <b>Submitter:</b> Matt Austern <b>Date:</b> 2000-11-02</p>
12126 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.members">issues</a> in [facet.num.get.members].</p>
12127 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12128 <p><b>Discussion:</b></p>
12129 <p>
12130 In 22.2.2.1.1, we have a list of overloads for num_get&lt;&gt;::get().
12131 There are eight overloads, all of which are identical except for the
12132 last parameter.  The overloads are: 
12133 </p>
12134 <ul>
12135 <li> long&amp; </li>
12136 <li> unsigned short&amp; </li>
12137 <li> unsigned int&amp; </li>
12138 <li> unsigned long&amp; </li>
12139 <li> short&amp; </li>
12140 <li> double&amp; </li>
12141 <li> long double&amp; </li>
12142 <li> void*&amp; </li>
12143 </ul>
12144
12145 <p>
12146 There is a similar list, in 22.2.2.1.2, of overloads for
12147 num_get&lt;&gt;::do_get().  In this list, the last parameter has
12148 the types: 
12149 </p>
12150 <ul>
12151 <li> long&amp; </li>
12152 <li> unsigned short&amp; </li>
12153 <li> unsigned int&amp; </li>
12154 <li> unsigned long&amp; </li>
12155 <li> float&amp; </li>
12156 <li> double&amp; </li>
12157 <li> long double&amp; </li>
12158 <li> void*&amp; </li>
12159 </ul>
12160
12161 <p>
12162 These two lists are not identical.  They should be, since
12163 <tt>get</tt> is supposed to call <tt>do_get</tt> with exactly
12164 the arguments it was given.
12165 </p>
12166
12167
12168 <p><b>Proposed resolution:</b></p>
12169 <p>In 22.2.2.1.1 [facet.num.get.members], change</p>
12170 <pre>  iter_type get(iter_type in, iter_type end, ios_base&amp; str,
12171                 ios_base::iostate&amp; err, short&amp; val) const;
12172 </pre>
12173 <p>to</p>
12174 <pre>  iter_type get(iter_type in, iter_type end, ios_base&amp; str,
12175                 ios_base::iostate&amp; err, float&amp; val) const;
12176 </pre>
12177
12178
12179
12180
12181 <hr>
12182 <h3><a name="276"></a>276. Assignable requirement for container value type overly strict</h3>
12183 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12184  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2000-11-07</p>
12185 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
12186 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
12187 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12188 <p><b>Discussion:</b></p>
12189 <p>
12190 23.1/3 states that the objects stored in a container must be
12191 Assignable.  23.3.1 [map], paragraph 2,
12192 states that map satisfies all requirements for a container, while in
12193 the same time defining value_type as pair&lt;const Key, T&gt; - a type
12194 that is not Assignable.
12195 </p>
12196
12197 <p>
12198 It should be noted that there exists a valid and non-contradictory
12199 interpretation of the current text. The wording in 23.1/3 avoids 
12200 mentioning value_type, referring instead to "objects stored in a
12201 container." One might argue that map does not store objects of
12202 type map::value_type, but of map::mapped_type instead, and that the
12203 Assignable requirement applies to map::mapped_type, not
12204 map::value_type.
12205 </p>
12206
12207 <p>
12208 However, this makes map a special case (other containers store objects of
12209 type value_type) and the Assignable requirement is needlessly restrictive in
12210 general.
12211 </p>
12212
12213 <p>
12214 For example, the proposed resolution of active library issue 
12215 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#103">103</a> is to make set::iterator a constant iterator; this
12216 means that no set operations can exploit the fact that the stored
12217 objects are Assignable.
12218 </p>
12219
12220 <p>
12221 This is related to, but slightly broader than, closed issue
12222 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#140">140</a>.
12223 </p>
12224
12225
12226 <p><b>Proposed resolution:</b></p>
12227 <p>23.1/3: Strike the trailing part of the sentence:</p>
12228     <blockquote><p>
12229     , and the additional requirements of Assignable types from 23.1/3
12230     </p></blockquote>
12231 <p>so that it reads:</p>
12232     <blockquote><p>
12233     -3- The type of objects stored in these components must meet the 
12234     requirements of CopyConstructible types (lib.copyconstructible).
12235     </p></blockquote>
12236
12237 <p>23.1/4: Modify to make clear that this requirement is not for all 
12238 containers.  Change to:</p>
12239
12240 <blockquote><p>
12241 -4- Table 64 defines the Assignable requirement.  Some containers 
12242 require this property of the types to be stored in the container.  T is 
12243 the type used to instantiate the container. t is a value of T, and u is 
12244 a value of (possibly const) T.
12245 </p></blockquote>
12246
12247 <p>23.1, Table 65: in the first row, change "T is Assignable" to "T is
12248 CopyConstructible".</p>
12249
12250 <p>23.2.1/2: Add sentence for Assignable requirement.  Change to:</p>
12251
12252 <blockquote><p>
12253 -2- A deque satisfies all of the requirements of a container and of a 
12254 reversible container (given in tables in lib.container.requirements) and 
12255 of a sequence, including the optional sequence requirements 
12256 (lib.sequence.reqmts).  In addition to the requirements on the stored 
12257 object described in 23.1[lib.container.requirements], the stored object 
12258 must also meet the requirements of Assignable.  Descriptions are 
12259 provided here only for operations on deque that are not described in one 
12260 of these tables or for operations where there is additional semantic 
12261 information.
12262 </p></blockquote>
12263
12264 <p>23.2.2/2:  Add Assignable requirement to specific methods of list.  
12265 Change to:</p>
12266
12267 <blockquote>
12268 <p>-2- A list satisfies all of the requirements of a container and of a 
12269 reversible container (given in two tables in lib.container.requirements) 
12270 and of a sequence, including most of the the optional sequence 
12271 requirements (lib.sequence.reqmts). The exceptions are the operator[] 
12272 and at member functions, which are not provided. 
12273
12274 [Footnote: These member functions are only provided by containers whose 
12275 iterators are random access iterators. --- end foonote]
12276 </p>
12277
12278 <p>list does not require the stored type T to be Assignable unless the 
12279 following methods are instantiated:
12280
12281 [Footnote: Implementors are permitted but not required to take advantage 
12282 of T's Assignable properties for these methods. -- end foonote]
12283 </p>
12284 <pre>     list&lt;T,Allocator&gt;&amp; operator=(const list&lt;T,Allocator&gt;&amp;  x );
12285      template &lt;class InputIterator&gt;
12286        void assign(InputIterator first, InputIterator last);
12287      void assign(size_type n, const T&amp; t);
12288 </pre>
12289
12290
12291 <p>Descriptions are provided here only for operations on list that are not 
12292 described in one of these tables or for operations where there is 
12293 additional semantic information.</p>
12294 </blockquote>
12295
12296 <p>23.2.4/2:   Add sentence for Assignable requirement.  Change to:</p>
12297
12298 <blockquote><p>
12299 -2- A vector satisfies all of the requirements of a container and of a 
12300 reversible container (given in two tables in lib.container.requirements) 
12301 and of a sequence, including most of the optional sequence requirements 
12302 (lib.sequence.reqmts). The exceptions are the push_front and pop_front 
12303 member functions, which are not provided.  In addition to the 
12304 requirements on the stored object described in 
12305 23.1[lib.container.requirements], the stored object must also meet the 
12306 requirements of Assignable.  Descriptions are provided here only for 
12307 operations on vector that are not described in one of these tables or 
12308 for operations where there is additional semantic information.
12309 </p></blockquote>
12310
12311
12312 <p><b>Rationale:</b></p>
12313 <p>list, set, multiset, map, multimap are able to store non-Assignables.
12314 However, there is some concern about <tt>list&lt;T&gt;</tt>:
12315 although in general there's no reason for T to be Assignable, some
12316 implementations of the member functions <tt>operator=</tt> and
12317 <tt>assign</tt> do rely on that requirement.  The LWG does not want
12318 to forbid such implementations.</p>
12319
12320 <p>Note that the type stored in a standard container must still satisfy
12321 the requirements of the container's allocator; this rules out, for
12322 example, such types as "const int".  See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#274">274</a>
12323 for more details.
12324 </p>
12325
12326 <p>In principle we could also relax the "Assignable" requirement for
12327 individual <tt>vector</tt> member functions, such as
12328 <tt>push_back</tt>.  However, the LWG did not see great value in such
12329 selective relaxation.  Doing so would remove implementors' freedom to
12330 implement <tt>vector::push_back</tt> in terms of
12331 <tt>vector::insert</tt>.</p>
12332
12333
12334
12335
12336
12337 <hr>
12338 <h3><a name="278"></a>278. What does iterator validity mean?</h3>
12339 <p><b>Section:</b> 23.2.4.4 [list.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12340  <b>Submitter:</b> P.J. Plauger <b>Date:</b> 2000-11-27</p>
12341 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#list.ops">issues</a> in [list.ops].</p>
12342 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12343 <p><b>Discussion:</b></p>
12344 <p>
12345 Section 23.2.4.4 [list.ops] states that
12346 </p>
12347 <pre>  void splice(iterator position, list&lt;T, Allocator&gt;&amp; x);
12348 </pre>
12349 <p>
12350 <i>invalidates</i> all iterators and references to list <tt>x</tt>.
12351 </p>
12352
12353 <p>
12354 But what does the C++ Standard mean by "invalidate"?  You
12355 can still dereference the iterator to a spliced list element, but
12356 you'd better not use it to delimit a range within the original
12357 list. For the latter operation, it has definitely lost some of its
12358 validity.
12359 </p>
12360
12361 <p>
12362 If we accept the proposed resolution to issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#250">250</a>,
12363 then we'd better clarify that a "valid" iterator need no
12364 longer designate an element within the same container as it once did.
12365 We then have to clarify what we mean by invalidating a past-the-end
12366 iterator, as when a vector or string grows by reallocation. Clearly,
12367 such an iterator has a different kind of validity. Perhaps we should
12368 introduce separate terms for the two kinds of "validity."
12369 </p>
12370
12371
12372 <p><b>Proposed resolution:</b></p>
12373 <p>Add the following text to the end of section 24.1 [iterator.requirements],
12374 after paragraph 5:</p>
12375 <blockquote><p>
12376 An <i>invalid</i> iterator is an iterator that may be
12377 singular. [Footnote: This definition applies to pointers, since
12378 pointers are iterators. The effect of dereferencing an iterator that
12379 has been invalidated is undefined.]
12380 </p></blockquote>
12381
12382 <p><i>[post-Copenhagen: Matt provided wording.]</i></p>
12383
12384
12385 <p><i>[Redmond: General agreement with the intent, some objections to
12386 the wording.  Dave provided new wording.]</i></p>
12387
12388
12389
12390 <p><b>Rationale:</b></p>
12391 <p>This resolution simply defines a term that the Standard uses but
12392   never defines, "invalid", in terms of a term that is defined,
12393   "singular".</p>
12394
12395 <p>Why do we say "may be singular", instead of "is singular"?  That's
12396   becuase a valid iterator is one that is known to be nonsingular.
12397   Invalidating an iterator means changing it in such a way that it's
12398   no longer known to be nonsingular.  An example: inserting an
12399   element into the middle of a vector is correctly said to invalidate
12400   all iterators pointing into the vector.  That doesn't necessarily
12401   mean they all become singular.</p>
12402
12403
12404
12405
12406
12407 <hr>
12408 <h3><a name="280"></a>280. Comparison of reverse_iterator to const reverse_iterator</h3>
12409 <p><b>Section:</b> 24.4.1 [reverse.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12410  <b>Submitter:</b> Steve Cleary <b>Date:</b> 2000-11-27</p>
12411 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12412 <p><b>Discussion:</b></p>
12413 <p>
12414 This came from an email from Steve Cleary to Fergus in reference to
12415 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#179">179</a>. The library working group briefly discussed
12416 this in Toronto and believed it should be a separate issue.  There was
12417 also some reservations about whether this was a worthwhile problem to
12418 fix.
12419 </p>
12420
12421 <p>
12422 Steve said: "Fixing reverse_iterator. std::reverse_iterator can
12423 (and should) be changed to preserve these additional
12424 requirements." He also said in email that it can be done without
12425 breaking user's code: "If you take a look at my suggested
12426 solution, reverse_iterator doesn't have to take two parameters; there
12427 is no danger of breaking existing code, except someone taking the
12428 address of one of the reverse_iterator global operator functions, and
12429 I have to doubt if anyone has ever done that. . .  <i>But</i>, just in
12430 case they have, you can leave the old global functions in as well --
12431 they won't interfere with the two-template-argument functions.  With
12432 that, I don't see how <i>any</i> user code could break."
12433 </p>
12434
12435
12436 <p><b>Proposed resolution:</b></p>
12437 <p>
12438 <b>Section:</b> 24.4.1.1 [reverse.iterator]
12439 add/change the following declarations:</p>
12440 <pre>  A) Add a templated assignment operator, after the same manner
12441         as the templated copy constructor, i.e.:
12442
12443   template &lt; class U &gt;
12444   reverse_iterator &lt; Iterator &gt;&amp; operator=(const reverse_iterator&lt; U &gt;&amp; u);
12445
12446   B) Make all global functions (except the operator+) have
12447   two template parameters instead of one, that is, for
12448   operator ==, !=, &lt;, &gt;, &lt;=, &gt;=, - replace:
12449
12450        template &lt; class Iterator &gt;
12451        typename reverse_iterator&lt; Iterator &gt;::difference_type operator-(
12452                  const reverse_iterator&lt; Iterator &gt;&amp; x,
12453                  const reverse_iterator&lt; Iterator &gt;&amp; y);
12454
12455   with:
12456
12457       template &lt; class Iterator1, class Iterator2 &gt;
12458       typename reverse_iterator &lt; Iterator1 &gt;::difference_type operator-(
12459                  const reverse_iterator &lt; Iterator1 &gt; &amp; x,
12460                  const reverse_iterator &lt; Iterator2 &gt; &amp; y);
12461 </pre>
12462 <p>
12463 Also make the addition/changes for these signatures in 
12464 24.4.1.3 [reverse.iter.ops].
12465 </p>
12466
12467 <p><i>[
12468 Copenhagen: The LWG is concerned that the proposed resolution 
12469 introduces new overloads.  Experience shows that introducing
12470 overloads is always risky, and that it would be inappropriate to
12471 make this change without implementation experience.  It may be
12472 desirable to provide this feature in a different way.
12473 ]</i></p>
12474
12475
12476 <p><i>[
12477 Lillehammer: We now have implementation experience, and agree that
12478 this solution is safe and correct.
12479 ]</i></p>
12480
12481
12482
12483
12484
12485
12486
12487 <hr>
12488 <h3><a name="281"></a>281. std::min() and max() requirements overly restrictive</h3>
12489 <p><b>Section:</b> 25.3.7 [alg.min.max] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12490  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-12-02</p>
12491 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.min.max">issues</a> in [alg.min.max].</p>
12492 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12493 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#486">486</a></p>
12494 <p><b>Discussion:</b></p>
12495 <p>The requirements in 25.3.7, p1 and 4 call for T to satisfy the
12496 requirements of <tt>LessThanComparable</tt> ( [lessthancomparable])
12497 and <tt>CopyConstructible</tt> (20.1.1 [utility.arg.requirements]).
12498 Since the functions take and return their arguments and result by
12499 const reference, I believe the <tt>CopyConstructible</tt> requirement
12500 is unnecessary.
12501 </p>
12502
12503
12504 <p><b>Proposed resolution:</b></p>
12505 <p>Remove the <tt>CopyConstructible</tt> requirement. Specifically, replace
12506 25.3.7, p1 with</p>
12507 <p><b>-1- Requires:</b> Type T is <tt>LessThanComparable</tt> 
12508 ( [lessthancomparable]).
12509 </p>
12510 <p>and replace 25.3.7, p4 with</p>
12511 <p><b>-4- Requires:</b> Type T is <tt>LessThanComparable</tt> 
12512 ( [lessthancomparable]).
12513 </p>
12514
12515
12516
12517
12518 <hr>
12519 <h3><a name="282"></a>282. What types does numpunct grouping refer to?</h3>
12520 <p><b>Section:</b> 22.2.2.2.2 [facet.num.put.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12521  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2000-12-05</p>
12522 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.put.virtuals">issues</a> in [facet.num.put.virtuals].</p>
12523 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12524 <p><b>Discussion:</b></p>
12525 <p>
12526 Paragraph 16 mistakenly singles out integral types for inserting 
12527 thousands_sep() characters.  This conflicts with the syntax for floating 
12528 point numbers described under 22.2.3.1/2.
12529 </p>
12530
12531
12532 <p><b>Proposed resolution:</b></p>
12533 <p>Change paragraph 16 from:</p>
12534
12535 <blockquote><p>
12536 For integral types, punct.thousands_sep() characters are inserted into 
12537 the sequence as determined by the value returned by punct.do_grouping() 
12538 using the method described in 22.2.3.1.2 [facet.numpunct.virtuals].
12539 </p></blockquote>
12540
12541 <p>To:</p>
12542
12543 <blockquote><p>
12544 For arithmetic types, punct.thousands_sep() characters are inserted into 
12545 the sequence as determined by the value returned by punct.do_grouping() 
12546 using the method described in 22.2.3.1.2 [facet.numpunct.virtuals].
12547 </p></blockquote>
12548
12549 <p><i>[
12550 Copenhagen: Opinions were divided about whether this is actually an
12551 inconsistency, but at best it seems to have been unintentional.  This
12552 is only an issue for floating-point output: The standard is
12553 unambiguous that implementations must parse thousands_sep characters
12554 when performing floating-point.  The standard is also unambiguous that
12555 this requirement does not apply to the "C" locale.
12556 ]</i></p>
12557
12558
12559 <p><i>[
12560 A survey of existing practice is needed; it is believed that some
12561 implementations do insert thousands_sep characters for floating-point
12562 output and others fail to insert thousands_sep characters for 
12563 floating-point input even though this is unambiguously required by the
12564 standard.
12565 ]</i></p>
12566
12567
12568 <p><i>[Post-Curaçao: the above proposed resolution is the consensus of
12569 Howard, Bill, Pete, Benjamin, Nathan, Dietmar, Boris, and Martin.]</i></p>
12570
12571
12572
12573
12574
12575
12576 <hr>
12577 <h3><a name="283"></a>283. std::replace() requirement incorrect/insufficient</h3>
12578 <p><b>Section:</b> 25.2.5 [alg.replace] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12579  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-12-15</p>
12580 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.replace">issues</a> in [alg.replace].</p>
12581 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12582 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#483">483</a></p>
12583 <p><b>Discussion:</b></p>
12584 <p>
12585 (revision of the further discussion)
12586 There are a number of problems with the requires clauses for the
12587 algorithms in 25.1 and 25.2. The requires clause of each algorithm
12588 should describe the necessary and sufficient requirements on the inputs
12589 to the algorithm such that the algorithm compiles and runs properly.
12590 Many of the requires clauses fail to do this. Here is a summary of the kinds
12591 of mistakes:
12592 </p>
12593
12594 <ol>
12595 <li>
12596 Use of EqualityComparable, which only puts requirements on a single
12597 type, when in fact an equality operator is required between two
12598 different types, typically either T and the iterator's value type
12599 or between the value types of two different iterators.
12600 </li>
12601 <li>
12602 Use of Assignable for T when in fact what was needed is Assignable
12603 for the value_type of the iterator, and convertability from T to the
12604 value_type of the iterator. Or for output iterators, the requirement
12605 should be that T is writable to the iterator (output iterators do
12606 not have value types).
12607 </li>
12608 </ol>
12609
12610 <p>
12611 Here is the list of algorithms that contain mistakes:
12612 </p>
12613
12614 <ul>
12615 <li>25.1.2 std::find</li>
12616 <li>25.1.6 std::count</li>
12617 <li>25.1.8 std::equal</li>
12618 <li>25.1.9 std::search, std::search_n</li>
12619 <li>25.2.4 std::replace, std::replace_copy</li>
12620 <li>25.2.5 std::fill</li>
12621 <li>25.2.7 std::remove, std::remove_copy</li>
12622 </ul>
12623
12624 <p>
12625 Also, in the requirements for EqualityComparable, the requirement that
12626 the operator be defined for const objects is lacking.
12627 </p>
12628
12629
12630
12631 <p><b>Proposed resolution:</b></p>
12632
12633 <p>20.1.1 Change p1 from</p>
12634
12635 <p>In Table 28, <tt>T</tt> is a type to be supplied by a C++ program
12636 instantiating a template, <tt>a</tt>, <tt>b</tt>, and <tt>c</tt> are
12637 values of type <tt>T</tt>.
12638 </p>
12639
12640 <p>to</p>
12641
12642 <p>
12643 In Table 28, <tt>T</tt> is a type to be supplied by a C++ program
12644 instantiating a template, <tt>a</tt>, <tt>b</tt>, and <tt>c</tt> are
12645 values of type <tt>const T</tt>.
12646 </p>
12647
12648 <p>25 Between p8 and p9</p>
12649
12650 <p>Add the following sentence:</p>
12651
12652 <p>When the description of an algorithm gives an expression such as
12653 <tt>*first == value</tt> for a condition, it is required that the expression
12654 evaluate to either true or false in boolean contexts.</p>
12655
12656 <p>25.1.2 Change p1 by deleting the requires clause.</p>
12657
12658 <p>25.1.6 Change p1 by deleting the requires clause.</p>
12659
12660 <p>25.1.9</p>
12661
12662 <p>Change p4 from</p>
12663
12664 <p>-4- Requires: Type <tt>T</tt> is <tt>EqualityComparable</tt>
12665 (20.1.1), type Size is convertible to integral type (4.7.12.3).
12666 </p>
12667
12668 <p>to</p>
12669
12670 <p>-4- Requires: The type <tt>Size</tt> is convertible to integral
12671 type (4.7.12.3).</p>
12672
12673 <p>25.2.4 Change p1 from</p>
12674
12675 <p>-1- Requires: Type <tt>T</tt> is <tt>Assignable</tt> (23.1 ) (and, for <tt>replace()</tt>, <tt>EqualityComparable</tt> (20.1.1 )).</p>
12676
12677 <p>to</p>
12678
12679 <p>-1- Requires: The expression <tt>*first = new_value</tt> must be valid.</p>
12680
12681 <p>and change p4 from</p>
12682
12683 <p>-4- Requires: Type <tt>T</tt> is <tt>Assignable</tt> (23.1) (and,
12684 for <tt>replace_copy()</tt>, <tt>EqualityComparable</tt>
12685 (20.1.1)). The ranges <tt>[first, last)</tt> and <tt>[result, result +
12686 (last - first))</tt> shall not overlap.</p>
12687
12688 <p>to</p>
12689
12690 <p>-4- Requires: The results of the expressions <tt>*first</tt> and
12691 <tt>new_value</tt> must be writable to the result output iterator. The
12692 ranges <tt>[first, last)</tt> and <tt>[result, result + (last -
12693 first))</tt> shall not overlap.</p>
12694
12695
12696 <p>25.2.5 Change p1 from</p>
12697
12698 <p>-1- Requires: Type <tt>T</tt> is <tt>Assignable</tt> (23.1). The
12699 type <tt>Size</tt> is convertible to an integral type (4.7.12.3).</p>
12700
12701 <p>to</p>
12702
12703 <p>-1- Requires: The expression <tt>value</tt> must be is writable to
12704 the output iterator. The type <tt>Size</tt> is convertible to an
12705 integral type (4.7.12.3).</p>
12706
12707 <p>25.2.7 Change p1 from</p>
12708
12709 <p>-1- Requires: Type <tt>T</tt> is <tt>EqualityComparable</tt> (20.1.1).</p>
12710
12711 <p>to</p>
12712
12713 <p>
12714 -1- Requires: The value type of the iterator must be
12715 <tt>Assignable</tt> (23.1).
12716 </p>
12717
12718
12719
12720 <p><b>Rationale:</b></p>
12721 <p>
12722 The general idea of the proposed solution is to remove the faulty
12723 requires clauses and let the returns and effects clauses speak for
12724 themselves. That is, the returns clauses contain expressions that must
12725 be valid, and therefore already imply the correct requirements. In
12726 addition, a sentence is added at the beginning of chapter 25 saying
12727 that expressions given as conditions must evaluate to true or false in
12728 a boolean context. An alternative would be to say that the type of
12729 these condition expressions must be literally bool, but that would be
12730 imposing a greater restriction that what the standard currently says
12731 (which is convertible to bool).
12732 </p>
12733
12734
12735
12736
12737
12738 <hr>
12739 <h3><a name="284"></a>284. unportable example in 20.3.7, p6</h3>
12740 <p><b>Section:</b> 20.6.7 [comparisons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12741  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-12-26</p>
12742 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12743 <p><b>Discussion:</b></p>
12744 <p>The example in 20.6.7 [comparisons], p6 shows how to use the C
12745 library function <tt>strcmp()</tt> with the function pointer adapter
12746 <tt>ptr_fun()</tt>. But since it's unspecified whether the C library
12747 functions have <tt>extern "C"</tt> or <tt>extern
12748 "C++"</tt> linkage [17.4.2.2 [using.linkage]], and since
12749 function pointers with different the language linkage specifications
12750 (7.5 [dcl.link]) are incompatible, whether this example is
12751 well-formed is unspecified.
12752 </p>
12753
12754
12755 <p><b>Proposed resolution:</b></p>
12756 <p>Change 20.6.7 [comparisons] paragraph 6 from:</p>
12757 <blockquote>
12758   <p>[<i>Example:</i></p>
12759   <pre>    replace_if(v.begin(), v.end(), not1(bind2nd(ptr_fun(strcmp), "C")), "C++");
12760   </pre>
12761   <p>replaces each <tt>C</tt> with <tt>C++</tt> in sequence <tt>v</tt>.</p>
12762 </blockquote>
12763
12764
12765 <p>to:</p>
12766 <blockquote>
12767   <p>[<i>Example:</i></p>
12768   <pre>    int compare(const char*, const char*);
12769     replace_if(v.begin(), v.end(),
12770                not1(bind2nd(ptr_fun(compare), "abc")), "def");
12771   </pre>
12772   <p>replaces each <tt>abc</tt> with <tt>def</tt> in sequence <tt>v</tt>.</p>
12773 </blockquote>
12774
12775 <p>Also, remove footnote 215 in that same paragraph.</p>
12776
12777 <p><i>[Copenhagen: Minor change in the proposed resolution.  Since this
12778 issue deals in part with C and C++ linkage, it was believed to be too
12779 confusing for the strings in the example to be "C" and "C++".
12780 ]</i></p>
12781
12782
12783 <p><i>[Redmond: More minor changes.  Got rid of the footnote (which
12784 seems to make a sweeping normative requirement, even though footnotes
12785 aren't normative), and changed the sentence after the footnote so that
12786 it corresponds to the new code fragment.]</i></p>
12787
12788
12789
12790
12791
12792
12793 <hr>
12794 <h3><a name="285"></a>285. minor editorial errors in fstream ctors</h3>
12795 <p><b>Section:</b> 27.8.1.7 [ifstream.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12796  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2000-12-31</p>
12797 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12798 <p><b>Discussion:</b></p>
12799 <p>27.8.1.7 [ifstream.cons], p2, 27.8.1.11 [ofstream.cons], p2, and
12800 27.8.1.15 [fstream.cons], p2 say about the effects of each constructor:
12801 </p>
12802
12803 <p>... If that function returns a null pointer, calls
12804 <tt>setstate(failbit)</tt> (which may throw <tt>ios_base::failure</tt>).
12805 </p>
12806
12807 <p>The parenthetical note doesn't apply since the ctors cannot throw an
12808 exception due to the requirement in 27.4.4.1 [basic.ios.cons], p3 
12809 that <tt>exceptions()</tt> be initialized to <tt>ios_base::goodbit</tt>.
12810 </p>
12811
12812
12813 <p><b>Proposed resolution:</b></p>
12814 <p>
12815 Strike the parenthetical note from the Effects clause in each of the
12816 paragraphs mentioned above.
12817 </p>
12818
12819
12820
12821
12822 <hr>
12823 <h3><a name="286"></a>286. &lt;cstdlib&gt; requirements missing size_t typedef</h3>
12824 <p><b>Section:</b> 25.4 [alg.c.library] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12825  <b>Submitter:</b> Judy Ward <b>Date:</b> 2000-12-30</p>
12826 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.c.library">issues</a> in [alg.c.library].</p>
12827 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12828 <p><b>Discussion:</b></p>
12829 <p>
12830 The &lt;cstdlib&gt; header file contains prototypes for bsearch and
12831 qsort (C++ Standard section 25.4 paragraphs 3 and 4) and other
12832 prototypes (C++ Standard section 21.4 paragraph 1 table 49) that
12833 require the typedef size_t. Yet size_t is not listed in the
12834 &lt;cstdlib&gt; synopsis table 78 in section 25.4.
12835 </p>
12836
12837
12838 <p><b>Proposed resolution:</b></p>
12839 <p>
12840 Add the type size_t to Table 78 (section 25.4) and add
12841 the type size_t &lt;cstdlib&gt; to Table 97 (section C.2).
12842 </p>
12843
12844
12845 <p><b>Rationale:</b></p>
12846 <p>Since size_t is in &lt;stdlib.h&gt;, it must also be in &lt;cstdlib&gt;.</p>
12847
12848
12849
12850
12851
12852 <hr>
12853 <h3><a name="288"></a>288. &lt;cerrno&gt; requirements missing macro EILSEQ</h3>
12854 <p><b>Section:</b> 19.3 [errno] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12855  <b>Submitter:</b> Judy Ward <b>Date:</b> 2000-12-30</p>
12856 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12857 <p><b>Discussion:</b></p>
12858 <p>
12859 ISO/IEC 9899:1990/Amendment1:1994 Section 4.3 States: "The list
12860 of macros defined in &lt;errno.h&gt; is adjusted to include a new
12861 macro, EILSEQ"
12862 </p>
12863
12864 <p>
12865 ISO/IEC 14882:1998(E) section 19.3 does not refer
12866 to the above amendment.
12867 </p>
12868
12869
12870
12871 <p><b>Proposed resolution:</b></p>
12872 <p>
12873 Update Table 26 (section 19.3) "Header  &lt;cerrno&gt; synopsis"
12874 and Table 95 (section C.2) "Standard Macros" to include EILSEQ.
12875 </p>
12876
12877
12878
12879
12880
12881 <hr>
12882 <h3><a name="291"></a>291. Underspecification of set algorithms</h3>
12883 <p><b>Section:</b> 25.3.5 [alg.set.operations] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
12884  <b>Submitter:</b> Matt Austern <b>Date:</b> 2001-01-03</p>
12885 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.set.operations">issues</a> in [alg.set.operations].</p>
12886 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
12887 <p><b>Discussion:</b></p>
12888 <p>
12889 The standard library contains four algorithms that compute set
12890 operations on sorted ranges: <tt>set_union</tt>, <tt>set_intersection</tt>,
12891 <tt>set_difference</tt>, and <tt>set_symmetric_difference</tt>.  Each
12892 of these algorithms takes two sorted ranges as inputs, and writes the
12893 output of the appropriate set operation to an output range.  The elements
12894 in the output range are sorted.
12895 </p>
12896
12897 <p>
12898 The ordinary mathematical definitions are generalized so that they
12899 apply to ranges containing multiple copies of a given element.  Two
12900 elements are considered to be "the same" if, according to an
12901 ordering relation provided by the user, neither one is less than the
12902 other.  So, for example, if one input range contains five copies of an
12903 element and another contains three, the output range of <tt>set_union</tt>
12904 will contain five copies, the output range of
12905 <tt>set_intersection</tt> will contain three, the output range of
12906 <tt>set_difference</tt> will contain two, and the output range of
12907 <tt>set_symmetric_difference</tt> will contain two.
12908 </p>
12909
12910 <p>
12911 Because two elements can be "the same" for the purposes
12912 of these set algorithms, without being identical in other respects
12913 (consider, for example, strings under case-insensitive comparison),
12914 this raises a number of unanswered questions:
12915 </p>
12916
12917 <ul>
12918 <li>If we're copying an element that's present in both of the
12919 input ranges, which one do we copy it from?</li>
12920 <li>If there are <i>n</i> copies of an element in the relevant
12921 input range, and the output range will contain fewer copies (say
12922 <i>m</i>) which ones do we choose?  The first <i>m</i>, or the last
12923 <i>m</i>, or something else?</li>
12924 <li>Are these operations stable?  That is, does a run of equivalent
12925 elements appear in the output range in the same order as as it
12926 appeared in the input range(s)?</li>
12927 </ul>
12928
12929 <p>
12930 The standard should either answer these questions, or explicitly
12931 say that the answers are unspecified.  I prefer the former option,
12932 since, as far as I know, all existing implementations behave the
12933 same way.
12934 </p>
12935
12936
12937
12938 <p><b>Proposed resolution:</b></p>
12939
12940 <p>Add the following to the end of 25.3.5.2 [set.union] paragraph 5:</p>
12941 <blockquote><p>
12942 If [first1, last1) contains <i>m</i> elements that are equivalent to
12943 each other and [first2, last2) contains <i>n</i> elements that are
12944 equivalent to them, then max(<i>m</i>, <i>n</i>) of these elements
12945 will be copied to the output range: all <i>m</i> of these elements
12946 from [first1, last1), and the last max(<i>n-m</i>, 0) of them from
12947 [first2, last2), in that order.
12948 </p></blockquote>
12949
12950 <p>Add the following to the end of 25.3.5.3 [set.intersection] paragraph 5:</p>
12951 <blockquote><p>
12952 If [first1, last1) contains <i>m</i> elements that are equivalent to each
12953 other and [first2, last2) contains <i>n</i> elements that are
12954 equivalent to them, the first min(<i>m</i>, <i>n</i>) of those 
12955 elements from [first1, last1) are copied to the output range.
12956 </p></blockquote>
12957
12958 <p>Add a new paragraph, <b>Notes</b>, after 25.3.5.4 [set.difference]
12959 paragraph 4:</p>
12960 <blockquote><p>
12961 If [first1, last1) contains <i>m</i> elements that are equivalent to each
12962 other and [first2, last2) contains <i>n</i> elements that are
12963 equivalent to them, the last max(<i>m-n</i>, 0) elements from 
12964 [first1, last1) are copied to the output range.
12965 </p></blockquote>
12966
12967 <p>Add a new paragraph, <b>Notes</b>, after 25.3.5.5 [set.symmetric.difference]
12968 paragraph 4:</p>
12969 <blockquote><p>
12970 If [first1, last1) contains <i>m</i> elements that are equivalent to
12971 each other and [first2, last2) contains <i>n</i> elements that are
12972 equivalent to them, then |<i>m - n</i>| of those elements will be
12973 copied to the output range: the last <i>m - n</i> of these elements
12974 from [first1, last1) if <i>m</i> &gt; <i>n</i>, and the last <i>n -
12975 m</i> of these elements from [first2, last2) if <i>m</i> &lt; <i>n</i>.
12976 </p></blockquote>
12977
12978 <p><i>[Santa Cruz: it's believed that this language is clearer than
12979   what's in the Standard.  However, it's also believed that the
12980   Standard may already make these guarantees (although not quite in
12981   these words).  Bill and Howard will check and see whether they think
12982   that some or all of these changes may be redundant.  If so, we may
12983   close this issue as NAD.]</i></p>
12984
12985
12986
12987
12988 <p><b>Rationale:</b></p>
12989 <p>For simple cases, these descriptions are equivalent to what's
12990   already in the Standard.  For more complicated cases, they describe
12991   the behavior of existing implementations.</p>
12992
12993
12994
12995
12996
12997 <hr>
12998 <h3><a name="292"></a>292. effects of a.copyfmt (a)</h3>
12999 <p><b>Section:</b> 27.4.4.2 [basic.ios.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13000  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-01-05</p>
13001 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.ios.members">active issues</a> in [basic.ios.members].</p>
13002 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.ios.members">issues</a> in [basic.ios.members].</p>
13003 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13004 <p><b>Discussion:</b></p>
13005 <p>The Effects clause of the member function <tt>copyfmt()</tt> in
13006 27.4.4.2, p15 doesn't consider the case where the left-hand side
13007 argument is identical to the argument on the right-hand side, that is
13008 <tt>(this == &amp;rhs)</tt>.  If the two arguments are identical there
13009 is no need to copy any of the data members or call any callbacks
13010 registered with <tt>register_callback()</tt>.  Also, as Howard Hinnant
13011 points out in message c++std-lib-8149 it appears to be incorrect to
13012 allow the object to fire <tt>erase_event</tt> followed by
13013 <tt>copyfmt_event</tt> since the callback handling the latter event
13014 may inadvertently attempt to access memory freed by the former.
13015 </p>
13016
13017
13018 <p><b>Proposed resolution:</b></p>
13019 <p>Change the Effects clause in 27.4.4.2, p15 from</p>
13020
13021 <blockquote><p>
13022 <b>-15- Effects:</b>Assigns to the member objects of <tt>*this</tt>
13023 the corresponding member objects of <tt>rhs</tt>, except that...
13024 </p></blockquote>
13025
13026 <p>to</p>
13027
13028 <blockquote><p>
13029 <b>-15- Effects:</b>If <tt>(this == &amp;rhs)</tt> does nothing. Otherwise
13030 assigns to the member objects of <tt>*this</tt> the corresponding member
13031 objects of <tt>rhs</tt>, except that...
13032 </p></blockquote>
13033
13034
13035
13036
13037 <hr>
13038 <h3><a name="294"></a>294. User defined macros and standard headers</h3>
13039 <p><b>Section:</b> 17.4.3.2.1 [macro.names] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13040  <b>Submitter:</b> James Kanze <b>Date:</b> 2001-01-11</p>
13041 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13042 <p><b>Discussion:</b></p>
13043 <p>Paragraph 2 of 17.4.3.2.1 [macro.names] reads: "A
13044 translation unit that includes a header shall not contain any macros
13045 that define names declared in that header." As I read this, it
13046 would mean that the following program is legal:</p>
13047
13048 <pre>  #define npos 3.14
13049   #include &lt;sstream&gt;
13050 </pre>
13051
13052 <p>since npos is not defined in &lt;sstream&gt;.  It is, however, defined
13053 in &lt;string&gt;, and it is hard to imagine an implementation in
13054 which &lt;sstream&gt; didn't include &lt;string&gt;.</p>
13055
13056 <p>I think that this phrase was probably formulated before it was
13057 decided that a standard header may freely include other standard
13058 headers.  The phrase would be perfectly appropriate for C, for
13059 example.  In light of 17.4.4.1 [res.on.headers] paragraph 1, however,
13060 it isn't stringent enough.</p>
13061
13062
13063 <p><b>Proposed resolution:</b></p>
13064 <p>For 17.4.3.2.1 [macro.names], replace the current wording, which reads:</p>
13065 <blockquote>
13066      <p>Each name defined as a macro in a header is reserved to the
13067      implementation for any use if the translation unit includes
13068      the header.168)</p>
13069
13070      <p>A translation unit that includes a header shall not contain any
13071      macros that define names declared or defined in that header. Nor shall
13072      such a translation unit define macros for names lexically
13073      identical to keywords.</p>
13074
13075      <p>168) It is not permissible to remove a library macro definition by
13076      using the #undef directive.</p>
13077 </blockquote>
13078
13079 <p>with the wording:</p>
13080
13081 <blockquote>
13082      <p>A translation unit that includes a standard library header shall not
13083      #define or #undef names declared in any standard library header.</p>
13084
13085      <p>A translation unit shall not #define or #undef names lexically
13086      identical to keywords.</p>
13087 </blockquote>
13088
13089 <p><i>[Lillehammer: Beman provided new wording]</i></p>
13090
13091
13092
13093
13094
13095
13096 <hr>
13097 <h3><a name="295"></a>295. Is abs defined in &lt;cmath&gt;?</h3>
13098 <p><b>Section:</b> 26.7 [c.math] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13099  <b>Submitter:</b> Jens Maurer <b>Date:</b> 2001-01-12</p>
13100 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#c.math">issues</a> in [c.math].</p>
13101 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13102 <p><b>Discussion:</b></p>
13103 <p>
13104 Table 80 lists the contents of the &lt;cmath&gt; header.  It does not
13105 list <tt>abs()</tt>.  However, 26.5, paragraph 6, which lists added 
13106 signatures present in &lt;cmath&gt;, does say that several overloads
13107 of <tt>abs()</tt> should be defined in &lt;cmath&gt;.
13108 </p>
13109
13110
13111 <p><b>Proposed resolution:</b></p>
13112 <p>
13113 Add <tt>abs</tt> to Table 80.  Also, remove the parenthetical list
13114 of functions "(abs(), div(), rand(), srand())" from 26.5 [numarray],
13115 paragraph 1.
13116 </p>
13117
13118 <p><i>[Copenhagen: Modified proposed resolution so that it also gets
13119 rid of that vestigial list of functions in paragraph 1.]</i></p>
13120
13121
13122
13123
13124 <p><b>Rationale:</b></p>
13125 <p>All this DR does is fix a typo; it's uncontroversial.  A 
13126 separate question is whether we're doing the right thing in 
13127 putting some overloads in &lt;cmath&gt; that we aren't also 
13128 putting in &lt;cstdlib&gt;.  That's issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#323">323</a>.</p>
13129
13130
13131
13132
13133
13134 <hr>
13135 <h3><a name="297"></a>297. const_mem_fun_t&lt;&gt;::argument_type should be const T*</h3>
13136 <p><b>Section:</b> 20.6.8 [logical.operations] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13137  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-01-06</p>
13138 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13139 <p><b>Discussion:</b></p>
13140 <p>The class templates <tt>const_mem_fun_t</tt> in 20.5.8, p8 and
13141 <tt>const_mem_fun1_t</tt>
13142 in 20.5.8, p9 derive from <tt>unary_function&lt;T*, S&gt;</tt>, and
13143 <tt>binary_function&lt;T*,
13144 A, S&gt;</tt>, respectively. Consequently, their <tt>argument_type</tt>, and
13145 <tt>first_argument_type</tt>
13146 members, respectively, are both defined to be <tt>T*</tt> (non-const).
13147 However, their function call member operator takes a <tt>const T*</tt>
13148 argument. It is my opinion that <tt>argument_type</tt> should be <tt>const
13149 T*</tt> instead, so that one can easily refer to it in generic code. The
13150 example below derived from existing code fails to compile due to the
13151 discrepancy:
13152 </p>
13153
13154 <p><tt>template &lt;class T&gt;</tt>
13155 <br><tt>void foo (typename T::argument_type arg)&nbsp;&nbsp; // #1</tt>
13156 <br><tt>{</tt>
13157 <br><tt>&nbsp;&nbsp;&nbsp; typename T::result_type (T::*pf) (typename
13158 T::argument_type)
13159 const =&nbsp;&nbsp; // #2</tt>
13160 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;T::operator();</tt>
13161 <br><tt>}</tt>
13162 </p>
13163
13164 <p><tt>struct X { /* ... */ };</tt></p>
13165
13166 <p><tt>int main ()</tt>
13167 <br><tt>{</tt>
13168 <br><tt>&nbsp;&nbsp;&nbsp; const X x;</tt>
13169 <br><tt>&nbsp;&nbsp;&nbsp; foo&lt;std::const_mem_fun_t&lt;void, X&gt;
13170 &gt;(&amp;x);&nbsp;&nbsp;
13171 // #3</tt>
13172 <br><tt>}</tt>
13173 </p>
13174
13175 <p>#1 <tt>foo()</tt> takes a plain unqualified <tt>X*</tt> as an argument
13176 <br>#2 the type of the pointer is incompatible with the type of the member
13177 function
13178 <br>#3 the address of a constant being passed to a function taking a non-const
13179 <tt>X*</tt>
13180 </p>
13181
13182
13183 <p><b>Proposed resolution:</b></p>
13184 <p>Replace the top portion of the definition of the class template
13185 const_mem_fun_t in 20.5.8, p8
13186 </p>
13187 <p><tt>template &lt;class S, class T&gt; class const_mem_fun_t</tt>
13188 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : public
13189 unary_function&lt;T*, S&gt; {</tt>
13190 </p>
13191 <p>with</p>
13192 <p><tt>template &lt;class S, class T&gt; class const_mem_fun_t</tt>
13193 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : public
13194 unary_function&lt;<b>const</b> T*, S&gt; {</tt>
13195 </p>
13196 <p>Also replace the top portion of the definition of the class template
13197 const_mem_fun1_t in 20.5.8, p9</p>
13198 <p><tt>template &lt;class S, class T, class A&gt; class const_mem_fun1_t</tt>
13199 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : public
13200 binary_function&lt;T*, A, S&gt; {</tt>
13201 </p>
13202 <p>with</p>
13203 <p><tt>template &lt;class S, class T, class A&gt; class const_mem_fun1_t</tt>
13204 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : public
13205 binary_function&lt;<b>const</b> T*, A, S&gt; {</tt>
13206 </p>
13207
13208
13209 <p><b>Rationale:</b></p>
13210 <p>This is simply a contradiction: the <tt>argument_type</tt> typedef,
13211 and the argument type itself, are not the same.</p>
13212
13213
13214
13215
13216
13217 <hr>
13218 <h3><a name="298"></a>298. ::operator delete[] requirement incorrect/insufficient</h3>
13219 <p><b>Section:</b> 18.5.1.2 [new.delete.array] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13220  <b>Submitter:</b> John A. Pedretti <b>Date:</b> 2001-01-10</p>
13221 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13222 <p><b>Discussion:</b></p>
13223 <p>
13224 The default behavior of <tt>operator delete[]</tt> described in 18.5.1.2, p12 -
13225 namely that for non-null value of <i>ptr</i>, the operator reclaims storage
13226 allocated by the earlier call to the default <tt>operator new[]</tt> - is not
13227 correct in all cases. Since the specified <tt>operator new[]</tt> default
13228 behavior is to call <tt>operator new</tt> (18.5.1.2, p4, p8), which can be
13229 replaced, along with <tt>operator delete</tt>, by the user, to implement their
13230 own memory management, the specified default behavior of<tt> operator
13231 delete[]</tt> must be to call <tt>operator delete</tt>.
13232 </p>
13233
13234
13235 <p><b>Proposed resolution:</b></p>
13236 <p>Change 18.5.1.2, p12 from</p>
13237 <blockquote><p>
13238 <b>-12-</b> <b>Default behavior:</b></p>
13239 <ul>
13240 <li>
13241 For a null value of <i><tt>ptr</tt></i> , does nothing.
13242 </li>
13243 <li>
13244 Any other value of <i><tt>ptr</tt></i> shall be a value returned
13245 earlier by a call to the default <tt>operator new[](std::size_t)</tt>.
13246 [Footnote: The value must not have been invalidated by an intervening
13247 call to <tt>operator delete[](void*)</tt> (17.4.3.8 [res.on.arguments]).
13248 --- end footnote]
13249 For such a non-null value of <i><tt>ptr</tt></i> , reclaims storage
13250 allocated by the earlier call to the default <tt>operator new[]</tt>.
13251 </li>
13252 </ul>
13253 </blockquote>
13254
13255 <p>to</p>
13256
13257 <blockquote><p>
13258 <b>-12-</b> <b>Default behavior: </b>Calls <tt>operator
13259 delete(</tt><i>ptr</i>)
13260 or <tt>operator delete(<i>ptr</i>, std::nothrow)</tt> respectively.
13261 </p></blockquote>
13262 <p>and expunge paragraph 13.</p>
13263
13264
13265
13266
13267 <hr>
13268 <h3><a name="300"></a>300. list::merge() specification incomplete</h3>
13269 <p><b>Section:</b> 23.2.4.4 [list.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13270  <b>Submitter:</b> John Pedretti <b>Date:</b> 2001-01-23</p>
13271 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#list.ops">issues</a> in [list.ops].</p>
13272 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13273 <p><b>Discussion:</b></p>
13274 <p>
13275 The "Effects" clause for list::merge() (23.2.4.4 [list.ops], p23)
13276 appears to be incomplete: it doesn't cover the case where the argument
13277 list is identical to *this (i.e., this == &amp;x). The requirement in the
13278 note in p24 (below) is that x be empty after the merge which is surely
13279 unintended in this case.
13280 </p>
13281
13282
13283 <p><b>Proposed resolution:</b></p>
13284 <p>In 23.2.4.4 [list.ops], replace paragraps 23-25 with:</p>
13285 <blockquote>
13286 <p>
13287 23 Effects: if (&amp;x == this) does nothing; otherwise, merges the two
13288 sorted ranges [begin(), end()) and [x.begin(), x.end()).  The result
13289 is a range in which the elements will be sorted in non-decreasing
13290 order according to the ordering defined by comp; that is, for every
13291 iterator i in the range other than the first, the condition comp(*i,
13292 *(i - 1)) will be false.
13293 </p>
13294
13295 <p>
13296 24 Notes: Stable: if (&amp;x != this), then for equivalent elements in the
13297 two original ranges, the elements from the original range [begin(),
13298 end()) always precede the elements from the original range [x.begin(),
13299 x.end()).  If (&amp;x != this) the range [x.begin(), x.end()) is empty
13300 after the merge.
13301 </p>
13302
13303 <p>
13304 25 Complexity: At most size() + x.size() - 1 applications of comp if
13305 (&amp;x !  = this); otherwise, no applications of comp are performed.  If
13306 an exception is thrown other than by a comparison there are no
13307 effects.
13308 </p>
13309
13310 </blockquote>
13311
13312 <p><i>[Copenhagen: The original proposed resolution did not fix all of
13313 the problems in 23.2.4.4 [list.ops], p22-25.  Three different
13314 paragraphs (23, 24, 25) describe the effects of <tt>merge</tt>.
13315 Changing p23, without changing the other two, appears to introduce
13316 contradictions.  Additionally, "merges the argument list into the
13317 list" is excessively vague.]</i></p>
13318
13319
13320 <p><i>[Post-Curaçao: Robert Klarer provided new wording.]</i></p>
13321
13322
13323
13324
13325
13326
13327
13328 <hr>
13329 <h3><a name="301"></a>301. basic_string template ctor effects clause omits allocator argument</h3>
13330 <p><b>Section:</b> 21.3.1 [string.require] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13331  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-01-27</p>
13332 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.require">issues</a> in [string.require].</p>
13333 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13334 <p><b>Discussion:</b></p>
13335 <p>
13336 The effects clause for the basic_string template ctor in 21.3.1, p15
13337 leaves out the third argument of type Allocator. I believe this to be
13338 a mistake.
13339 </p>
13340
13341
13342 <p><b>Proposed resolution:</b></p>
13343 <p>Replace</p>
13344
13345 <blockquote>
13346     <p><b>-15- Effects:</b> If <i><tt>InputIterator</tt></i> is an integral
13347     type, equivalent to</p>
13348
13349     <blockquote><p><tt>basic_string(static_cast&lt;size_type&gt;(begin),
13350     static_cast&lt;value_type&gt;(end))</tt></p></blockquote>
13351 </blockquote>
13352
13353 <p>with</p>
13354
13355 <blockquote>
13356     <p><b>-15- Effects:</b> If <i><tt>InputIterator</tt></i> is an integral
13357     type, equivalent to</p>
13358
13359     <blockquote><p><tt>basic_string(static_cast&lt;size_type&gt;(begin),
13360     static_cast&lt;value_type&gt;(end), <b>a</b>)</tt></p></blockquote>
13361 </blockquote>
13362
13363
13364
13365
13366 <hr>
13367 <h3><a name="303"></a>303. Bitset input operator underspecified</h3>
13368 <p><b>Section:</b> 23.3.5.3 [bitset.operators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13369  <b>Submitter:</b> Matt Austern <b>Date:</b> 2001-02-05</p>
13370 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13371 <p><b>Discussion:</b></p>
13372 <p>
13373 In 23.3.5.3, we are told that <tt>bitset</tt>'s input operator
13374 "Extracts up to <i>N</i> (single-byte) characters from
13375 <i>is</i>.", where <i>is</i> is a stream of type
13376 <tt>basic_istream&lt;charT, traits&gt;</tt>.
13377 </p>
13378
13379 <p>
13380 The standard does not say what it means to extract single byte
13381 characters from a stream whose character type, <tt>charT</tt>, is in
13382 general not a single-byte character type.  Existing implementations
13383 differ.
13384 </p>
13385
13386 <p>
13387 A reasonable solution will probably involve <tt>widen()</tt> and/or
13388 <tt>narrow()</tt>, since they are the supplied mechanism for
13389 converting a single character between <tt>char</tt> and 
13390 arbitrary <tt>charT</tt>.
13391 </p>
13392
13393 <p>Narrowing the input characters is not the same as widening the
13394 literals <tt>'0'</tt> and <tt>'1'</tt>, because there may be some
13395 locales in which more than one wide character maps to the narrow
13396 character <tt>'0'</tt>.  Narrowing means that alternate
13397 representations may be used for bitset input, widening means that
13398 they may not be.</p>
13399
13400 <p>Note that for numeric input, <tt>num_get&lt;&gt;</tt>
13401 (22.2.2.1.2/8) compares input characters to widened version of narrow
13402 character literals.</p>
13403
13404 <p>From Pete Becker, in c++std-lib-8224:</p>
13405 <blockquote>
13406 <p>
13407 Different writing systems can have different representations for the
13408 digits that represent 0 and 1. For example, in the Unicode representation
13409 of the Devanagari script (used in many of the Indic languages) the digit 0
13410 is 0x0966, and the digit 1 is 0x0967. Calling narrow would translate those
13411 into '0' and '1'. But Unicode also provides the ASCII values 0x0030 and
13412 0x0031 for for the Latin representations of '0' and '1', as well as code
13413 points for the same numeric values in several other scripts (Tamil has no
13414 character for 0, but does have the digits 1-9), and any of these values
13415 would also be narrowed to '0' and '1'.
13416 </p>
13417
13418 <p>...</p>
13419
13420 <p>
13421 It's fairly common to intermix both native and Latin
13422 representations of numbers in a document. So I think the rule has to be
13423 that if a wide character represents a digit whose value is 0 then the bit
13424 should be cleared; if it represents a digit whose value is 1 then the bit
13425 should be set; otherwise throw an exception. So in a Devanagari locale,
13426 both 0x0966 and 0x0030 would clear the bit, and both 0x0967 and 0x0031
13427 would set it. Widen can't do that. It would pick one of those two values,
13428 and exclude the other one.
13429 </p>
13430
13431 </blockquote>
13432
13433 <p>From Jens Maurer, in c++std-lib-8233:</p>
13434
13435 <blockquote>
13436 <p>
13437 Whatever we decide, I would find it most surprising if
13438 bitset conversion worked differently from int conversion
13439 with regard to alternate local representations of
13440 numbers.
13441 </p>
13442
13443 <p>Thus, I think the options are:</p>
13444 <ul>
13445  <li> Have a new defect issue for 22.2.2.1.2/8 so that it will
13446 require the use of narrow().</li>
13447
13448  <li> Have a defect issue for bitset() which describes clearly
13449 that widen() is to be used.</li>
13450 </ul>
13451 </blockquote>
13452
13453
13454
13455 <p><b>Proposed resolution:</b></p>
13456
13457     <p>Replace the first two sentences of paragraph 5 with:</p>
13458
13459     <blockquote><p>
13460     Extracts up to <i>N</i> characters from <i>is</i>. Stores these
13461     characters in a temporary object <i>str</i> of type
13462     <tt>basic_string&lt;charT, traits&gt;</tt>, then evaluates the
13463     expression <tt><i>x</i> = bitset&lt;N&gt;(<i>str</i>)</tt>.
13464     </p></blockquote>
13465
13466     <p>Replace the third bullet item in paragraph 5 with:</p>
13467     <ul><li>
13468     the next input character is neither <tt><i>is</i>.widen(0)</tt>
13469     nor <tt><i>is</i>.widen(1)</tt> (in which case the input character
13470     is not extracted).
13471     </li></ul>
13472
13473
13474
13475 <p><b>Rationale:</b></p>
13476 <p>Input for <tt>bitset</tt> should work the same way as numeric
13477 input.  Using <tt>widen</tt> does mean that alternative digit
13478 representations will not be recognized, but this was a known 
13479 consequence of the design choice.</p>
13480
13481
13482
13483
13484
13485 <hr>
13486 <h3><a name="305"></a>305. Default behavior of codecvt&lt;wchar_t, char, mbstate_t&gt;::length()</h3>
13487 <p><b>Section:</b> 22.2.1.5 [locale.codecvt.byname] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13488  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2001-01-24</p>
13489 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt.byname">issues</a> in [locale.codecvt.byname].</p>
13490 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13491 <p><b>Discussion:</b></p>
13492 <p>22.2.1.5/3 introduces codecvt in part with:</p>
13493
13494 <blockquote><p>
13495   codecvt&lt;wchar_t,char,mbstate_t&gt; converts between the native
13496   character sets for tiny and wide characters. Instantiations on
13497   mbstate_t perform conversion between encodings known to the library
13498   implementor.
13499 </p></blockquote>
13500
13501 <p>But 22.2.1.5.2/10 describes do_length in part with:</p>
13502
13503 <blockquote><p>
13504   ... codecvt&lt;wchar_t, char, mbstate_t&gt; ... return(s) the lesser of max and 
13505   (from_end-from).
13506 </p></blockquote>
13507
13508 <p>
13509 The semantics of do_in and do_length are linked.  What one does must
13510 be consistent with what the other does.  22.2.1.5/3 leads me to
13511 believe that the vendor is allowed to choose the algorithm that
13512 codecvt&lt;wchar_t,char,mbstate_t&gt;::do_in performs so that it makes
13513 his customers happy on a given platform.  But 22.2.1.5.2/10 explicitly
13514 says what codecvt&lt;wchar_t,char,mbstate_t&gt;::do_length must
13515 return.  And thus indirectly specifies the algorithm that
13516 codecvt&lt;wchar_t,char,mbstate_t&gt;::do_in must perform.  I believe
13517 that this is not what was intended and is a defect.
13518 </p>
13519
13520 <p>Discussion from the -lib reflector:
13521
13522 <br>This proposal would have the effect of making the semantics of
13523 all of the virtual functions in <tt>codecvt&lt;wchar_t, char,
13524 mbstate_t&gt;</tt> implementation specified.  Is that what we want, or
13525 do we want to mandate specific behavior for the base class virtuals
13526 and leave the implementation specified behavior for the codecvt_byname
13527 derived class?  The tradeoff is that former allows implementors to
13528 write a base class that actually does something useful, while the
13529 latter gives users a way to get known and specified---albeit
13530 useless---behavior, and is consistent with the way the standard
13531 handles other facets.  It is not clear what the original intention
13532 was.</p>
13533
13534 <p>
13535 Nathan has suggest a compromise: a character that is a widened version
13536 of the characters in the basic execution character set must be
13537 converted to a one-byte sequence, but there is no such requirement
13538 for characters that are not part of the basic execution character set.
13539 </p>
13540
13541
13542 <p><b>Proposed resolution:</b></p>
13543 <p>
13544 Change 22.2.1.5.2/5 from:
13545 </p>
13546 <p>
13547 The instantiations required in Table 51 (lib.locale.category), namely
13548 codecvt&lt;wchar_t,char,mbstate_t&gt; and
13549 codecvt&lt;char,char,mbstate_t&gt;, store no characters. Stores no more
13550 than (to_limit-to) destination elements. It always leaves the to_next
13551 pointer pointing one beyond the last element successfully stored.
13552 </p>
13553 <p>
13554 to:
13555 </p>
13556 <p>
13557 Stores no more than (to_limit-to) destination elements, and leaves the
13558 to_next pointer pointing one beyond the last element successfully
13559 stored.  codecvt&lt;char,char,mbstate_t&gt; stores no characters.
13560 </p>
13561
13562 <p>Change 22.2.1.5.2/10 from:</p>
13563
13564 <blockquote><p>
13565 -10- Returns: (from_next-from) where from_next is the largest value in
13566 the range [from,from_end] such that the sequence of values in the
13567 range [from,from_next) represents max or fewer valid complete
13568 characters of type internT. The instantiations required in Table 51
13569 (21.1.1.1.1), namely codecvt&lt;wchar_t, char, mbstate_t&gt; and
13570 codecvt&lt;char, char, mbstate_t&gt;, return the lesser of max and
13571 (from_end-from).
13572 </p></blockquote>
13573
13574 <p>to:</p>
13575
13576 <blockquote><p>
13577 -10- Returns: (from_next-from) where from_next is the largest value in 
13578 the range [from,from_end] such that the sequence of values in the range 
13579 [from,from_next) represents max or fewer valid complete characters of 
13580 type internT. The instantiation codecvt&lt;char, char, mbstate_t&gt; returns 
13581 the lesser of max and (from_end-from). 
13582 </p></blockquote>
13583
13584 <p><i>[Redmond: Nathan suggested an alternative resolution: same as
13585 above, but require that, in the default encoding, a character from the
13586 basic execution character set would map to a single external
13587 character.  The straw poll was 8-1 in favor of the proposed
13588 resolution.]</i></p>
13589
13590
13591
13592
13593 <p><b>Rationale:</b></p>
13594 <p>The default encoding should be whatever users of a given platform
13595 would expect to be the most natural.  This varies from platform to
13596 platform.  In many cases there is a preexisting C library, and users
13597 would expect the default encoding to be whatever C uses in the default
13598 "C" locale.  We could impose a guarantee like the one Nathan suggested
13599 (a character from the basic execution character set must map to a
13600 single external character), but this would rule out important
13601 encodings that are in common use: it would rule out JIS, for
13602 example, and it would rule out a fixed-width encoding of UCS-4.</p>
13603
13604 <p><i>[Curaçao: fixed rationale typo at the request of Ichiro Koshida;
13605 "shift-JIS" changed to "JIS".]</i></p>
13606
13607
13608
13609
13610
13611
13612
13613 <hr>
13614 <h3><a name="306"></a>306. offsetof macro and non-POD types</h3>
13615 <p><b>Section:</b> 18.1 [support.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13616  <b>Submitter:</b> Steve Clamage <b>Date:</b> 2001-02-21</p>
13617 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#support.types">issues</a> in [support.types].</p>
13618 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13619 <p><b>Discussion:</b></p> 
13620 <p>Spliced together from reflector messages c++std-lib-8294 and -8295:</p>
13621
13622 <p>18.1, paragraph 5, reads: "The macro <tt>offsetof</tt>
13623 accepts a restricted set of <i>type</i> arguments in this
13624 International Standard. <i>type</i> shall be a POD structure or a POD
13625 union (clause 9). The result of applying the offsetof macro to a field
13626 that is a static data member or a function member is
13627 undefined."</p>
13628
13629 <p>For the POD requirement, it doesn't say "no diagnostic
13630 required" or "undefined behavior". I read 1.4 [intro.compliance], paragraph 1, to mean that a diagnostic is required.
13631 It's not clear whether this requirement was intended.  While it's
13632 possible to provide such a diagnostic, the extra complication doesn't
13633 seem to add any value.
13634 </p>
13635
13636
13637 <p><b>Proposed resolution:</b></p>
13638 <p>Change 18.1, paragraph 5, to "If <i>type</i> is not a POD
13639 structure or a POD union the results are undefined."</p>
13640
13641 <p><i>[Copenhagen: straw poll was 7-4 in favor.  It was generally
13642 agreed that requiring a diagnostic was inadvertent, but some LWG
13643 members thought that diagnostics should be required whenever
13644 possible.]</i></p>
13645
13646
13647
13648
13649
13650
13651 <hr>
13652 <h3><a name="307"></a>307. Lack of reference typedefs in container adaptors</h3>
13653 <p><b>Section:</b> 23.2.4 [list] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13654  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2001-03-13</p>
13655 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13656 <p><b>Discussion:</b></p>
13657
13658 <p>From reflector message c++std-lib-8330.  See also lib-8317.</p>
13659
13660 <p>
13661 The standard is currently inconsistent in 23.2.4.2 [list.capacity]
13662 paragraph 1 and 23.2.4.3 [list.modifiers] paragraph 1.
13663 23.2.3.3/1, for example, says:
13664 </p>
13665
13666 <blockquote><p>
13667 -1- Any sequence supporting operations back(), push_back() and pop_back() 
13668 can be used to instantiate stack. In particular, vector (lib.vector), list 
13669 (lib.list) and deque (lib.deque) can be used. 
13670 </p></blockquote>
13671
13672 <p>But this is false: vector&lt;bool&gt; can not be used, because the
13673 container adaptors return a T&amp; rather than using the underlying
13674 container's reference type.</p>
13675
13676 <p>This is a contradiction that can be fixed by:</p>
13677
13678 <ol>
13679 <li>Modifying these paragraphs to say that vector&lt;bool&gt;
13680     is an exception.</li>
13681 <li>Removing the vector&lt;bool&gt; specialization.</li>
13682 <li>Changing the return types of stack and priority_queue to use 
13683     reference typedef's.</li>
13684 </ol>
13685
13686 <p>
13687 I propose 3.  This does not preclude option 2 if we choose to do it
13688 later (see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#96">96</a>); the issues are independent.  Option
13689 3 offers a small step towards support for proxied containers.  This
13690 small step fixes a current contradiction, is easy for vendors to
13691 implement, is already implemented in at least one popular lib, and
13692 does not break any code.
13693 </p>
13694
13695
13696
13697 <p><b>Proposed resolution:</b></p>
13698 <p>Summary: Add reference and const_reference typedefs to queue,
13699 priority_queue and stack.  Change return types of "value_type&amp;" to
13700 "reference".  Change return types of "const value_type&amp;" to
13701 "const_reference".  Details:</p>
13702
13703 <p>Change 23.2.3.1/1 from:</p>
13704
13705 <pre>  namespace std {
13706     template &lt;class T, class Container = deque&lt;T&gt; &gt;
13707     class queue {
13708     public:
13709       typedef typename Container::value_type            value_type;
13710       typedef typename Container::size_type             size_type;
13711       typedef          Container                        container_type;
13712     protected:
13713       Container c;
13714
13715     public:
13716       explicit queue(const Container&amp; = Container());
13717
13718       bool      empty() const             { return c.empty(); }
13719       size_type size()  const             { return c.size(); }
13720       value_type&amp;       front()           { return c.front(); }
13721       const value_type&amp; front() const     { return c.front(); }
13722       value_type&amp;       back()            { return c.back(); }
13723       const value_type&amp; back() const      { return c.back(); }
13724       void push(const value_type&amp; x)      { c.push_back(x); }
13725       void pop()                          { c.pop_front(); }
13726     };
13727 </pre>
13728
13729 <p>to:</p>
13730
13731 <pre>  namespace std {
13732     template &lt;class T, class Container = deque&lt;T&gt; &gt;
13733     class queue {
13734     public:
13735       typedef typename Container::value_type            value_type;
13736       typedef typename Container::reference             reference;
13737       typedef typename Container::const_reference       const_reference;
13738       typedef typename Container::value_type            value_type;
13739       typedef typename Container::size_type             size_type;
13740       typedef          Container                        container_type;
13741     protected:
13742       Container c;
13743
13744     public:
13745       explicit queue(const Container&amp; = Container());
13746
13747       bool      empty() const             { return c.empty(); }
13748       size_type size()  const             { return c.size(); }
13749       reference         front()           { return c.front(); }
13750       const_reference   front() const     { return c.front(); }
13751       reference         back()            { return c.back(); }
13752       const_reference   back() const      { return c.back(); }
13753       void push(const value_type&amp; x)      { c.push_back(x); }
13754       void pop()                          { c.pop_front(); }
13755     };
13756 </pre>
13757
13758 <p>Change 23.2.3.2/1 from:</p>
13759
13760 <pre>  namespace std {
13761     template &lt;class T, class Container = vector&lt;T&gt;,
13762               class Compare = less&lt;typename Container::value_type&gt; &gt;
13763     class priority_queue {
13764     public:
13765       typedef typename Container::value_type            value_type;
13766       typedef typename Container::size_type             size_type;
13767       typedef          Container                        container_type;
13768     protected:
13769       Container c;
13770       Compare comp;
13771
13772     public:
13773       explicit priority_queue(const Compare&amp; x = Compare(),
13774                               const Container&amp; = Container());
13775       template &lt;class InputIterator&gt;
13776         priority_queue(InputIterator first, InputIterator last,
13777                        const Compare&amp; x = Compare(),
13778                        const Container&amp; = Container());
13779
13780       bool      empty() const       { return c.empty(); }
13781       size_type size()  const       { return c.size(); }
13782       const value_type&amp; top() const { return c.front(); }
13783       void push(const value_type&amp; x);
13784       void pop();
13785     };
13786                                   //  no equality is provided
13787   }
13788 </pre>
13789
13790 <p>to:</p>
13791
13792 <pre>  namespace std {
13793     template &lt;class T, class Container = vector&lt;T&gt;,
13794               class Compare = less&lt;typename Container::value_type&gt; &gt;
13795     class priority_queue {
13796     public:
13797       typedef typename Container::value_type            value_type;
13798       typedef typename Container::reference             reference;
13799       typedef typename Container::const_reference       const_reference;
13800       typedef typename Container::size_type             size_type;
13801       typedef          Container                        container_type;
13802     protected:
13803       Container c;
13804       Compare comp;
13805
13806     public:
13807       explicit priority_queue(const Compare&amp; x = Compare(),
13808                               const Container&amp; = Container());
13809       template &lt;class InputIterator&gt;
13810         priority_queue(InputIterator first, InputIterator last,
13811                        const Compare&amp; x = Compare(),
13812                        const Container&amp; = Container());
13813
13814       bool      empty() const       { return c.empty(); }
13815       size_type size()  const       { return c.size(); }
13816       const_reference   top() const { return c.front(); }
13817       void push(const value_type&amp; x);
13818       void pop();
13819     };
13820                                   //  no equality is provided
13821   }
13822 </pre>
13823
13824 <p>And change 23.2.3.3/1 from:</p>
13825
13826 <pre>  namespace std {
13827     template &lt;class T, class Container = deque&lt;T&gt; &gt;
13828     class stack {
13829     public:
13830       typedef typename Container::value_type            value_type;
13831       typedef typename Container::size_type             size_type;
13832       typedef          Container                        container_type;
13833     protected:
13834       Container c;
13835
13836     public:
13837       explicit stack(const Container&amp; = Container());
13838
13839       bool      empty() const             { return c.empty(); }
13840       size_type size()  const             { return c.size(); }
13841       value_type&amp;       top()             { return c.back(); }
13842       const value_type&amp; top() const       { return c.back(); }
13843       void push(const value_type&amp; x)      { c.push_back(x); }
13844       void pop()                          { c.pop_back(); }
13845     };
13846
13847     template &lt;class T, class Container&gt;
13848       bool operator==(const stack&lt;T, Container&gt;&amp; x,
13849                       const stack&lt;T, Container&gt;&amp; y);
13850     template &lt;class T, class Container&gt;
13851       bool operator&lt; (const stack&lt;T, Container&gt;&amp; x,
13852                       const stack&lt;T, Container&gt;&amp; y);
13853     template &lt;class T, class Container&gt;
13854       bool operator!=(const stack&lt;T, Container&gt;&amp; x,
13855                       const stack&lt;T, Container&gt;&amp; y);
13856     template &lt;class T, class Container&gt;
13857       bool operator&gt; (const stack&lt;T, Container&gt;&amp; x,
13858                       const stack&lt;T, Container&gt;&amp; y);
13859     template &lt;class T, class Container&gt;
13860       bool operator&gt;=(const stack&lt;T, Container&gt;&amp; x,
13861                       const stack&lt;T, Container&gt;&amp; y);
13862     template &lt;class T, class Container&gt;
13863       bool operator&lt;=(const stack&lt;T, Container&gt;&amp; x,
13864                       const stack&lt;T, Container&gt;&amp; y);
13865   }
13866 </pre>
13867
13868 <p>to:</p>
13869
13870 <pre>  namespace std {
13871     template &lt;class T, class Container = deque&lt;T&gt; &gt;
13872     class stack {
13873     public:
13874       typedef typename Container::value_type            value_type;
13875       typedef typename Container::reference             reference;
13876       typedef typename Container::const_reference       const_reference;
13877       typedef typename Container::size_type             size_type;
13878       typedef          Container                        container_type;
13879     protected:
13880       Container c;
13881
13882     public:
13883       explicit stack(const Container&amp; = Container());
13884
13885       bool      empty() const             { return c.empty(); }
13886       size_type size()  const             { return c.size(); }
13887       reference         top()             { return c.back(); }
13888       const_reference   top() const       { return c.back(); }
13889       void push(const value_type&amp; x)      { c.push_back(x); }
13890       void pop()                          { c.pop_back(); }
13891     };
13892
13893     template &lt;class T, class Container&gt;
13894       bool operator==(const stack&lt;T, Container&gt;&amp; x,
13895                       const stack&lt;T, Container&gt;&amp; y);
13896     template &lt;class T, class Container&gt;
13897       bool operator&lt; (const stack&lt;T, Container&gt;&amp; x,
13898                       const stack&lt;T, Container&gt;&amp; y);
13899     template &lt;class T, class Container&gt;
13900       bool operator!=(const stack&lt;T, Container&gt;&amp; x,
13901                       const stack&lt;T, Container&gt;&amp; y);
13902     template &lt;class T, class Container&gt;
13903       bool operator&gt; (const stack&lt;T, Container&gt;&amp; x,
13904                       const stack&lt;T, Container&gt;&amp; y);
13905     template &lt;class T, class Container&gt;
13906       bool operator&gt;=(const stack&lt;T, Container&gt;&amp; x,
13907                       const stack&lt;T, Container&gt;&amp; y);
13908     template &lt;class T, class Container&gt;
13909       bool operator&lt;=(const stack&lt;T, Container&gt;&amp; x,
13910                       const stack&lt;T, Container&gt;&amp; y);
13911   }
13912 </pre>
13913
13914 <p><i>[Copenhagen: This change was discussed before the IS was released
13915 and it was deliberately not adopted.  Nevertheless, the LWG believes
13916 (straw poll: 10-2) that it is a genuine defect.]</i></p>
13917
13918
13919
13920
13921
13922
13923 <hr>
13924 <h3><a name="308"></a>308. Table 82 mentions unrelated headers</h3>
13925 <p><b>Section:</b> 27 [input.output] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13926  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-03-15</p>
13927 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#input.output">issues</a> in [input.output].</p>
13928 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13929 <p><b>Discussion:</b></p>
13930 <p>
13931 Table 82 in section 27 mentions the header &lt;cstdlib&gt; for String
13932 streams (27.7 [string.streams]) and the headers &lt;cstdio&gt; and
13933 &lt;cwchar&gt; for File streams (27.8 [file.streams]). It's not clear
13934 why these headers are mentioned in this context since they do not
13935 define any of the library entities described by the
13936 subclauses. According to 17.4.1.1 [contents], only such headers
13937 are to be listed in the summary.
13938 </p>
13939
13940
13941 <p><b>Proposed resolution:</b></p>
13942 <p>Remove &lt;cstdlib&gt; and &lt;cwchar&gt; from
13943 Table 82.</p>
13944
13945 <p><i>[Copenhagen: changed the proposed resolution slightly.  The
13946 original proposed resolution also said to remove &lt;cstdio&gt; from
13947 Table 82.  However, &lt;cstdio&gt; is mentioned several times within
13948 section 27.8 [file.streams], including 27.8.2 [c.files].]</i></p>
13949
13950
13951
13952
13953
13954
13955 <hr>
13956 <h3><a name="310"></a>310. Is errno a macro?</h3>
13957 <p><b>Section:</b> 17.4.1.2 [headers], 19.3 [errno] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
13958  <b>Submitter:</b> Steve Clamage <b>Date:</b> 2001-03-21</p>
13959 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#headers">issues</a> in [headers].</p>
13960 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
13961 <p><b>Discussion:</b></p>
13962   <p>
13963   Exactly how should errno be declared in a conforming C++ header?
13964   </p>
13965
13966   <p>
13967   The C standard says in 7.1.4 that it is unspecified whether errno is a
13968   macro or an identifier with external linkage.  In some implementations
13969   it can be either, depending on compile-time options.  (E.g., on
13970   Solaris in multi-threading mode, errno is a macro that expands to a
13971   function call, but is an extern int otherwise.  "Unspecified" allows
13972   such variability.)
13973   </p>
13974
13975   <p>The C++ standard:</p>
13976   <ul>
13977   <li>17.4.1.2 says in a note that errno must be macro in C. (false)</li>
13978   <li>17.4.3.1.3 footnote 166 says errno is reserved as an external 
13979       name (true), and implies that it is an identifier.</li>
13980   <li>19.3 simply lists errno as a macro (by what reasoning?) and goes
13981       on to say that the contents of of C++ &lt;errno.h&gt; are the
13982       same as in C, begging the question.</li>
13983   <li>C.2, table 95 lists errno as a macro, without comment.</li>
13984   </ul>
13985
13986   <p>I find no other references to errno.</p>
13987
13988   <p>We should either explicitly say that errno must be a macro, even
13989   though it need not be a macro in C, or else explicitly leave it
13990   unspecified.  We also need to say something about namespace std. 
13991   A user who includes &lt;cerrno&gt; needs to know whether to write
13992   <tt>errno</tt>, or <tt>::errno</tt>, or <tt>std::errno</tt>, or
13993   else &lt;cerrno&gt; is useless.</p>
13994
13995   <p>Two acceptable fixes:</p>
13996   <ul>
13997     <li><p>errno must be a macro. This is trivially satisfied by adding<br>
13998         &nbsp;&nbsp;#define errno (::std::errno)<br>
13999         to the headers if errno is not already a macro. You then always
14000         write errno without any scope qualification, and it always expands
14001         to a correct reference. Since it is always a macro, you know to
14002         avoid using errno as a local identifer.</p></li>
14003     <li><p>errno is in the global namespace. This fix is inferior, because
14004         ::errno is not guaranteed to be well-formed.</p></li>
14005   </ul>
14006
14007   <p><i>[
14008     This issue was first raised in 1999, but it slipped through 
14009     the cracks.
14010   ]</i></p>
14011
14012
14013
14014 <p><b>Proposed resolution:</b></p>
14015   <p>Change the Note in section 17.4.1.2p5 from</p>
14016
14017     <blockquote><p>
14018     Note: the names defined as macros in C include the following:
14019     assert, errno, offsetof, setjmp, va_arg, va_end, and va_start.
14020     </p></blockquote>
14021
14022   <p>to</p>
14023
14024     <blockquote><p>
14025     Note: the names defined as macros in C include the following:
14026     assert, offsetof, setjmp, va_arg, va_end, and va_start.
14027     </p></blockquote>
14028
14029   <p>In section 19.3, change paragraph 2 from</p>
14030
14031     <blockquote><p>
14032     The contents are the same as the Standard C library header
14033     &lt;errno.h&gt;.
14034     </p></blockquote>
14035
14036   <p>to</p>
14037
14038     <blockquote><p>
14039     The contents are the same as the Standard C library header 
14040     &lt;errno.h&gt;, except that errno shall be defined as a macro.
14041     </p></blockquote>
14042
14043
14044 <p><b>Rationale:</b></p>
14045 <p>C++ must not leave it up to the implementation to decide whether or
14046 not a name is a macro; it must explicitly specify exactly which names
14047 are required to be macros.  The only one that really works is for it
14048 to be a macro.</p>
14049
14050 <p><i>[Curaçao: additional rationale added.]</i></p>
14051
14052
14053
14054
14055
14056
14057
14058 <hr>
14059 <h3><a name="311"></a>311. Incorrect wording in basic_ostream class synopsis</h3>
14060 <p><b>Section:</b> 27.6.2.1 [ostream] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14061  <b>Submitter:</b> Andy Sawyer <b>Date:</b> 2001-03-21</p>
14062 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream">issues</a> in [ostream].</p>
14063 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14064 <p><b>Discussion:</b></p>
14065
14066 <p>In 27.6.2.1 [ostream], the synopsis of class basic_ostream says:</p>
14067
14068 <pre>  // partial specializationss
14069   template&lt;class traits&gt;
14070     basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;( basic_ostream&lt;char,traits&gt;&amp;,
14071                                             const char * );
14072 </pre>
14073
14074 <p>Problems:</p>
14075 <ul>
14076 <li>Too many 's's at the end of "specializationss" </li>
14077 <li>This is an overload, not a partial specialization</li>
14078 </ul>
14079
14080
14081
14082 <p><b>Proposed resolution:</b></p>
14083 <p>In the synopsis in 27.6.2.1 [ostream], remove the 
14084 <i>// partial specializationss</i> comment.  Also remove the same 
14085 comment (correctly spelled, but still incorrect) from the synopsis in 
14086 27.6.2.6.4 [ostream.inserters.character].
14087 </p>
14088
14089 <p><i>[
14090 Pre-Redmond: added 27.6.2.6.4 [ostream.inserters.character] because of Martin's
14091 comment in c++std-lib-8939.
14092 ]</i></p>
14093
14094
14095
14096
14097
14098
14099
14100 <hr>
14101 <h3><a name="312"></a>312. Table 27 is missing headers</h3>
14102 <p><b>Section:</b> 20 [utilities] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14103  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-03-29</p>
14104 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14105 <p><b>Discussion:</b></p>
14106 <p>Table 27 in section 20 lists the header &lt;memory&gt; (only) for
14107 Memory (lib.memory) but neglects to mention the headers
14108 &lt;cstdlib&gt; and &lt;cstring&gt; that are discussed in 20.5.5 [meta.rel].</p>
14109
14110
14111 <p><b>Proposed resolution:</b></p>
14112 <p>Add &lt;cstdlib&gt; and &lt;cstring&gt; to Table 27, in the same row
14113 as &lt;memory&gt;.</p>
14114
14115
14116
14117
14118
14119 <hr>
14120 <h3><a name="315"></a>315. Bad "range" in list::unique complexity</h3>
14121 <p><b>Section:</b> 23.2.4.4 [list.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14122  <b>Submitter:</b> Andy Sawyer <b>Date:</b> 2001-05-01</p>
14123 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#list.ops">issues</a> in [list.ops].</p>
14124 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14125 <p><b>Discussion:</b></p>
14126 <p>
14127 23.2.4.4 [list.ops], Para 21 describes the complexity of
14128 list::unique as: "If the range (last - first) is not empty, exactly
14129 (last - first) -1 applications of the corresponding predicate,
14130 otherwise no applications of the predicate)".
14131 </p>
14132
14133 <p>
14134 "(last - first)" is not a range.
14135 </p>
14136
14137
14138 <p><b>Proposed resolution:</b></p>
14139 <p>
14140 Change the "range" from (last - first) to [first, last).
14141 </p>
14142
14143
14144
14145
14146 <hr>
14147 <h3><a name="316"></a>316. Vague text in Table 69</h3>
14148 <p><b>Section:</b> 23.1.4 [associative.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14149  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-05-04</p>
14150 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
14151 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14152 <p><b>Discussion:</b></p>
14153 <p>Table 69 says this about a_uniq.insert(t):</p>
14154
14155 <blockquote><p>
14156 inserts t if and only if there is no element in the container with key
14157 equivalent to the key of t. The bool component of the returned pair 
14158 indicates whether the insertion takes place and the iterator component of the
14159 pair points to the element with key equivalent to the key of t.
14160 </p></blockquote>
14161
14162 <p>The description should be more specific about exactly how the bool component
14163 indicates whether the insertion takes place.</p>
14164
14165
14166 <p><b>Proposed resolution:</b></p>
14167 <p>Change the text in question to</p>
14168
14169 <blockquote><p>
14170 ...The bool component of the returned pair is true if and only if the insertion
14171 takes place...
14172 </p></blockquote>
14173
14174
14175
14176
14177
14178 <hr>
14179 <h3><a name="317"></a>317. Instantiation vs. specialization of facets</h3>
14180 <p><b>Section:</b> 22 [localization] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14181  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-05-04</p>
14182 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#localization">issues</a> in [localization].</p>
14183 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14184 <p><b>Discussion:</b></p>
14185 <p>
14186 The localization section of the standard refers to specializations of
14187 the facet templates as instantiations even though the required facets
14188 are typically specialized rather than explicitly (or implicitly)
14189 instantiated. In the case of ctype&lt;char&gt; and
14190 ctype_byname&lt;char&gt; (and the wchar_t versions), these facets are
14191 actually required to be specialized. The terminology should be
14192 corrected to make it clear that the standard doesn't mandate explicit
14193 instantiation (the term specialization encompasses both explicit
14194 instantiations and specializations).
14195 </p>
14196
14197
14198 <p><b>Proposed resolution:</b></p>
14199 <p>
14200 In the following paragraphs, replace all occurrences of the word
14201 instantiation or instantiations with specialization or specializations,
14202 respectively:
14203 </p>
14204
14205 <blockquote><p>
14206 22.1.1.1.1, p4, Table 52, 22.2.1.1, p2, 22.2.1.5, p3, 22.2.1.5.1, p5,
14207 22.2.1.5.2, p10, 22.2.2, p2, 22.2.3.1, p1, 22.2.3.1.2, p1, p2 and p3, 
14208 22.2.4.1, p1, 22.2.4.1.2, p1, 22,2,5, p1, 22,2,6, p2, 22.2.6.3.2, p7, and
14209 Footnote 242.
14210 </p></blockquote>
14211
14212 <p>And change the text in 22.1.1.1.1, p4 from</p>
14213
14214 <blockquote><p>
14215     An implementation is required to provide those instantiations
14216     for facet templates identified as members of a category, and
14217     for those shown in Table 52:
14218 </p></blockquote>
14219
14220 <p>to</p>
14221
14222 <blockquote><p>
14223     An implementation is required to provide those specializations...
14224 </p></blockquote>
14225
14226 <p><i>[Nathan will review these changes, and will look for places where
14227 explicit specialization is necessary.]</i></p>
14228
14229
14230
14231
14232 <p><b>Rationale:</b></p>
14233 <p>This is a simple matter of outdated language.  The language to
14234 describe templates was clarified during the standardization process,
14235 but the wording in clause 22 was never updated to reflect that
14236 change.</p>
14237
14238
14239
14240
14241
14242
14243
14244 <hr>
14245 <h3><a name="318"></a>318. Misleading comment in definition of numpunct_byname</h3>
14246 <p><b>Section:</b> 22.2.3.2 [locale.numpunct.byname] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14247  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-05-12</p>
14248 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14249 <p><b>Discussion:</b></p>
14250 <p>The definition of the numpunct_byname template contains the following
14251 comment:</p>
14252
14253 <pre>    namespace std {
14254         template &lt;class charT&gt;
14255         class numpunct_byname : public numpunct&lt;charT&gt; {
14256     // this class is specialized for char and wchar_t.
14257         ...
14258 </pre>
14259
14260 <p>There is no documentation of the specializations and it seems
14261 conceivable that an implementation will not explicitly specialize the
14262 template at all, but simply provide the primary template.</p>
14263
14264
14265 <p><b>Proposed resolution:</b></p>
14266 <p>Remove the comment from the text in 22.2.3.2 and from the proposed
14267 resolution of library issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#228">228</a>.</p>
14268
14269
14270
14271
14272 <hr>
14273 <h3><a name="319"></a>319. Storage allocation wording confuses "Required behavior", "Requires"</h3>
14274 <p><b>Section:</b> 18.5.1.1 [new.delete.single], 18.5.1.2 [new.delete.array] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14275  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2001-05-15</p>
14276 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#new.delete.single">issues</a> in [new.delete.single].</p>
14277 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14278 <p><b>Discussion:</b></p>
14279 <p>The standard specifies 17.3.1.3 [structure.specifications] that "Required
14280 behavior" elements describe "the semantics of a function definition
14281 provided by either the implementation or a C++ program."</p>
14282
14283 <p>The standard specifies 17.3.1.3 [structure.specifications] that "Requires"
14284 elements describe "the preconditions for calling the function."</p>
14285
14286 <p>In the sections noted below, the current wording specifies
14287 "Required Behavior" for what are actually preconditions, and thus
14288 should be specified as "Requires".</p>
14289
14290
14291
14292 <p><b>Proposed resolution:</b></p>
14293
14294 <p>In 18.5.1.1 [new.delete.single] Para 12 Change:</p>
14295 <blockquote>
14296   <p>Required behavior: accept a value of ptr that is null or that was
14297   returned by an earlier call ...</p>
14298 </blockquote>
14299 <p>to:</p>
14300 <blockquote>
14301   <p>Requires: the value of ptr is null or the value returned by an
14302   earlier call ...</p>
14303 </blockquote>
14304
14305 <p>In 18.5.1.2 [new.delete.array] Para 11 Change:</p>
14306 <blockquote>
14307   <p>Required behavior: accept a value of ptr that is null or that was
14308   returned by an earlier call ...</p>
14309 </blockquote>
14310 <p>to:</p>
14311 <blockquote>
14312   <p>Requires: the value of ptr is null or the value returned by an
14313   earlier call ...</p>
14314 </blockquote>
14315
14316
14317
14318
14319
14320 <hr>
14321 <h3><a name="320"></a>320. list::assign overspecified</h3>
14322 <p><b>Section:</b> 23.2.4.1 [list.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14323  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2001-05-17</p>
14324 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#list.cons">issues</a> in [list.cons].</p>
14325 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14326 <p><b>Discussion:</b></p>
14327 <p>
14328 Section 23.2.4.1 [list.cons], paragraphs 6-8 specify that list assign (both forms) have
14329 the "effects" of a call to erase followed by a call to insert.
14330 </p>
14331
14332 <p>
14333 I would like to document that implementers have the freedom to implement 
14334 assign by other methods, as long as the end result is the same and the 
14335 exception guarantee is as good or better than the basic guarantee.
14336 </p>
14337
14338 <p>
14339 The motivation for this is to use T's assignment operator to recycle
14340 existing nodes in the list instead of erasing them and reallocating
14341 them with new values.  It is also worth noting that, with careful
14342 coding, most common cases of assign (everything but assignment with
14343 true input iterators) can elevate the exception safety to strong if
14344 T's assignment has a nothrow guarantee (with no extra memory cost).
14345 Metrowerks does this.  However I do not propose that this subtlety be
14346 standardized.  It is a QoI issue.  </p>
14347
14348 <p>Existing practise:
14349 Metrowerks and SGI recycle nodes, Dinkumware and Rogue Wave don't.
14350 </p>
14351
14352
14353 <p><b>Proposed resolution:</b></p>
14354 <p>Change 23.2.4.1 [list.cons]/7 from:</p>
14355
14356 <blockquote>
14357 <p>Effects:</p>
14358
14359 <pre>   erase(begin(), end());
14360    insert(begin(), first, last);
14361 </pre>
14362 </blockquote>
14363
14364 <p>to:</p>
14365
14366 <blockquote>
14367 <p>Effects: Replaces the contents of the list with the range [first, last).</p>
14368 </blockquote>
14369
14370 <p>In 23.1.3 [sequence.reqmts], in Table 67 (sequence requirements), 
14371 add two new rows:</p>
14372 <pre>      a.assign(i,j)     void      pre: i,j are not iterators into a.
14373                                   Replaces elements in a with a copy
14374                                   of [i, j).
14375
14376       a.assign(n,t)     void      pre: t is not a reference into a.
14377                                   Replaces elements in a with n copies
14378                                   of t.
14379 </pre>
14380
14381 <p>Change 23.2.4.1 [list.cons]/8 from:</p>
14382
14383 <blockquote>
14384 <p>Effects:</p>
14385 <pre>   erase(begin(), end());
14386    insert(begin(), n, t);
14387 </pre>
14388 </blockquote>
14389 <p>to:</p>
14390
14391 <blockquote>
14392 <p>Effects: Replaces the contents of the list with n copies of t.</p>
14393 </blockquote>
14394
14395 <p><i>[Redmond: Proposed resolution was changed slightly.  Previous
14396 version made explicit statement about exception safety, which wasn't
14397 consistent with the way exception safety is expressed elsewhere.
14398 Also, the change in the sequence requirements is new.  Without that
14399 change, the proposed resolution would have required that assignment of
14400 a subrange would have to work.  That too would have been
14401 overspecification; it would effectively mandate that assignment use a
14402 temporary.  Howard provided wording.
14403 ]</i></p>
14404
14405
14406 <p><i>[Curaçao: Made editorial improvement in wording; changed
14407 "Replaces elements in a with copies of elements in [i, j)."
14408 with "Replaces the elements of a with a copy of [i, j)."
14409 Changes not deemed serious enough to requre rereview.]</i></p>
14410
14411
14412
14413
14414
14415
14416
14417 <hr>
14418 <h3><a name="321"></a>321. Typo in num_get</h3>
14419 <p><b>Section:</b> 22.2.2.1.2 [facet.num.get.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14420  <b>Submitter:</b> Kevin Djang <b>Date:</b> 2001-05-17</p>
14421 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#facet.num.get.virtuals">active issues</a> in [facet.num.get.virtuals].</p>
14422 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.virtuals">issues</a> in [facet.num.get.virtuals].</p>
14423 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14424 <p><b>Discussion:</b></p>
14425 <p>
14426 Section 22.2.2.1.2 at p7 states that "A length specifier is added to
14427 the conversion function, if needed, as indicated in Table 56."
14428 However, Table 56 uses the term "length modifier", not "length
14429 specifier".
14430 </p>
14431
14432
14433 <p><b>Proposed resolution:</b></p>
14434 <p>
14435 In 22.2.2.1.2 at p7, change the text "A length specifier is added ..."
14436 to be "A length modifier is added ..."
14437 </p>
14438
14439
14440 <p><b>Rationale:</b></p>
14441 <p>C uses the term "length modifier".  We should be consistent.</p>
14442
14443
14444
14445
14446
14447
14448 <hr>
14449 <h3><a name="322"></a>322. iterator and const_iterator should have the same value type</h3>
14450 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14451  <b>Submitter:</b> Matt Austern <b>Date:</b> 2001-05-17</p>
14452 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
14453 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
14454 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14455 <p><b>Discussion:</b></p>
14456 <p>
14457 It's widely assumed that, if X is a container,
14458 iterator_traits&lt;X::iterator&gt;::value_type and
14459 iterator_traits&lt;X::const_iterator&gt;::value_type should both be
14460 X::value_type.  However, this is nowhere stated.  The language in
14461 Table 65 is not precise about the iterators' value types (it predates
14462 iterator_traits), and could even be interpreted as saying that
14463 iterator_traits&lt;X::const_iterator&gt;::value_type should be "const
14464 X::value_type".
14465 </p>
14466
14467 <p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#279">279</a>.</p>
14468
14469
14470 <p><b>Proposed resolution:</b></p>
14471 <p>In Table 65 ("Container Requirements"), change the return type for
14472 X::iterator to "iterator type whose value type is T".  Change the
14473 return type for X::const_iterator to "constant iterator type whose
14474 value type is T".</p>
14475
14476
14477 <p><b>Rationale:</b></p>
14478 <p>
14479 This belongs as a container requirement, rather than an iterator
14480 requirement, because the whole notion of iterator/const_iterator
14481 pairs is specific to containers' iterator.
14482 </p>
14483 <p>
14484 It is existing practice that (for example) 
14485 iterator_traits&lt;list&lt;int&gt;::const_iterator&gt;::value_type
14486 is "int", rather than "const int".  This is consistent with
14487 the way that const pointers are handled: the standard already 
14488 requires that iterator_traits&lt;const int*&gt;::value_type is int.
14489 </p>
14490
14491
14492
14493
14494
14495 <hr>
14496 <h3><a name="324"></a>324. Do output iterators have value types?</h3>
14497 <p><b>Section:</b> 24.1.2 [output.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14498  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2001-06-07</p>
14499 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#output.iterators">issues</a> in [output.iterators].</p>
14500 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14501 <p><b>Discussion:</b></p>
14502
14503 <p>Table 73 suggests that output iterators have value types.  It 
14504 requires the expression "*a = t".  Additionally, although Table 73
14505 never lists "a = t" or "X(a) = t" in the "expressions" column, it
14506 contains a note saying that "a = t" and "X(a) = t" have equivalent
14507 (but nowhere specified!) semantics.</p>
14508
14509 <p>According to 24.1/9, t is supposed to be "a value of value type
14510 T":</p>
14511
14512     <blockquote><p>
14513     In the following sections, a and b denote values of X, n denotes a
14514     value of the difference type Distance, u, tmp, and m denote
14515     identifiers, r denotes a value of X&amp;, t denotes a value of
14516     value type T.
14517     </p></blockquote>
14518
14519 <p>Two other parts of the standard that are relevant to whether
14520 output iterators have value types:</p>
14521
14522 <ul>
14523     <li>24.1/1 says "All iterators i support the expression *i,
14524     resulting in a value of some class, enumeration, or built-in type
14525     T, called the value type of the iterator".</li>
14526
14527     <li>
14528     24.3.1/1, which says "In the case of an output iterator, the types
14529     iterator_traits&lt;Iterator&gt;::difference_type
14530     iterator_traits&lt;Iterator&gt;::value_type are both defined as void."
14531     </li>
14532 </ul>
14533
14534 <p>The first of these passages suggests that "*i" is supposed to
14535 return a useful value, which contradicts the note in 24.1.2/2 saying
14536 that the only valid use of "*i" for output iterators is in an
14537 expression of the form "*i = t".  The second of these passages appears
14538 to contradict Table 73, because it suggests that "*i"'s return value
14539 should be void.  The second passage is also broken in the case of a an
14540 iterator type, like non-const pointers, that satisfies both the output
14541 iterator requirements and the forward iterator requirements.</p>
14542
14543 <p>What should the standard say about <tt>*i</tt>'s return value when
14544 i is an output iterator, and what should it say about that t is in the
14545 expression "*i = t"?  Finally, should the standard say anything about
14546 output iterators' pointer and reference types?</p>
14547
14548
14549
14550 <p><b>Proposed resolution:</b></p>
14551 <p>24.1 p1, change</p>
14552
14553 <blockquote>
14554 <p>All iterators <tt>i</tt> support the expression <tt>*i</tt>, resulting
14555 in a value of some class, enumeration, or built-in type <tt>T</tt>,
14556 called the value type of the iterator.</p>
14557 </blockquote>
14558
14559 <p>to</p>
14560
14561 <blockquote>
14562 <p>All input iterators <tt>i</tt> support the expression <tt>*i</tt>,
14563 resulting in a value of some class, enumeration, or built-in type
14564 <tt>T</tt>, called the value type of the iterator. All output
14565 iterators support the expression <tt>*i = o</tt> where <tt>o</tt> is a
14566 value of some type that is in the set of types that are <i>writable</i> to
14567 the particular iterator type of <tt>i</tt>.
14568 </p>
14569 </blockquote>
14570
14571 <p>24.1 p9, add</p>
14572
14573 <blockquote>
14574 <p><tt>o</tt> denotes a value of some type that is writable to the
14575 output iterator.
14576 </p>
14577 </blockquote>
14578
14579 <p>Table 73, change</p>
14580
14581 <blockquote>
14582 <pre>*a = t
14583 </pre>
14584 </blockquote>
14585
14586 <p>to</p>
14587
14588 <blockquote>
14589 <pre>*r = o
14590 </pre>
14591 </blockquote>
14592
14593 <p>and change</p>
14594
14595 <blockquote>
14596 <pre>*r++ = t
14597 </pre>
14598 </blockquote>
14599
14600 <p>to</p>
14601
14602 <blockquote>
14603 <pre>*r++ = o
14604 </pre>
14605 </blockquote>
14606
14607 <p><i>[post-Redmond: Jeremy provided wording]</i></p>
14608
14609
14610
14611
14612 <p><b>Rationale:</b></p>
14613 <p>The LWG considered two options: change all of the language that
14614 seems to imply that output iterators have value types, thus making it
14615 clear that output iterators have no value types, or else define value
14616 types for output iterator consistently.  The LWG chose the former
14617 option, because it seems clear that output iterators were never
14618 intended to have value types.  This was a deliberate design decision,
14619 and any language suggesting otherwise is simply a mistake.</p>
14620
14621 <p>A future revision of the standard may wish to revisit this design
14622 decision.</p>
14623
14624
14625
14626
14627
14628 <hr>
14629 <h3><a name="325"></a>325. Misleading text in moneypunct&lt;&gt;::do_grouping</h3>
14630 <p><b>Section:</b> 22.2.6.3.2 [locale.moneypunct.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14631  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-07-02</p>
14632 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.moneypunct.virtuals">issues</a> in [locale.moneypunct.virtuals].</p>
14633 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14634 <p><b>Discussion:</b></p>
14635 <p>The Returns clause in 22.2.6.3.2, p3 says about
14636 moneypunct&lt;charT&gt;::do_grouping()
14637 </p>
14638
14639 <blockquote><p>
14640     Returns: A pattern defined identically as the result of
14641     numpunct&lt;charT&gt;::do_grouping().241)
14642 </p></blockquote>
14643
14644 <p>Footnote 241 then reads</p>
14645
14646 <blockquote><p>
14647     This is most commonly the value "\003" (not "3").
14648 </p></blockquote>
14649
14650 <p>
14651 The returns clause seems to imply that the two member functions must
14652 return an identical value which in reality may or may not be true,
14653 since the facets are usually implemented in terms of struct std::lconv
14654 and return the value of the grouping and mon_grouping, respectively.
14655 The footnote also implies that the member function of the moneypunct
14656 facet (rather than the overridden virtual functions in moneypunct_byname)
14657 most commonly return "\003", which contradicts the C standard which
14658 specifies the value of "" for the (most common) C locale.
14659 </p>
14660
14661
14662
14663 <p><b>Proposed resolution:</b></p>
14664 <p>Replace the text in Returns clause in 22.2.6.3.2, p3 with the following:</p>
14665
14666 <blockquote><p>
14667     Returns: A pattern defined identically as, but not necessarily
14668     equal to, the result of numpunct&lt;charT&gt;::do_grouping().241)
14669 </p></blockquote>
14670
14671 <p>and replace the text in Footnote 241 with the following:</p>
14672
14673 <blockquote><p>
14674     To specify grouping by 3s the value is "\003", not "3".
14675 </p></blockquote>
14676
14677
14678 <p><b>Rationale:</b></p>
14679 <p>
14680 The fundamental problem is that the description of the locale facet
14681 virtuals serves two purposes: describing the behavior of the base
14682 class, and describing the meaning of and constraints on the behavior
14683 in arbitrary derived classes.  The new wording makes that separation a
14684 little bit clearer.  The footnote (which is nonnormative) is not
14685 supposed to say what the grouping is in the "C" locale or in any other
14686 locale. It is just a reminder that the values are interpreted as small
14687 integers, not ASCII characters.
14688 </p>
14689
14690
14691
14692
14693 <hr>
14694 <h3><a name="327"></a>327. Typo in time_get facet in table 52</h3>
14695 <p><b>Section:</b> 22.1.1.1.1 [locale.category] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14696  <b>Submitter:</b> Tiki Wan <b>Date:</b> 2001-07-06</p>
14697 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.category">issues</a> in [locale.category].</p>
14698 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14699 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#447">447</a></p>
14700 <p><b>Discussion:</b></p>
14701 <p>The <tt>wchar_t</tt> versions of <tt>time_get</tt> and
14702 <tt>time_get_byname</tt> are listed incorrectly in table 52,
14703 required instantiations.  In both cases the second template
14704 parameter is given as OutputIterator.  It should instead be
14705 InputIterator, since these are input facets.</p>
14706
14707
14708 <p><b>Proposed resolution:</b></p>
14709 <p>
14710 In table 52, required instantiations, in 
14711 22.1.1.1.1 [locale.category], change</p>
14712 <pre>    time_get&lt;wchar_t, OutputIterator&gt;
14713     time_get_byname&lt;wchar_t, OutputIterator&gt;
14714 </pre>
14715 <p>to</p>
14716 <pre>    time_get&lt;wchar_t, InputIterator&gt;
14717     time_get_byname&lt;wchar_t, InputIterator&gt;
14718 </pre>
14719
14720 <p><i>[Redmond: Very minor change in proposed resolution.  Original had
14721 a typo, wchart instead of wchar_t.]</i></p>
14722
14723
14724
14725
14726
14727
14728 <hr>
14729 <h3><a name="328"></a>328. Bad sprintf format modifier in money_put&lt;&gt;::do_put()</h3>
14730 <p><b>Section:</b> 22.2.6.2.2 [locale.money.put.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14731  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-07-07</p>
14732 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14733 <p><b>Discussion:</b></p>
14734 <p>The sprintf format string , "%.01f" (that's the digit one), in the
14735 description of the do_put() member functions of the money_put facet in
14736 22.2.6.2.2, p1 is incorrect. First, the f format specifier is wrong
14737 for values of type long double, and second, the precision of 01
14738 doesn't seem to make sense. What was most likely intended was
14739 "%.0Lf"., that is a precision of zero followed by the L length
14740 modifier.</p>
14741
14742
14743 <p><b>Proposed resolution:</b></p>
14744 <p>Change the format string to "%.0Lf".</p>
14745
14746
14747 <p><b>Rationale:</b></p><p>Fixes an obvious typo</p>
14748
14749
14750
14751
14752 <hr>
14753 <h3><a name="329"></a>329. vector capacity, reserve and reallocation</h3>
14754 <p><b>Section:</b> 23.2.6.2 [vector.capacity], 23.2.6.4 [vector.modifiers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14755  <b>Submitter:</b> Anthony Williams <b>Date:</b> 2001-07-13</p>
14756 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector.capacity">issues</a> in [vector.capacity].</p>
14757 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14758 <p><b>Discussion:</b></p>
14759 <p>
14760 There is an apparent contradiction about which circumstances can cause
14761 a reallocation of a vector in Section 23.2.6.2 [vector.capacity] and
14762 section 23.2.6.4 [vector.modifiers].
14763 </p>
14764
14765 <p>23.2.6.2 [vector.capacity],p5 says:</p>
14766 <blockquote><p>
14767 Notes: Reallocation invalidates all the references, pointers, and iterators
14768 referring to the elements in the sequence. It is guaranteed that no
14769 reallocation takes place during insertions that happen after a call to
14770 reserve() until the time when an insertion would make the size of the vector
14771 greater than the size specified in the most recent call to reserve().
14772 </p></blockquote>
14773
14774 <p>Which implies if I do</p>
14775
14776 <pre>  std::vector&lt;int&gt; vec;
14777   vec.reserve(23);
14778   vec.reserve(0);
14779   vec.insert(vec.end(),1);
14780 </pre>
14781
14782 <p>then the implementation may reallocate the vector for the insert,
14783 as the size specified in the previous call to reserve was zero.</p>
14784
14785 <p>However, the previous paragraphs (23.2.6.2 [vector.capacity], p1-2) state:</p>
14786 <blockquote>
14787 <p>
14788 (capacity) Returns: The total number of elements the vector
14789 can hold without requiring reallocation
14790 </p>
14791 <p>
14792 ...After reserve(), capacity() is greater or equal to the
14793 argument of reserve if reallocation happens; and equal to the previous value
14794 of capacity() otherwise...
14795 </p>
14796 </blockquote>
14797
14798 <p>
14799 This implies that vec.capacity() is still 23, and so the insert()
14800 should not require a reallocation, as vec.size() is 0. This is backed
14801 up by 23.2.6.4 [vector.modifiers], p1:
14802 </p>
14803 <blockquote><p>
14804 (insert) Notes: Causes reallocation if the new size is greater than the old
14805 capacity.
14806 </p></blockquote>
14807
14808 <p>
14809 Though this doesn't rule out reallocation if the new size is less
14810 than the old capacity, I think the intent is clear.
14811 </p>
14812
14813
14814
14815 <p><b>Proposed resolution:</b></p>
14816 <p>Change the wording of 23.2.6.2 [vector.capacity] paragraph 5 to:</p>
14817
14818 <blockquote><p>
14819 Notes: Reallocation invalidates all the references, pointers, and
14820 iterators referring to the elements in the sequence. It is guaranteed
14821 that no reallocation takes place during insertions that happen after a
14822 call to reserve() until the time when an insertion would make the size
14823 of the vector greater than the value of capacity().
14824 </p></blockquote>
14825
14826 <p><i>[Redmond: original proposed resolution was modified slightly.  In
14827 the original, the guarantee was that there would be no reallocation
14828 until the size would be greater than the value of capacity() after the
14829 most recent call to reserve().  The LWG did not believe that the
14830 "after the most recent call to reserve()" added any useful
14831 information.]</i></p>
14832
14833
14834
14835
14836 <p><b>Rationale:</b></p>
14837 <p>There was general agreement that, when reserve() is called twice in
14838 succession and the argument to the second invocation is smaller than
14839 the argument to the first, the intent was for the second invocation to
14840 have no effect.  Wording implying that such cases have an effect on
14841 reallocation guarantees was inadvertant.</p>
14842
14843
14844
14845
14846
14847 <hr>
14848 <h3><a name="331"></a>331. bad declaration of destructor for ios_base::failure</h3>
14849 <p><b>Section:</b> 27.4.2.1.1 [ios::failure] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14850  <b>Submitter:</b> PremAnand M. Rao <b>Date:</b> 2001-08-23</p>
14851 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios::failure">issues</a> in [ios::failure].</p>
14852 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14853 <p><b>Discussion:</b></p>
14854 <p>
14855 With the change in 17.4.4.9 [res.on.exception.handling] to state
14856    "An implementation may strengthen the exception-specification for a 
14857     non-virtual function by removing listed exceptions."
14858 (issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#119">119</a>)
14859 and the following declaration of ~failure() in ios_base::failure
14860 </p>
14861 <pre>    namespace std {
14862        class ios_base::failure : public exception {
14863        public:
14864            ...
14865            virtual ~failure();
14866            ...
14867        };
14868      }
14869 </pre>
14870 <p>the class failure cannot be implemented since in 18.6.1 [type.info] the destructor of class exception has an empty
14871 exception specification:</p>
14872 <pre>    namespace std {
14873        class exception {
14874        public:
14875          ...
14876          virtual ~exception() throw();
14877          ...
14878        };
14879      }
14880 </pre>
14881
14882
14883 <p><b>Proposed resolution:</b></p>
14884 <p>Remove the declaration of ~failure().</p>
14885
14886
14887 <p><b>Rationale:</b></p>
14888 <p>The proposed resolution is consistent with the way that destructors
14889 of other classes derived from <tt>exception</tt> are handled.</p>
14890
14891
14892
14893
14894
14895
14896
14897 <hr>
14898 <h3><a name="333"></a>333. does endl imply synchronization with the device?</h3>
14899 <p><b>Section:</b> 27.6.2.8 [ostream.manip] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14900  <b>Submitter:</b> PremAnand M. Rao <b>Date:</b> 2001-08-27</p>
14901 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14902 <p><b>Discussion:</b></p>
14903 <p>A footnote in 27.6.2.8 [ostream.manip] states:</p>
14904 <blockquote><p>
14905     [Footnote: The effect of executing cout &lt;&lt; endl is to insert a 
14906      newline character in the output sequence controlled by cout, then 
14907      synchronize it with any external file with which it might be 
14908      associated. --- end foonote]
14909 </p></blockquote>
14910
14911 <p>
14912 Does the term "file" here refer to the external device?
14913 This leads to some implementation ambiguity on systems with fully 
14914 buffered files where a newline does not cause a flush to the device.
14915 </p>
14916
14917 <p>
14918 Choosing to sync with the device leads to significant performance
14919 penalties for each call to endl, while not sync-ing leads to
14920 errors under special circumstances.
14921 </p>
14922
14923 <p>
14924 I could not find any other statement that explicitly defined
14925 the behavior one way or the other.
14926 </p>
14927
14928
14929 <p><b>Proposed resolution:</b></p>
14930 <p>Remove footnote 300 from section 27.6.2.8 [ostream.manip].</p>
14931
14932
14933 <p><b>Rationale:</b></p>
14934 <p>We already have normative text saying what <tt>endl</tt> does: it
14935 inserts a newline character and calls <tt>flush</tt>.  This footnote
14936 is at best redundant, at worst (as this issue says) misleading,
14937 because it appears to make promises about what <tt>flush</tt>
14938 does.</p>
14939
14940
14941
14942
14943
14944
14945
14946 <hr>
14947 <h3><a name="334"></a>334. map::operator[] specification forces inefficient implementation</h3>
14948 <p><b>Section:</b> 23.3.1.2 [map.access] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
14949  <b>Submitter:</b> Andrea Griffini <b>Date:</b> 2001-09-02</p>
14950 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#map.access">issues</a> in [map.access].</p>
14951 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
14952 <p><b>Discussion:</b></p>
14953 <p>
14954 The current standard describes map::operator[] using a
14955 code example. That code example is however quite
14956 inefficient because it requires several useless copies
14957 of both the passed key_type value and of default
14958 constructed mapped_type instances.
14959 My opinion is that was not meant by the comitee to
14960 require all those temporary copies. 
14961 </p>
14962
14963 <p>Currently map::operator[] behaviour is specified as: </p>
14964 <pre>  Returns:
14965     (*((insert(make_pair(x, T()))).first)).second.
14966 </pre>
14967   
14968 <p>
14969 This specification however uses make_pair that is a
14970 template function of which parameters in this case
14971 will be deduced being of type const key_type&amp; and
14972 const T&amp;. This will create a pair&lt;key_type,T&gt; that
14973 isn't the correct type expected by map::insert so
14974 another copy will be required using the template
14975 conversion constructor available in pair to build
14976 the required pair&lt;const key_type,T&gt; instance.
14977 </p>
14978
14979 <p>If we consider calling of key_type copy constructor
14980 and mapped_type default constructor and copy
14981 constructor as observable behaviour (as I think we
14982 should) then the standard is in this place requiring
14983 two copies of a key_type element plus a default
14984 construction and two copy construction of a mapped_type
14985 (supposing the addressed element is already present
14986 in the map; otherwise at least another copy
14987 construction for each type). 
14988 </p>
14989
14990 <p>A simple (half) solution would be replacing the description with:</p>
14991 <pre>  Returns:
14992     (*((insert(value_type(x, T()))).first)).second.
14993 </pre>
14994
14995 <p>This will remove the wrong typed pair construction that
14996 requires one extra copy of both key and value.</p>
14997
14998 <p>However still the using of map::insert requires temporary
14999 objects while the operation, from a logical point of view,
15000 doesn't require any. </p>
15001
15002 <p>I think that a better solution would be leaving free an
15003 implementer to use a different approach than map::insert
15004 that, because of its interface, forces default constructed
15005 temporaries and copies in this case.
15006 The best solution in my opinion would be just requiring
15007 map::operator[] to return a reference to the mapped_type
15008 part of the contained element creating a default element
15009 with the specified key if no such an element is already
15010 present in the container. Also a logarithmic complexity
15011 requirement should be specified for the operation.
15012 </p>
15013
15014 <p>
15015 This would allow library implementers to write alternative
15016 implementations not using map::insert and reaching optimal
15017 performance in both cases of the addressed element being
15018 present or absent from the map (no temporaries at all and
15019 just the creation of a new pair inside the container if
15020 the element isn't present).
15021 Some implementer has already taken this option but I think
15022 that the current wording of the standard rules that as
15023 non-conforming. 
15024 </p>
15025
15026
15027
15028 <p><b>Proposed resolution:</b></p>
15029
15030 <p>
15031 Replace 23.3.1.2 [map.access] paragraph 1 with
15032 </p>
15033 <blockquote>
15034 <p>
15035 -1- Effects:  If there is no key equivalent to x in the map, inserts 
15036 value_type(x, T()) into the map.
15037 </p>
15038 <p>
15039 -2- Returns: A reference to the mapped_type corresponding to x in *this.
15040 </p>
15041 <p>
15042 -3- Complexity: logarithmic.
15043 </p>
15044 </blockquote>
15045
15046 <p><i>[This is the second option mentioned above.  Howard provided
15047 wording.  We may also wish to have a blanket statement somewhere in
15048 clause 17 saying that we do not intend the semantics of sample code
15049 fragments to be interpreted as specifing exactly how many copies are
15050 made.  See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#98">98</a> for a similar problem.]</i></p>
15051
15052
15053
15054
15055 <p><b>Rationale:</b></p>
15056 <p>
15057 This is the second solution described above; as noted, it is
15058 consistent with existing practice.
15059 </p>
15060
15061 <p>Note that we now need to specify the complexity explicitly, because
15062 we are no longer defining <tt>operator[]</tt> in terms of
15063 <tt>insert</tt>.</p>
15064
15065
15066
15067
15068
15069 <hr>
15070 <h3><a name="335"></a>335. minor issue with char_traits, table 37</h3>
15071 <p><b>Section:</b> 21.1.1 [char.traits.require] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15072  <b>Submitter:</b> Andy Sawyer <b>Date:</b> 2001-09-06</p>
15073 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15074 <p><b>Discussion:</b></p>
15075 <p>
15076 Table 37, in 21.1.1 [char.traits.require], descibes char_traits::assign
15077 as:
15078 </p>
15079 <pre>  X::assign(c,d)   assigns c = d.
15080 </pre>
15081
15082 <p>And para 1 says:</p>
15083
15084 <blockquote><p>
15085  [...] c and d denote values of type CharT [...]
15086 </p></blockquote>
15087
15088 <p>
15089 Naturally, if c and d are <i>values</i>, then the assignment is
15090 (effectively) meaningless. It's clearly intended that (in the case of
15091 assign, at least), 'c' is intended to be a reference type.
15092 </p>
15093
15094 <p>I did a quick survey of the four implementations I happened to have
15095 lying around, and sure enough they all have signatures:</p>
15096 <pre>    assign( charT&amp;, const charT&amp; );
15097 </pre>
15098
15099 <p>(or the equivalent). It's also described this way in Nico's book.
15100 (Not to mention the synopses of char_traits&lt;char&gt; in 21.1.3.1
15101 and char_traits&lt;wchar_t&gt; in 21.1.3.2...)
15102 </p>
15103
15104
15105 <p><b>Proposed resolution:</b></p>
15106 <p>Add the following to 21.1.1 para 1:</p>
15107 <blockquote><p>
15108  r denotes an lvalue of CharT
15109 </p></blockquote>
15110
15111 <p>and change the description of assign in the table to:</p>
15112 <pre>  X::assign(r,d)   assigns r = d
15113 </pre>
15114
15115
15116
15117
15118
15119 <hr>
15120 <h3><a name="336"></a>336. Clause 17 lack of references to deprecated headers</h3>
15121 <p><b>Section:</b> 17 [library] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15122  <b>Submitter:</b> Detlef Vollmann <b>Date:</b> 2001-09-05</p>
15123 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#library">issues</a> in [library].</p>
15124 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15125 <p><b>Discussion:</b></p>
15126 <p>From c++std-edit-873:</p>
15127
15128 <p>17.4.1.2 [headers], Table 11.  In this table, the header
15129 &lt;strstream&gt; is missing.</p>
15130
15131 <p>This shows a general problem: The whole clause 17 refers quite
15132 often to clauses 18 through 27, but D.7 is also a part of the standard
15133 library (though a deprecated one).</p>
15134
15135
15136
15137 <p><b>Proposed resolution:</b></p>
15138
15139 <p>To 17.4.1.2 [headers] Table 11, C++ Library Headers, add
15140 "&lt;strstream&gt;".</p>
15141
15142 <p>In the following places, change "clauses 17 through 27" to "clauses
15143 17 through 27 and Annex D":</p>
15144
15145 <ul>
15146 <li>1.2 [intro.refs] Normative references/1/footnote 1</li>
15147 <li>1.3 [intro.defs] Definitions/1</li>
15148 <li>7 [dcl.dcl] Library introduction/9</li>
15149 <li>17.3 [description] Method of description (Informative)/1</li>
15150 <li>17.3.2.1.3 [character.seq] Character sequences/1/bullet 2</li>
15151 <li>17.3.2.2 [functions.within.classes] Functions within classes/1</li>
15152 <li>17.3.2.3 [objects.within.classes] Private members/1/(2 places)</li>
15153 <li>17.4 [requirements] Library-wide requirements/1</li>
15154 <li>17.4.1.2 [headers] Headers/4</li>
15155 <li>17.4.3.5 [replacement.functions] Replacement functions/1</li>
15156 <li>17.4.4.3 [global.functions] Global or non-member functions/2</li>
15157 <li>17.4.4.7 [protection.within.classes] Protection within classes/1</li>
15158 </ul>
15159
15160
15161
15162
15163
15164
15165
15166 <hr>
15167 <h3><a name="337"></a>337. replace_copy_if's template parameter should be InputIterator</h3>
15168 <p><b>Section:</b> 25.2.5 [alg.replace] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15169  <b>Submitter:</b> Detlef Vollmann <b>Date:</b> 2001-09-07</p>
15170 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.replace">issues</a> in [alg.replace].</p>
15171 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15172 <p><b>Discussion:</b></p>
15173 <p>From c++std-edit-876:</p>
15174
15175 <p>
15176 In section 25.2.5 [alg.replace] before p4: The name of the first
15177 parameter of template replace_copy_if should be "InputIterator"
15178 instead of "Iterator".  According to 17.3.2.1 [type.descriptions] p1 the
15179 parameter name conveys real normative meaning.
15180 </p>
15181
15182
15183 <p><b>Proposed resolution:</b></p>
15184 <p>Change <tt>Iterator</tt> to <tt>InputIterator</tt>.</p>
15185
15186
15187
15188
15189
15190 <hr>
15191 <h3><a name="338"></a>338.  is whitespace allowed between `-' and a digit?</h3>
15192 <p><b>Section:</b> 22.2 [locale.categories] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15193  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-09-17</p>
15194 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#locale.categories">active issues</a> in [locale.categories].</p>
15195 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.categories">issues</a> in [locale.categories].</p>
15196 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15197 <p><b>Discussion:</b></p>
15198 <p>
15199 From Stage 2 processing in 22.2.2.1.2 [facet.num.get.virtuals], p8 and 9 (the
15200 original text or the text corrected by the proposed resolution of
15201 issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#221">221</a>) it seems clear that no whitespace is allowed
15202 within a number, but 22.2.3.1 [locale.numpunct], p2, which gives the
15203 format for integer and floating point values, says that whitespace is
15204 optional between a plusminus and a sign.
15205 </p>
15206
15207 <p>
15208 The text needs to be clarified to either consistently allow or
15209 disallow whitespace between a plusminus and a sign. It might be
15210 worthwhile to consider the fact that the C library stdio facility does
15211 not permit whitespace embedded in numbers and neither does the C or
15212 C++ core language (the syntax of integer-literals is given in 2.13.1
15213 [lex.icon], that of floating-point-literals in 2.13.3 [lex.fcon] of the
15214 C++ standard).
15215 </p>
15216
15217
15218 <p><b>Proposed resolution:</b></p>
15219 <p>Change the first part of 22.2.3.1 [locale.numpunct] paragraph 2 from:</p>
15220 <blockquote>
15221 <p>
15222 The syntax for number formats is as follows, where <tt>digit</tt>
15223 represents the radix set specified by the <tt>fmtflags</tt> argument
15224 value, <tt>whitespace</tt> is as determined by the facet
15225 <tt>ctype&lt;charT&gt;</tt> (22.2.1.1), and <tt>thousands-sep</tt> and
15226 <tt>decimal-point</tt> are the results of corresponding
15227 <tt>numpunct&lt;charT&gt;</tt> members.  Integer values have the
15228 format:
15229 </p>
15230 <pre>  integer   ::= [sign] units
15231   sign      ::= plusminus [whitespace]
15232   plusminus ::= '+' | '-'
15233   units     ::= digits [thousands-sep units]
15234   digits    ::= digit [digits]
15235 </pre>
15236 </blockquote>
15237 <p>to:</p>
15238 <blockquote>
15239 <p>
15240 The syntax for number formats is as follows, where <tt>digit</tt>
15241 represents the radix set specified by the <tt>fmtflags</tt> argument
15242 value, and <tt>thousands-sep</tt> and <tt>decimal-point</tt> are the
15243 results of corresponding <tt>numpunct&lt;charT&gt;</tt> members.
15244 Integer values have the format:
15245 </p>
15246 <pre>  integer   ::= [sign] units
15247   sign      ::= plusminus
15248   plusminus ::= '+' | '-'
15249   units     ::= digits [thousands-sep units]
15250   digits    ::= digit [digits]
15251 </pre>
15252 </blockquote>
15253
15254
15255 <p><b>Rationale:</b></p>
15256 <p>It's not clear whether the format described in 22.2.3.1 [locale.numpunct] paragraph 2 has any normative weight: nothing in the
15257 standard says how, or whether, it's used.  However, there's no reason
15258 for it to differ gratuitously from the very specific description of
15259 numeric processing in 22.2.2.1.2 [facet.num.get.virtuals].  The proposed
15260 resolution removes all mention of "whitespace" from that format.</p>
15261
15262
15263
15264
15265
15266 <hr>
15267 <h3><a name="339"></a>339. definition of bitmask type restricted to clause 27</h3>
15268 <p><b>Section:</b> 22.2.1 [category.ctype], 17.3.2.1.2 [bitmask.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15269  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-09-17</p>
15270 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#category.ctype">issues</a> in [category.ctype].</p>
15271 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15272 <p><b>Discussion:</b></p>
15273 <p>The ctype_category::mask type is declared to be an enum in 22.2.1
15274 [category.ctype] with p1 then stating that it is a bitmask type, most
15275 likely referring to the definition of bitmask type in 17.3.2.1.2
15276 [bitmask.types], p1. However, the said definition only applies to
15277 clause 27, making the reference in 22.2.1 somewhat dubious.
15278 </p>
15279
15280
15281 <p><b>Proposed resolution:</b></p>
15282 <p>Clarify 17.3.2.1.2, p1 by changing the current text from</p>
15283     <blockquote><p>
15284     Several types defined in clause 27 are bitmask types. Each bitmask type
15285     can be implemented as an enumerated type that overloads certain operators,
15286     as an integer type, or as a bitset (23.3.5 [template.bitset]).
15287     </p></blockquote>
15288 <p>to read</p>
15289     <blockquote><p>
15290     Several types defined in clauses lib.language.support through 
15291     lib.input.output and Annex D are bitmask types. Each bitmask type can
15292     be implemented as an enumerated type that overloads certain operators,
15293     as an integer  type, or as a bitset (lib.template.bitset).
15294     </p></blockquote>
15295
15296 <p>
15297 Additionally, change the definition in 22.2.1 to adopt the same
15298 convention as in clause 27 by replacing the existing text with the
15299 following (note, in particluar, the cross-reference to 17.3.2.1.2 in
15300 22.2.1, p1):
15301 </p>
15302
15303 <blockquote>
15304 <p>22.2.1 The ctype category [lib.category.ctype]</p>
15305 <pre>namespace std {
15306     class ctype_base {
15307     public:
15308         typedef <b><i>T</i></b> mask;
15309
15310         // numeric values are for exposition only.
15311         static const mask space = 1 &lt;&lt; 0;
15312         static const mask print = 1 &lt;&lt; 1;
15313         static const mask cntrl = 1 &lt;&lt; 2;
15314         static const mask upper = 1 &lt;&lt; 3;
15315         static const mask lower = 1 &lt;&lt; 4;
15316         static const mask alpha = 1 &lt;&lt; 5;
15317         static const mask digit = 1 &lt;&lt; 6;
15318         static const mask punct = 1 &lt;&lt; 7;
15319         static const mask xdigit = 1 &lt;&lt; 8;
15320         static const mask alnum = alpha | digit;
15321         static const mask graph = alnum | punct;
15322     };
15323 }
15324 </pre>
15325
15326 <p>The type <tt>mask</tt> is a bitmask type (17.3.2.1.2 [bitmask.types]).</p>
15327 </blockquote>
15328
15329 <p><i>[Curaçao: The LWG notes that T above should be bold-italics to be
15330 consistent with the rest of the standard.]</i></p>
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340 <hr>
15341 <h3><a name="340"></a>340. interpretation of <tt>has_facet&lt;Facet&gt;(loc)</tt></h3>
15342 <p><b>Section:</b> 22.1.1.1.1 [locale.category] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15343  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-09-18</p>
15344 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.category">issues</a> in [locale.category].</p>
15345 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15346 <p><b>Discussion:</b></p>
15347 <p>
15348 It's unclear whether 22.1.1.1.1, p3 says that
15349 <tt>has_facet&lt;Facet&gt;(loc)</tt> returns true for any <tt>Facet</tt>
15350 from Table 51 or whether it includes Table 52 as well:
15351 </p>
15352
15353 <blockquote><p>
15354 For any locale <tt>loc</tt> either constructed, or returned by
15355 locale::classic(), and any facet <tt>Facet</tt> that is a member of a
15356 standard category, <tt>has_facet&lt;Facet&gt;(loc)</tt> is true. Each
15357 locale member function which takes a <tt>locale::category</tt>
15358 argument operates on the corresponding set of facets.
15359 </p></blockquote>
15360
15361 <p>
15362 It seems that it comes down to which facets are considered to be members of a
15363 standard category. Intuitively, I would classify all the facets in Table 52 as
15364 members of their respective standard categories, but there are an unbounded set
15365 of them...
15366 </p>
15367
15368 <p>
15369 The paragraph implies that, for instance, <tt>has_facet&lt;num_put&lt;C,
15370 OutputIterator&gt; &gt;(loc)</tt> must always return true. I don't think that's
15371 possible. If it were, then <tt>use_facet&lt;num_put&lt;C, OutputIterator&gt;
15372 &gt;(loc)</tt> would have to return a reference to a distinct object for each
15373 valid specialization of <tt>num_put&lt;C, OutputIteratory&gt;</tt>, which is
15374 clearly impossible.
15375 </p>
15376
15377 <p>
15378 On the other hand, if none of the facets in Table 52 is a member of a standard
15379 category then none of the locale member functions that operate on entire
15380 categories of facets will work properly.
15381 </p>
15382
15383 <p>
15384 It seems that what p3 should mention that it's required (permitted?)
15385 to hold only for specializations of <tt>Facet</tt> from Table 52 on
15386 <tt>C</tt> from the set { <tt>char</tt>, <tt>wchar_t</tt> }, and
15387 <tt>InputIterator</tt> and <tt>OutputIterator</tt> from the set of
15388 {
15389 {i,o}<tt>streambuf_iterator</tt>&lt;{<tt>char</tt>,<tt>wchar_t</tt>}<tt>&gt;</tt>
15390 }.
15391 </p>
15392
15393
15394 <p><b>Proposed resolution:</b></p>
15395 <p>In 22.1.1.1.1 [locale.category], paragraph 3, change
15396 "that is a member of a standard category" to "shown in Table 51".</p>
15397
15398
15399 <p><b>Rationale:</b></p>
15400 <p>The facets in Table 52 are an unbounded set.  Locales should not be
15401 required to contain an infinite number of facets.</p> 
15402
15403 <p>It's not necessary to talk about which values of InputIterator and
15404 OutputIterator must be supported.  Table 51 already contains a
15405 complete list of the ones we need.</p>
15406
15407
15408
15409
15410
15411
15412 <hr>
15413 <h3><a name="341"></a>341. Vector reallocation and swap</h3>
15414 <p><b>Section:</b> 23.2.6.2 [vector.capacity] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15415  <b>Submitter:</b> Anthony Williams <b>Date:</b> 2001-09-27</p>
15416 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector.capacity">issues</a> in [vector.capacity].</p>
15417 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15418 <p><b>Discussion:</b></p>
15419 <p>It is a common idiom to reduce the capacity of a vector by swapping it with
15420 an empty one:</p>
15421 <pre>  std::vector&lt;SomeType&gt; vec;
15422   // fill vec with data
15423   std::vector&lt;SomeType&gt;().swap(vec);
15424   // vec is now empty, with minimal capacity
15425 </pre>
15426
15427 <p>However, the wording of 23.2.6.2 [vector.capacity]paragraph 5 prevents
15428 the capacity of a vector being reduced, following a call to
15429 reserve(). This invalidates the idiom, as swap() is thus prevented
15430 from reducing the capacity. The proposed wording for issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#329">329</a> does not affect this.  Consequently, the example above
15431 requires the temporary to be expanded to cater for the contents of
15432 vec, and the contents be copied across. This is a linear-time
15433 operation.</p>
15434
15435 <p>However, the container requirements state that swap must have constant
15436 complexity (23.1 [container.requirements] note to table 65).</p>
15437
15438 <p>This is an important issue, as reallocation affects the validity of
15439 references and iterators.</p>
15440
15441 <p>If the wording of 23.2.4.2p5 is taken to be the desired intent, then
15442 references and iterators remain valid after a call to swap, if they refer to
15443 an element before the new end() of the vector into which they originally
15444 pointed, in which case they refer to the element at the same index position.
15445 Iterators and references that referred to an element whose index position
15446 was beyond the new end of the vector are invalidated.</p>
15447
15448 <p>If the note to table 65 is taken as the desired intent, then there are two
15449 possibilities with regard to iterators and references:</p>
15450
15451 <ol>
15452 <li>All Iterators and references into both vectors are invalidated.</li>
15453 <li>Iterators and references into either vector remain valid, and remain
15454 pointing to the same element. Consequently iterators and references that
15455 referred to one vector now refer to the other, and vice-versa.</li>
15456 </ol>
15457
15458
15459 <p><b>Proposed resolution:</b></p>
15460 <p>Add a new paragraph after 23.2.6.2 [vector.capacity] paragraph 5:</p>
15461 <blockquote>
15462 <pre>  void swap(vector&lt;T,Allocator&gt;&amp; x);
15463 </pre>
15464 <p><b>Effects:</b> Exchanges the contents and capacity() of <tt>*this</tt>
15465 with that of <tt>x</tt>.</p>
15466 <p><b>Complexity:</b> Constant time.</p>
15467 </blockquote>
15468
15469 <p><i>[This solves the problem reported for this issue.  We may also
15470 have a problem with a circular definition of swap() for other
15471 containers.]</i></p>
15472
15473
15474
15475
15476 <p><b>Rationale:</b></p>
15477 <p>
15478 swap should be constant time.  The clear intent is that it should just
15479 do pointer twiddling, and that it should exchange all properties of
15480 the two vectors, including their reallocation guarantees.
15481 </p>
15482
15483
15484
15485
15486
15487 <hr>
15488 <h3><a name="345"></a>345. type tm in &lt;cwchar&gt;</h3>
15489 <p><b>Section:</b> 21.5 [c.strings] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15490  <b>Submitter:</b> Clark Nelson <b>Date:</b> 2001-10-19</p>
15491 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#c.strings">issues</a> in [c.strings].</p>
15492 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15493 <p><b>Discussion:</b></p>
15494 <p>C99, and presumably amendment 1 to C90, specify that &lt;wchar.h&gt;
15495 declares struct tm as an incomplete type. However, table 48 in 21.5
15496 [c.strings] does not mention the type tm as being declared in
15497 &lt;cwchar&gt;. Is this omission intentional or accidental?
15498 </p>
15499
15500
15501 <p><b>Proposed resolution:</b></p>
15502 <p>In section 21.5 [c.strings], add "tm" to table 48.</p>
15503
15504
15505
15506
15507
15508 <hr>
15509 <h3><a name="346"></a>346. Some iterator member functions should be const</h3>
15510 <p><b>Section:</b> 24.1 [iterator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15511  <b>Submitter:</b> Jeremy Siek <b>Date:</b> 2001-10-20</p>
15512 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#iterator.requirements">active issues</a> in [iterator.requirements].</p>
15513 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iterator.requirements">issues</a> in [iterator.requirements].</p>
15514 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15515 <p><b>Discussion:</b></p>
15516 <p>Iterator member functions and operators that do not change the state
15517 of the iterator should be defined as const member functions or as
15518 functions that take iterators either by const reference or by
15519 value. The standard does not explicitly state which functions should
15520 be const.  Since this a fairly common mistake, the following changes
15521 are suggested to make this explicit.</p>
15522
15523 <p>The tables almost indicate constness properly through naming: r
15524 for non-const and a,b for const iterators. The following changes
15525 make this more explicit and also fix a couple problems.</p>
15526
15527
15528 <p><b>Proposed resolution:</b></p>
15529 <p>In 24.1 [iterator.requirements] Change the first section of p9 from
15530 "In the following sections, a and b denote values of X..." to
15531 "In the following sections, a and b denote values of type const X...".</p>
15532
15533 <p>In Table 73, change</p>
15534 <pre>    a-&gt;m   U&amp;         ...
15535 </pre>
15536
15537 <p>to</p>
15538
15539 <pre>    a-&gt;m   const U&amp;   ...
15540     r-&gt;m   U&amp;         ...
15541 </pre>
15542
15543 <p>In Table 73 expression column, change</p>
15544
15545 <pre>    *a = t
15546 </pre>
15547
15548 <p>to</p>
15549
15550 <pre>    *r = t
15551 </pre>
15552
15553 <p><i>[Redmond: The container requirements should be reviewed to see if
15554 the same problem appears there.]</i></p>
15555
15556
15557
15558
15559
15560
15561
15562 <hr>
15563 <h3><a name="347"></a>347. locale::category and bitmask requirements</h3>
15564 <p><b>Section:</b> 22.1.1.1.1 [locale.category] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15565  <b>Submitter:</b> P.J. Plauger, Nathan Myers <b>Date:</b> 2001-10-23</p>
15566 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.category">issues</a> in [locale.category].</p>
15567 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15568 <p><b>Discussion:</b></p>
15569 <p>
15570 In 22.1.1.1.1 [locale.category] paragraph 1, the category members
15571 are described as bitmask elements.  In fact, the bitmask requirements
15572 in 17.3.2.1.2 [bitmask.types] don't seem quite right: <tt>none</tt>
15573 and <tt>all</tt> are bitmask constants, not bitmask elements.</p>
15574
15575 <p>In particular, the requirements for <tt>none</tt> interact poorly
15576 with the requirement that the LC_* constants from the C library must
15577 be recognizable as C++ locale category constants.  LC_* values should
15578 not be mixed with these values to make category values.</p>
15579
15580 <p>We have two options for the proposed resolution.  Informally:
15581 option 1 removes the requirement that LC_* values be recognized as
15582 category arguments.  Option 2 changes the category type so that this
15583 requirement is implementable, by allowing <tt>none</tt> to be some
15584 value such as 0x1000 instead of 0.</p>
15585
15586 <p>Nathan writes: "I believe my proposed resolution [Option 2] merely
15587 re-expresses the status quo more clearly, without introducing any
15588 changes beyond resolving the DR.</p>
15589
15590
15591
15592 <p><b>Proposed resolution:</b></p>
15593 <p>Replace the first two paragraphs of 22.1.1.1 [locale.types] with:</p>
15594 <blockquote>
15595 <pre>    typedef int category;
15596 </pre>
15597
15598 <p>Valid category values include the <tt>locale</tt> member bitmask
15599 elements <tt>collate</tt>, <tt>ctype</tt>, <tt>monetary</tt>,
15600 <tt>numeric</tt>, <tt>time</tt>, and <tt>messages</tt>, each of which
15601 represents a single locale category. In addition, <tt>locale</tt> member
15602 bitmask constant <tt>none</tt> is defined as zero and represents no
15603 category. And locale member bitmask constant <tt>all</tt> is defined such that
15604 the expression</p>
15605 <pre>    (collate | ctype | monetary | numeric | time | messages | all) == all
15606 </pre>
15607 <p>
15608 is <tt>true</tt>, and represents the union of all categories.  Further
15609 the expression <tt>(X | Y)</tt>, where <tt>X</tt> and <tt>Y</tt> each
15610 represent a single category, represents the union of the two
15611 categories.
15612 </p>
15613
15614 <p>
15615 <tt>locale</tt> member functions expecting a <tt>category</tt>
15616 argument require one of the <tt>category</tt> values defined above, or
15617 the union of two or more such values. Such a <tt>category</tt>
15618 argument identifies a set of locale categories. Each locale category,
15619 in turn, identifies a set of locale facets, including at least those
15620 shown in Table 51:
15621 </p>
15622 </blockquote>
15623 <p><i>[Curaçao: need input from locale experts.]</i></p>
15624
15625
15626
15627
15628 <p><b>Rationale:</b></p>
15629
15630 <p>The LWG considered, and rejected, an alternate proposal (described
15631   as "Option 2" in the discussion).  The main reason for rejecting it
15632   was that library implementors were concerened about implementation
15633   difficult, given that getting a C++ library to work smoothly with a
15634   separately written C library is already a delicate business.  Some
15635   library implementers were also concerned about the issue of adding
15636   extra locale categories.</p>
15637
15638 <blockquote>
15639 <p><b>Option 2:</b> <br>
15640 Replace the first paragraph of 22.1.1.1 [locale.types] with:</p>
15641 <blockquote>
15642 <p>
15643 Valid category values include the enumerated values.  In addition, the
15644 result of applying commutative operators | and &amp; to any two valid 
15645 values is valid, and results in the setwise union and intersection, 
15646 respectively, of the argument categories.  The values <tt>all</tt> and 
15647 <tt>none</tt> are defined such that for any valid value <tt>cat</tt>, the
15648 expressions <tt>(cat | all == all)</tt>, <tt>(cat &amp; all == cat)</tt>,
15649 <tt>(cat | none == cat)</tt> and <tt>(cat &amp; none == none)</tt> are 
15650 true.  For non-equal values <tt>cat1</tt> and <tt>cat2</tt> of the
15651 remaining enumerated values, <tt>(cat1 &amp; cat2 == none)</tt> is true.
15652 For any valid categories <tt>cat1</tt> and <tt>cat2</tt>, the result
15653 of <tt>(cat1 &amp; ~cat2)</tt> is valid, and equals the setwise union of 
15654 those categories found in <tt>cat1</tt> but not found in <tt>cat2</tt>.
15655 [Footnote: it is not required that <tt>all</tt> equal the setwise union
15656 of the other enumerated values; implementations may add extra categories.]
15657 </p>
15658 </blockquote>
15659 </blockquote>
15660
15661
15662
15663
15664
15665 <hr>
15666 <h3><a name="349"></a>349. Minor typographical error in ostream_iterator</h3>
15667 <p><b>Section:</b> 24.5.2 [ostream.iterator] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15668  <b>Submitter:</b> Andy Sawyer <b>Date:</b> 2001-10-24</p>
15669 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15670 <p><b>Discussion:</b></p>
15671 <p>24.5.2 [lib.ostream.iterator] states:</p>
15672 <pre>    [...]
15673
15674     private:
15675     // basic_ostream&lt;charT,traits&gt;* out_stream; exposition only
15676     // const char* delim; exposition only
15677 </pre>
15678
15679 <p>Whilst it's clearly marked "exposition only", I suspect 'delim'
15680 should be of type 'const charT*'.</p>
15681
15682
15683 <p><b>Proposed resolution:</b></p>
15684 <p>
15685 In 24.5.2 [ostream.iterator], replace <tt>const char* delim</tt> with
15686 <tt>const charT* delim</tt>.
15687 </p>
15688
15689
15690
15691
15692
15693 <hr>
15694 <h3><a name="352"></a>352. missing fpos requirements</h3>
15695 <p><b>Section:</b> 21.1.2 [char.traits.typedefs] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15696  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2001-12-02</p>
15697 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15698 <p><b>Discussion:</b></p>
15699 <p>
15700 <i>(1)</i>
15701 There are no requirements on the <tt>stateT</tt> template parameter of
15702 <tt>fpos</tt> listed in 27.4.3. The interface appears to require that
15703 the type be at least Assignable and CopyConstructible (27.4.3.1, p1),
15704 and I think also DefaultConstructible (to implement the operations in
15705 Table 88).
15706 </p>
15707 <p>
15708 21.1.2, p3, however, only requires that
15709 <tt>char_traits&lt;charT&gt;::state_type</tt> meet the requirements of
15710 CopyConstructible types.
15711 </p>
15712 <p>
15713 <i>(2)</i>
15714 Additionally, the <tt>stateT</tt> template argument has no
15715 corresponding typedef in fpos which might make it difficult to use in
15716 generic code.
15717 </p>
15718
15719
15720 <p><b>Proposed resolution:</b></p>
15721 <p>
15722 Modify 21.1.2, p4 from
15723 </p>
15724 <p>
15725     Requires: <tt>state_type</tt> shall meet the requirements of
15726               CopyConstructible types (20.1.3).
15727 </p>
15728 <p>
15729     Requires: state_type shall meet the requirements of Assignable
15730               (23.1, p4), CopyConstructible (20.1.3), and
15731               DefaultConstructible  (20.1.4) types.
15732 </p>
15733
15734
15735
15736 <p><b>Rationale:</b></p>
15737 <p>The LWG feels this is two issues, as indicated above. The first is
15738 a defect---std::basic_fstream is unimplementable without these
15739 additional requirements---and the proposed resolution fixes it.  The
15740 second is questionable; who would use that typedef?  The class
15741 template fpos is used only in a very few places, all of which know the
15742 state type already.  Unless motivation is provided, the second should
15743 be considered NAD.</p>
15744
15745
15746
15747
15748
15749 <hr>
15750 <h3><a name="354"></a>354. Associative container lower/upper bound requirements</h3>
15751 <p><b>Section:</b> 23.1.4 [associative.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15752  <b>Submitter:</b> Hans Aberg <b>Date:</b> 2001-12-17</p>
15753 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
15754 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15755 <p><b>Discussion:</b></p>
15756 <p>
15757 Discussions in the thread "Associative container lower/upper bound
15758 requirements" on comp.std.c++ suggests that there is a defect in the
15759 C++ standard, Table 69 of section 23.1.2, "Associative containers",
15760 [lib.associative.reqmts].  It currently says:</p>
15761
15762 <blockquote>
15763 <p>
15764 a.find(k): returns an iterator pointing to an element with the key equivalent to
15765 k, or a.end() if such an element is not found.
15766 </p>
15767
15768 <p>
15769 a.lower_bound(k): returns an iterator pointing to the first element with
15770 key not less than k.
15771 </p>
15772
15773 <p>
15774 a.upper_bound(k): returns an iterator pointing to the first element with
15775 key greater than k.
15776 </p>
15777 </blockquote>
15778
15779 <p>
15780 We have "or a.end() if such an element is not found" for
15781 <tt>find</tt>, but not for <tt>upper_bound</tt> or
15782 <tt>lower_bound</tt>.  As the text stands, one would be forced to
15783 insert a new element into the container and return an iterator to that
15784 in case the sought iterator does not exist, which does not seem to be
15785 the intention (and not possible with the "const" versions).
15786 </p>
15787
15788
15789 <p><b>Proposed resolution:</b></p>
15790
15791 <p>Change Table 69 of section 23.1.4 [associative.reqmts] indicated entries
15792 to:</p>
15793
15794 <blockquote>
15795 <p>
15796 a.lower_bound(k): returns an iterator pointing to the first element with
15797 key not less than k, or a.end() if such an element is not found.
15798 </p>
15799
15800 <p>
15801 a.upper_bound(k): returns an iterator pointing to the first element with
15802 key greater than k, or a.end() if such an element is not found.
15803 </p>
15804 </blockquote>
15805
15806 <p><i>[Curaçao: LWG reviewed PR.]</i></p>
15807
15808
15809
15810
15811
15812
15813
15814
15815 <hr>
15816 <h3><a name="355"></a>355. Operational semantics for a.back()</h3>
15817 <p><b>Section:</b> 23.1.3 [sequence.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15818  <b>Submitter:</b> Yaroslav Mironov <b>Date:</b> 2002-01-23</p>
15819 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#sequence.reqmts">issues</a> in [sequence.reqmts].</p>
15820 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15821 <p><b>Discussion:</b></p>
15822
15823 <p>Table 68 "Optional Sequence Operations" in 23.1.1/12
15824 specifies operational semantics for "a.back()" as
15825 "*--a.end()", which may be ill-formed <i>[because calling
15826 operator-- on a temporary (the return) of a built-in type is
15827 ill-formed]</i>, provided a.end() returns a simple pointer rvalue
15828 (this is almost always the case for std::vector::end(), for
15829 example). Thus, the specification is not only incorrect, it
15830 demonstrates a dangerous construct: "--a.end()" may
15831 successfully compile and run as intended, but after changing the type
15832 of the container or the mode of compilation it may produce
15833 compile-time error. </p>
15834
15835
15836
15837 <p><b>Proposed resolution:</b></p>
15838 <p>Change the specification in table 68 "Optional Sequence
15839 Operations" in 23.1.1/12 for "a.back()" from</p>
15840
15841
15842 <blockquote><pre>*--a.end()
15843 </pre></blockquote>
15844
15845 <p>to</p>
15846
15847 <blockquote><pre>  { iterator tmp = a.end(); --tmp; return *tmp; }
15848 </pre></blockquote>
15849
15850 <p>and the specification for "a.pop_back()" from</p>
15851
15852 <blockquote><pre>a.erase(--a.end())
15853 </pre></blockquote>
15854
15855 <p>to</p>
15856
15857 <blockquote><pre>  { iterator tmp = a.end(); --tmp; a.erase(tmp); }
15858 </pre></blockquote>
15859
15860 <p><i>[Curaçao: LWG changed PR from "{ X::iterator tmp =
15861 a.end(); return *--tmp; }" to "*a.rbegin()", and from
15862 "{ X::iterator tmp = a.end(); a.erase(--tmp); }" to
15863 "a.erase(rbegin())".]</i></p>
15864
15865
15866 <p><i>[There is a second possible defect; table 68 "Optional
15867 Sequence Operations" in the "Operational Semantics"
15868 column uses operations present only in the "Reversible
15869 Container" requirements, yet there is no stated dependency
15870 between these separate requirements tables. Ask in Santa Cruz if the
15871 LWG would like a new issue opened.]</i></p>
15872
15873
15874 <p><i>[Santa Cruz: the proposed resolution is even worse than what's in
15875   the current standard: erase is undefined for reverse iterator.  If
15876   we're going to make the change, we need to define a temporary and
15877   use operator--.  Additionally, we don't know how prevalent this is:
15878   do we need to make this change in more than one place?  Martin has
15879   volunteered to review the standard and see if this problem occurs
15880   elsewhere.]</i></p>
15881
15882
15883 <p><i>[Oxford: Matt provided new wording to address the concerns raised
15884   in Santa Cruz.  It does not appear that this problem appears
15885   anywhere else in clauses 23 or 24.]</i></p>
15886
15887
15888 <p><i>[Kona: In definition of operational semantics of back(), change
15889 "*tmp" to "return *tmp;"]</i></p>
15890
15891
15892
15893
15894
15895
15896
15897 <hr>
15898 <h3><a name="358"></a>358. interpreting <tt>thousands_sep</tt> after a <tt>decimal_point</tt></h3>
15899 <p><b>Section:</b> 22.2.2.1.2 [facet.num.get.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15900  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2002-03-12</p>
15901 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#facet.num.get.virtuals">active issues</a> in [facet.num.get.virtuals].</p>
15902 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#facet.num.get.virtuals">issues</a> in [facet.num.get.virtuals].</p>
15903 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15904 <p><b>Discussion:</b></p>
15905 <p>
15906 I don't think <tt>thousands_sep</tt> is being treated correctly after
15907 decimal_point has been seen. Since grouping applies only to the
15908 integral part of the number, the first such occurrence should, IMO,
15909 terminate Stage 2. (If it does not terminate it, then 22.2.2.1.2, p12
15910 and 22.2.3.1.2, p3 need to explain how <tt>thousands_sep</tt> is to be
15911 interpreted in the fractional part of a number.)
15912 </p>
15913
15914 <p>
15915 The easiest change I can think of that resolves this issue would be
15916 something like below.
15917 </p>
15918
15919
15920 <p><b>Proposed resolution:</b></p>
15921 <p>
15922 Change the first sentence of 22.2.2.1.2, p9 from
15923 </p>
15924
15925 <blockquote><p>
15926     If discard is true then the position of the character is
15927     remembered, but the character is otherwise ignored. If it is not
15928     discarded, then a check is made to determine if c is allowed as
15929     the next character of an input field of the conversion specifier
15930     returned by stage 1. If so it is accumulated.
15931 </p></blockquote>
15932
15933 <p>to</p>
15934
15935 <blockquote><p>
15936     If <tt>discard</tt> is true, then if <tt>'.'</tt> has not yet been
15937     accumulated, then the position of the character is remembered, but
15938     the character is otherwise ignored. Otherwise, if <tt>'.'</tt> has
15939     already been accumulated, the character is discarded and Stage 2
15940      terminates. ...
15941 </p></blockquote>
15942
15943
15944
15945 <p><b>Rationale:</b></p>
15946 <p>We believe this reflects the intent of the Standard.  Thousands sep
15947   characters after the decimal point are not useful in any locale.
15948   Some formatting conventions do group digits that follow the decimal
15949   point, but they usually introduce a different grouping character
15950   instead of reusing the thousand sep character.  If we want to add
15951   support for such conventions, we need to do so explicitly.</p>
15952
15953
15954
15955
15956
15957
15958 <hr>
15959 <h3><a name="359"></a>359. num_put&lt;&gt;::do_put (..., bool) undocumented</h3>
15960 <p><b>Section:</b> 22.2.2.2.1 [facet.num.put.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
15961  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2002-03-12</p>
15962 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
15963 <p><b>Discussion:</b></p>
15964 <p>22.2.2.2.1, p1:</p>
15965
15966     <pre>    iter_type put (iter_type out, ios_base&amp; str, char_type fill,
15967                    bool val) const;
15968     ...
15969
15970     1   Returns: do_put (out, str, fill, val).
15971     </pre>
15972
15973 <p>AFAICS, the behavior of do_put (..., bool) is not documented anywhere,
15974 however, 22.2.2.2.2, p23:</p>
15975
15976 <blockquote>
15977 <pre>iter_type put (iter_type out, ios_base&amp; str, char_type fill,
15978                bool val) const;
15979 </pre>
15980
15981
15982         <p>Effects: If (str.flags() &amp; ios_base::boolalpha) == 0 then do
15983              out = do_put(out, str, fill, (int)val)
15984            Otherwise do</p>
15985 <pre>             string_type s =
15986                  val ? use_facet&lt;ctype&lt;charT&gt; &gt;(loc).truename()
15987                      : use_facet&lt;ctype&lt;charT&gt; &gt;(loc).falsename();
15988 </pre>
15989            <p>and then insert the characters of s into out. <i>out</i>.</p>
15990 </blockquote>
15991
15992 <p>
15993 This means that the bool overload of <tt>do_put()</tt> will never be called,
15994 which contradicts the first paragraph. Perhaps the declaration
15995 should read <tt>do_put()</tt>, and not <tt>put()</tt>?
15996 </p>
15997
15998 <p>
15999 Note also that there is no <b>Returns</b> clause for this function, which
16000 should probably be corrected, just as should the second occurrence
16001 of <i>"out."</i> in the text.
16002 </p>
16003
16004 <p>
16005 I think the least invasive change to fix it would be something like
16006 the following:
16007 </p>
16008
16009
16010 <p><b>Proposed resolution:</b></p>
16011 <p>In 22.2.2.2.2 [facet.num.put.virtuals], just above paragraph 1, remove
16012   the <tt>bool</tt> overload.</p>
16013
16014 <p>
16015 In 22.2.2.2.2 [facet.num.put.virtuals], p23, make the following changes
16016 </p>
16017
16018 <blockquote><p>
16019      Replace <tt>put()</tt> with <tt>do_put()</tt> in the declaration
16020      of the member function.
16021 </p></blockquote>
16022
16023 <blockquote><p>
16024     Change the <b>Effects</b> clause to a <b>Returns</b> clause (to
16025     avoid the requirement to call <tt>do_put(..., int)</tt> from <tt>
16026     do_put (..., bool))</tt>
16027     like so:
16028 </p></blockquote>
16029
16030 <blockquote><p>
16031     23   <b>Returns</b>: If <tt>(str.flags() &amp;
16032          ios_base::boolalpha) == 0</tt> then
16033          <tt>do_put (out, str, fill, (long)val)</tt>
16034          Otherwise the function obtains a string <tt>s</tt> as if by</p>
16035 <pre>             string_type s =
16036                 val ? use_facet&lt;ctype&lt;charT&gt; &gt;(loc).truename()
16037                     : use_facet&lt;ctype&lt;charT&gt; &gt;(loc).falsename();
16038 </pre>
16039          <p>and then inserts each character <tt>c</tt> of s into out via
16040            <tt>*out++ = c</tt>
16041          and returns <tt>out</tt>.</p>
16042 </blockquote>
16043
16044
16045
16046 <p><b>Rationale:</b></p><p>
16047 This fixes a couple of obvious typos, and also fixes what appears to
16048 be a requirement of gratuitous inefficiency.
16049 </p>
16050
16051
16052
16053
16054 <hr>
16055 <h3><a name="360"></a>360. locale mandates inefficient implementation</h3>
16056 <p><b>Section:</b> 22.1.1 [locale] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16057  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2002-03-12</p>
16058 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale">issues</a> in [locale].</p>
16059 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16060 <p><b>Discussion:</b></p>
16061 <p>
16062 22.1.1, p7 (copied below) allows iostream formatters and extractors
16063 to make assumptions about the values returned from facet members.
16064 However, such assumptions are apparently not guaranteed to hold
16065 in other cases (e.g., when the facet members are being called directly
16066 rather than as a result of iostream calls, or between successive
16067 calls to the same iostream functions with no interevening calls to
16068 <tt>imbue()</tt>, or even when the facet member functions are called
16069 from other member functions of other facets). This restriction
16070 prevents locale from being implemented efficiently.
16071 </p>
16072
16073
16074 <p><b>Proposed resolution:</b></p>
16075 <p>Change the first sentence in 22.1.1, p7 from</p>
16076 <blockquote><p>
16077     In successive calls to a locale facet member function during
16078     a call to an iostream inserter or extractor or a streambuf member
16079     function, the returned result shall be identical. [Note: This
16080     implies that such results may safely be reused without calling
16081     the locale facet member function again, and that member functions
16082     of iostream classes cannot safely call <tt>imbue()</tt>
16083     themselves, except as specified elsewhere. --end note]
16084 </p></blockquote>
16085
16086 <p>to</p>
16087
16088 <blockquote><p>
16089     In successive calls to a locale facet member function on a facet
16090     object installed in the same locale, the returned result shall be
16091     identical. ...
16092 </p></blockquote>
16093
16094
16095
16096 <p><b>Rationale:</b></p>
16097 <p>This change is reasonable becuase it clarifies the intent of this
16098   part of the standard.</p>
16099
16100
16101
16102
16103
16104 <hr>
16105 <h3><a name="362"></a>362. bind1st/bind2nd type safety</h3>
16106 <p><b>Section:</b> D.8 [depr.lib.binders] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16107  <b>Submitter:</b> Andrew Demkin <b>Date:</b> 2002-04-26</p>
16108 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.lib.binders">issues</a> in [depr.lib.binders].</p>
16109 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16110 <p><b>Discussion:</b></p>
16111 <p>
16112 The definition of bind1st() (D.8 [depr.lib.binders]) can result in
16113 the construction of an unsafe binding between incompatible pointer
16114 types. For example, given a function whose first parameter type is
16115 'pointer to T', it's possible without error to bind an argument of
16116 type 'pointer to U' when U does not derive from T:
16117 </p>
16118 <pre>   foo(T*, int);
16119
16120    struct T {};
16121    struct U {};
16122
16123    U u;
16124
16125    int* p;
16126    int* q;
16127
16128    for_each(p, q, bind1st(ptr_fun(foo), &amp;u));    // unsafe binding
16129 </pre>
16130
16131 <p>
16132 The definition of bind1st() includes a functional-style conversion to
16133 map its argument to the expected argument type of the bound function
16134 (see below):
16135 </p>
16136 <pre>  typename Operation::first_argument_type(x)
16137 </pre>
16138
16139 <p>A functional-style conversion (D.8 [depr.lib.binders]) is defined to
16140 be
16141 semantically equivalent to an explicit cast expression (D.8
16142 [depr.lib.binders]), which may (according to 5.4, paragraph 5) be
16143 interpreted
16144 as a reinterpret_cast, thus masking the error.
16145 </p>
16146
16147 <p>The problem and proposed change also apply to D.8 [depr.lib.binders].</p>
16148
16149
16150 <p><b>Proposed resolution:</b></p>
16151 <p>Add this sentence to the end of D.8 [depr.lib.binders]/1:
16152   "Binders <tt>bind1st</tt> and <tt>bind2nd</tt> are deprecated in
16153   favor of <tt>std::tr1::bind</tt>."</p>
16154
16155 <p>(Notes to editor: (1) when and if tr1::bind is incorporated into
16156   the standard, "std::tr1::bind" should be changed to "std::bind". (2)
16157   20.5.6 should probably be moved to Annex D.</p>
16158
16159
16160 <p><b>Rationale:</b></p>
16161 <p>There is no point in fixing bind1st and bind2nd.  tr1::bind is a
16162   superior solution.  It solves this problem and others.</p>
16163
16164
16165
16166
16167
16168 <hr>
16169 <h3><a name="363"></a>363. Missing exception specification in 27.4.2.1.1</h3>
16170 <p><b>Section:</b> 27.4.2.1.1 [ios::failure] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16171  <b>Submitter:</b> Walter Brown and Marc Paterno <b>Date:</b> 2002-05-20</p>
16172 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ios::failure">issues</a> in [ios::failure].</p>
16173 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16174 <p><b>Discussion:</b></p>
16175 <p>
16176 The destructor of ios_base::failure should have an empty throw
16177 specification, because the destructor of its base class, exception, is
16178 declared in this way.
16179 </p>
16180
16181
16182 <p><b>Proposed resolution:</b></p>
16183 <p>Change the destructor to</p>
16184 <pre>  virtual ~failure() throw();
16185 </pre>
16186
16187
16188 <p><b>Rationale:</b></p>
16189 <p>Fixes an obvious glitch.  This is almost editorial.</p>
16190
16191
16192
16193
16194
16195 <hr>
16196 <h3><a name="364"></a>364. Inconsistent wording in 27.5.2.4.2</h3>
16197 <p><b>Section:</b> 27.5.2.4.2 [streambuf.virt.buffer] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16198  <b>Submitter:</b> Walter Brown, Marc Paterno <b>Date:</b> 2002-05-10</p>
16199 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#streambuf.virt.buffer">issues</a> in [streambuf.virt.buffer].</p>
16200 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16201 <p><b>Discussion:</b></p>
16202 <p>
16203 27.5.2.4.2 [streambuf.virt.buffer] paragraph 1 is inconsistent with the Effects
16204 clause for seekoff.
16205 </p>
16206
16207
16208 <p><b>Proposed resolution:</b></p>
16209 <p>
16210 Make this paragraph, the Effects clause for setbuf, consistent in wording
16211 with the Effects clause for seekoff in paragraph 3 by amending paragraph 1
16212 to indicate the purpose of setbuf:
16213 </p>
16214
16215 <p>Original text:</p>
16216
16217 <blockquote><p>
16218 1 Effects: Performs an operation that is defined separately for each
16219 class derived from basic_streambuf in this clause (27.7.1.3, 27.8.1.4).
16220 </p></blockquote>
16221
16222 <p>Proposed text:</p>
16223
16224 <blockquote><p>
16225 1 Effects: Influences stream buffering in a way that is defined separately
16226 for each class derived from basic_streambuf in this clause
16227 (27.7.1.3, 27.8.1.4).
16228 </p></blockquote>
16229
16230
16231
16232 <p><b>Rationale:</b></p>
16233 <p>The LWG doesn't believe there is any normative difference between
16234   the existing wording and what's in the proposed resolution, but the
16235   change may make the intent clearer.</p>
16236
16237
16238
16239
16240
16241 <hr>
16242 <h3><a name="365"></a>365. Lack of const-qualification in clause 27</h3>
16243 <p><b>Section:</b> 27 [input.output] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16244  <b>Submitter:</b> Walter Brown, Marc Paterno <b>Date:</b> 2002-05-10</p>
16245 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#input.output">issues</a> in [input.output].</p>
16246 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16247 <p><b>Discussion:</b></p>
16248 <p>
16249 Some stream and streambuf member functions are declared non-const,
16250 even thought they appear only to report information rather than to
16251 change an object's logical state.  They should be declared const.  See
16252 document N1360 for details and rationale.
16253 </p>
16254
16255 <p>The list of member functions under discussion: <tt>in_avail</tt>,
16256 <tt>showmanyc</tt>, <tt>tellg</tt>, <tt>tellp</tt>, <tt>is_open</tt>.</p>
16257
16258 <p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#73">73</a></p>
16259
16260
16261
16262 <p><b>Proposed resolution:</b></p>
16263 <p>In 27.8.1.5, 27.8.1.7, 27.8.1.8, 27.8.1.10, 27.8.1.11, and 27.8.1.13</p>
16264 <p>Replace</p>
16265 <pre>  bool is_open();
16266 </pre>
16267 <p>with</p>
16268 <pre>  bool is_open() const;
16269 </pre>
16270
16271
16272 <p><b>Rationale:</b></p>
16273 <p>Of the changes proposed in N1360, the only one that is safe is
16274 changing the filestreams' is_open to const.  The LWG believed that
16275 this was NAD the first time it considered this issue (issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#73">73</a>), but now thinks otherwise.  The corresponding streambuf
16276 member function, after all,is already const.</p>
16277
16278 <p>The other proposed changes are less safe, because some streambuf
16279 functions that appear merely to report a value do actually perform
16280 mutating operations.  It's not even clear that they should be
16281 considered "logically const", because streambuf has two interfaces, a
16282 public one and a protected one.  These functions may, and often do,
16283 change the state as exposed by the protected interface, even if the
16284 state exposed by the public interface is unchanged.</p>
16285
16286 <p>Note that implementers can make this change in a binary compatible
16287 way by providing both overloads; this would be a conforming extension.</p>
16288
16289
16290
16291
16292
16293
16294 <hr>
16295 <h3><a name="369"></a>369. io stream objects and static ctors</h3>
16296 <p><b>Section:</b> 27.3 [iostream.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16297  <b>Submitter:</b> Ruslan Abdikeev <b>Date:</b> 2002-07-08</p>
16298 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostream.objects">issues</a> in [iostream.objects].</p>
16299 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16300 <p><b>Discussion:</b></p>
16301 <p>
16302 Is it safe to use standard iostream objects from constructors of
16303 static objects?  Are standard iostream objects constructed and are
16304 their associations established at that time?
16305 </p>
16306
16307 <p>Surpisingly enough, Standard does NOT require that.</p>
16308
16309 <p>
16310 27.3/2 [lib.iostream.objects] guarantees that standard iostream
16311 objects are constructed and their associations are established before
16312 the body of main() begins execution.  It also refers to ios_base::Init
16313 class as the panacea for constructors of static objects.
16314 </p>
16315
16316 <p>
16317 However, there's nothing in 27.3 [lib.iostream.objects],
16318 in 27.4.2 [lib.ios.base], and in 27.4.2.1.6 [lib.ios::Init],
16319 that would require implementations to allow access to standard
16320 iostream objects from constructors of static objects.
16321 </p>
16322
16323 <p>Details:</p>
16324
16325 <p>Core text refers to some magic object ios_base::Init, which will
16326 be discussed below:</p>
16327
16328 <blockquote><p>
16329     "The [standard iostream] objects are constructed, and their
16330     associations are established at some time prior to or during
16331     first time an object of class basic_ios&lt;charT,traits&gt;::Init
16332     is constructed, and in any case before the body of main
16333     begins execution." (27.3/2 [lib.iostream.objects])
16334 </p></blockquote>
16335
16336 <p>
16337 The first <i>non-normative</i> footnote encourages implementations
16338 to initialize standard iostream objects earlier than required.
16339 </p>
16340
16341 <p>However, the second <i>non-normative</i> footnote makes an explicit
16342 and unsupported claim:</p>
16343
16344 <blockquote><p>
16345   "Constructors and destructors for static objects can access these
16346   [standard iostream] objects to read input from stdin or write output
16347   to stdout or stderr." (27.3/2 footnote 265 [lib.iostream.objects])
16348 </p></blockquote>
16349
16350 <p>
16351 The only bit of magic is related to that ios_base::Init class.  AFAIK,
16352 the rationale behind ios_base::Init was to bring an instance of this
16353 class to each translation unit which #included &lt;iostream&gt; or
16354 related header.  Such an inclusion would support the claim of footnote
16355 quoted above, because in order to use some standard iostream object it
16356 is necessary to #include &lt;iostream&gt;.
16357 </p>
16358
16359 <p>
16360 However, while Standard explicitly describes ios_base::Init as
16361 an appropriate class for doing the trick, I failed to found a
16362 mention of an _instance_ of ios_base::Init in Standard.
16363 </p>
16364
16365
16366 <p><b>Proposed resolution:</b></p>
16367
16368 <p>Add to 27.3 [iostream.objects], p2, immediately before the last sentence
16369 of the paragraph, the following two sentences:</p>
16370
16371 <blockquote><p>
16372 If a translation unit includes &lt;iostream&gt;, or explicitly
16373 constructs an ios_base::Init object, these stream objects shall
16374 be constructed before dynamic initialization of non-local
16375 objects defined later in that translation unit, and these stream
16376 objects shall be destroyed after the destruction of dynamically
16377 initialized non-local objects defined later in that translation unit.
16378 </p></blockquote>
16379
16380 <p><i>[Lillehammer: Matt provided wording.]</i></p>
16381
16382 <p><i>[Mont Tremblant: Matt provided revised wording.]</i></p>
16383
16384
16385
16386 <p><b>Rationale:</b></p>
16387 <p>
16388 The original proposed resolution unconditionally required
16389 implementations to define an ios_base::Init object of some
16390 implementation-defined name in the header &lt;iostream&gt;. That's an
16391 overspecification. First, defining the object may be unnecessary
16392 and even detrimental to performance if an implementation can
16393 guarantee that the 8 standard iostream objects will be initialized
16394 before any other user-defined object in a program. Second, there
16395 is no need to require implementations to document the name of the
16396 object.</p>
16397
16398 <p>
16399 The new proposed resolution gives users guidance on what they need to
16400 do to ensure that stream objects are constructed during startup.</p>
16401
16402
16403
16404
16405
16406 <hr>
16407 <h3><a name="370"></a>370. Minor error in basic_istream::get</h3>
16408 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16409  <b>Submitter:</b> Ray Lischner <b>Date:</b> 2002-07-15</p>
16410 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
16411 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16412 <p><b>Discussion:</b></p>
16413 <p>Defect report for description of basic_istream::get (section
16414 27.6.1.3 [istream.unformatted]), paragraph 15. The description for the
16415 get function
16416 with the following signature:</p>
16417
16418 <pre>  basic_istream&lt;charT,traits&gt;&amp; get(basic_streambuf&lt;char_type,traits&gt;&amp;
16419   sb);
16420 </pre>
16421
16422 <p>is incorrect. It reads</p>
16423
16424 <blockquote><p>
16425   Effects: Calls get(s,n,widen('\n'))
16426 </p></blockquote>
16427
16428 <p>which I believe should be:</p>
16429
16430 <blockquote><p>
16431   Effects: Calls get(sb,widen('\n'))
16432 </p></blockquote>
16433
16434
16435 <p><b>Proposed resolution:</b></p>
16436 <p>Change the <b>Effects</b> paragraph to:</p>
16437 <blockquote><p>
16438   Effects: Calls get(sb,this-&gt;widen('\n'))
16439 </p></blockquote>
16440
16441 <p><i>[Pre-Oxford: Minor correction from Howard: replaced 'widen' 
16442       with 'this-&gt;widen'.]</i></p>
16443
16444
16445
16446
16447 <p><b>Rationale:</b></p><p>Fixes an obvious typo.</p>
16448
16449
16450
16451
16452 <hr>
16453 <h3><a name="371"></a>371. Stability of multiset and multimap member functions</h3>
16454 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16455  <b>Submitter:</b> Frank Compagner <b>Date:</b> 2002-07-20</p>
16456 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
16457 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
16458 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16459 <p><b>Discussion:</b></p>
16460 <p>
16461 The requirements for multiset and multimap containers (23.1
16462 [lib.containers.requirements], 23.1.2 [lib.associative.reqmnts],
16463 23.3.2 [lib.multimap] and 23.3.4 [lib.multiset]) make no mention of
16464 the stability of the required (mutating) member functions. It appears
16465 the standard allows these functions to reorder equivalent elements of
16466 the container at will, yet the pervasive red-black tree implementation
16467 appears to provide stable behaviour.
16468 </p>
16469
16470 <p>This is of most concern when considering the behaviour of erase().
16471 A stability requirement would guarantee the correct working of the
16472 following 'idiom' that removes elements based on a certain predicate
16473 function.
16474 </p>
16475
16476 <pre>  multimap&lt;int, int&gt; m;
16477   multimap&lt;int, int&gt;::iterator i = m.begin();
16478   while (i != m.end()) {
16479       if (pred(i))
16480           m.erase (i++);
16481       else
16482           ++i;
16483   }
16484 </pre>
16485
16486 <p>
16487 Although clause 23.1.2/8 guarantees that i remains a valid iterator
16488 througout this loop, absence of the stability requirement could
16489 potentially result in elements being skipped. This would make
16490 this code incorrect, and, furthermore, means that there is no way
16491 of erasing these elements without iterating first over the entire
16492 container, and second over the elements to be erased. This would
16493 be unfortunate, and have a negative impact on both performance and
16494 code simplicity.
16495 </p>
16496
16497 <p>
16498 If the stability requirement is intended, it should be made explicit
16499 (probably through an extra paragraph in clause 23.1.2).
16500 </p>
16501 <p>
16502 If it turns out stability cannot be guaranteed, i'd argue that a
16503 remark or footnote is called for (also somewhere in clause 23.1.2) to
16504 warn against relying on stable behaviour (as demonstrated by the code
16505 above).  If most implementations will display stable behaviour, any
16506 problems emerging on an implementation without stable behaviour will
16507 be hard to track down by users. This would also make the need for an
16508 erase_if() member function that much greater.
16509 </p>
16510
16511 <p>This issue is somewhat related to LWG issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#130">130</a>.</p>
16512
16513
16514
16515 <p><b>Proposed resolution:</b></p>
16516
16517 <p>Add the following to the end of 23.1.4 [associative.reqmts] paragraph 4: 
16518 "For <tt>multiset</tt> and <tt>multimap</tt>, <tt>insert</tt>and <tt>erase</tt>
16519   are <i>stable</i>: they preserve the relative ordering of equivalent
16520   elements.</p> 
16521
16522 <p><i>[Lillehammer: Matt provided wording]</i></p>
16523
16524 <p><i>[Joe Gottman points out that the provided wording does not address
16525 multimap and multiset.  N1780 also addresses this issue and suggests
16526 wording.]</i></p>
16527
16528
16529 <p><i>[Mont Tremblant: Changed set and map to multiset and multimap.]</i></p>
16530
16531
16532
16533
16534 <p><b>Rationale:</b></p>
16535 <p>The LWG agrees that this guarantee is necessary for common user
16536   idioms to work, and that all existing implementations provide this
16537   property.  Note that this resolution guarantees stability for
16538   multimap and multiset, not for all associative containers in
16539   general.</p>
16540
16541
16542
16543
16544
16545
16546 <hr>
16547 <h3><a name="373"></a>373. Are basic_istream and basic_ostream to use (exceptions()&amp;badbit) != 0 ?</h3>
16548 <p><b>Section:</b> 27.6.1.2.1 [istream.formatted.reqmts], 27.6.2.6.1 [ostream.formatted.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16549  <b>Submitter:</b> Keith Baker <b>Date:</b> 2002-07-23</p>
16550 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.formatted.reqmts">issues</a> in [istream.formatted.reqmts].</p>
16551 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16552 <p><b>Discussion:</b></p>
16553
16554 <p>
16555 In 27.6.1.2.1 [istream.formatted.reqmts] and 27.6.2.6.1 [ostream.formatted.reqmts]
16556 (exception()&amp;badbit) != 0 is used in testing for rethrow, yet
16557 exception() is the constructor to class std::exception in 18.6.1 [type.info] that has no return type. Should member function
16558 exceptions() found in 27.4.4 [ios] be used instead?
16559 </p>
16560
16561
16562
16563 <p><b>Proposed resolution:</b></p>
16564 <p>
16565 In 27.6.1.2.1 [istream.formatted.reqmts] and 27.6.2.6.1 [ostream.formatted.reqmts], change
16566 "(exception()&amp;badbit) != 0" to "(exceptions()&amp;badbit) != 0".
16567 </p>
16568
16569
16570 <p><b>Rationale:</b></p>
16571 <p>Fixes an obvious typo.</p>
16572
16573
16574
16575
16576
16577 <hr>
16578 <h3><a name="375"></a>375. basic_ios should be ios_base in 27.7.1.3</h3>
16579 <p><b>Section:</b> 27.7.1.4 [stringbuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16580  <b>Submitter:</b> Ray Lischner <b>Date:</b> 2002-08-14</p>
16581 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#stringbuf.virtuals">issues</a> in [stringbuf.virtuals].</p>
16582 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16583 <p><b>Discussion:</b></p>
16584 <p>
16585 In Section 27.7.1.4 [stringbuf.virtuals]: Table 90, Table 91, and paragraph
16586 14 all contain references to "basic_ios::" which should be
16587 "ios_base::".
16588 </p>
16589
16590
16591 <p><b>Proposed resolution:</b></p>
16592 <p>
16593 Change all references to "basic_ios" in Table 90, Table 91, and
16594 paragraph 14 to "ios_base".
16595 </p>
16596
16597
16598 <p><b>Rationale:</b></p><p>Fixes an obvious typo.</p>
16599
16600
16601
16602
16603 <hr>
16604 <h3><a name="376"></a>376. basic_streambuf semantics</h3>
16605 <p><b>Section:</b> 27.7.1.4 [stringbuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16606  <b>Submitter:</b> Ray Lischner <b>Date:</b> 2002-08-14</p>
16607 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#stringbuf.virtuals">issues</a> in [stringbuf.virtuals].</p>
16608 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16609 <p><b>Discussion:</b></p>
16610 <p>
16611 In Section 27.7.1.4 [stringbuf.virtuals], Table 90, the implication is that
16612 the four conditions should be mutually exclusive, but they are not.
16613 The first two cases, as written, are subcases of the third.</p>
16614
16615 <p>
16616 As written, it is unclear what should be the result if cases 1 and 2
16617 are both true, but case 3 is false.
16618 </p>
16619
16620
16621
16622 <p><b>Proposed resolution:</b></p>
16623
16624 <p>Rewrite these conditions as:</p>
16625 <blockquote>
16626 <p>
16627   (which &amp; (ios_base::in|ios_base::out)) == ios_base::in
16628 </p>
16629
16630 <p>
16631   (which &amp; (ios_base::in|ios_base::out)) == ios_base::out
16632 </p>
16633
16634 <p>
16635   (which &amp; (ios_base::in|ios_base::out)) == 
16636 (ios_base::in|ios_base::out)
16637    and way == either ios_base::beg or ios_base::end
16638 </p>
16639
16640 <p>Otherwise</p>
16641 </blockquote>
16642
16643
16644
16645 <p><b>Rationale:</b></p>
16646 <p>It's clear what we wanted to say, we just failed to say it.  This
16647   fixes it.</p>
16648
16649
16650
16651
16652
16653 <hr>
16654 <h3><a name="379"></a>379. nonsensical ctype::do_widen() requirement</h3>
16655 <p><b>Section:</b> 22.2.1.1.2 [locale.ctype.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16656  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2002-09-06</p>
16657 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.ctype.virtuals">issues</a> in [locale.ctype.virtuals].</p>
16658 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16659 <p><b>Discussion:</b></p>
16660 <p>
16661 The last sentence in 22.2.1.1.2, p11 below doesn't seem to make sense.
16662 </p>
16663 <pre>  charT do_widen (char c) const;
16664
16665   -11- Effects: Applies the simplest reasonable transformation from
16666        a char value or sequence of char values to the corresponding
16667        charT value or values. The only characters for which unique
16668        transformations are required are those in the basic source
16669        character set (2.2). For any named ctype category with a
16670        ctype&lt;charT&gt; facet ctw and valid ctype_base::mask value
16671        M (is(M, c) || !ctw.is(M, do_widen(c))) is true.
16672 </pre>
16673 <p>
16674 Shouldn't the last sentence instead read
16675 </p>
16676 <pre>       For any named ctype category with a ctype&lt;char&gt; facet ctc
16677        and valid ctype_base::mask value M
16678        (ctc.is(M, c) || !is(M, do_widen(c))) is true.
16679 </pre>
16680 <p>
16681 I.e., if the narrow character c is not a member of a class of
16682 characters then neither is the widened form of c. (To paraphrase
16683 footnote 224.)
16684 </p>
16685
16686
16687 <p><b>Proposed resolution:</b></p>
16688 <p>
16689 Replace the last sentence of 22.2.1.1.2 [locale.ctype.virtuals], p11 with the
16690 following text:
16691 </p>
16692 <pre>       For any named ctype category with a ctype&lt;char&gt; facet ctc
16693        and valid ctype_base::mask value M,
16694        (ctc.is(M, c) || !is(M, do_widen(c))) is true.
16695 </pre>
16696
16697 <p><i>[Kona: Minor edit. Added a comma after the <i>M</i> for clarity.]</i></p>
16698
16699
16700
16701
16702 <p><b>Rationale:</b></p>
16703 <p>The LWG believes this is just a typo, and that this is the correct fix.</p>
16704
16705
16706
16707
16708
16709 <hr>
16710 <h3><a name="380"></a>380. typos in codecvt tables 53 and 54</h3>
16711 <p><b>Section:</b> 22.2.1.5 [locale.codecvt.byname] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16712  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2002-09-06</p>
16713 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt.byname">issues</a> in [locale.codecvt.byname].</p>
16714 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16715 <p><b>Discussion:</b></p>
16716 <p>
16717 Tables 53 and 54 in 22.2.1.5 [locale.codecvt.byname] are both titled "convert
16718 result values," when surely "do_in/do_out result values" must have
16719 been intended for Table 53 and "do_unshift result values" for Table
16720 54.
16721 </p>
16722 <p>
16723 Table 54, row 3 says that the meaning of partial is "more characters
16724 needed to be supplied to complete termination." The function is not
16725 supplied any characters, it is given a buffer which it fills with
16726 characters or, more precisely, destination elements (i.e., an escape
16727 sequence). So partial means that space for more than (to_limit - to)
16728 destination elements was needed to terminate a sequence given the
16729 value of state.
16730 </p>
16731
16732
16733 <p><b>Proposed resolution:</b></p>
16734 <p>
16735 Change the title of Table 53 to "do_in/do_out result values" and
16736 the title of Table 54 to "do_unshift result values."
16737 </p>
16738 <p>
16739 Change the text in Table 54, row 3 (the <b>partial</b> row), under the
16740 heading Meaning, to "space for more than (to_limit - to) destination
16741 elements was needed to terminate a sequence given the value of state."
16742 </p>
16743
16744
16745
16746
16747 <hr>
16748 <h3><a name="381"></a>381. detection of invalid mbstate_t in codecvt</h3>
16749 <p><b>Section:</b> 22.2.1.5 [locale.codecvt.byname] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16750  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2002-09-06</p>
16751 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt.byname">issues</a> in [locale.codecvt.byname].</p>
16752 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16753 <p><b>Discussion:</b></p>
16754 <p>
16755 All but one codecvt member functions that take a state_type argument
16756 list as one of their preconditions that the state_type argument have
16757 a valid value. However, according to 22.2.1.5.2, p6,
16758 codecvt::do_unshift() is the only codecvt member that is supposed to
16759 return error if the state_type object is invalid.
16760 </p>
16761
16762 <p>
16763 It seems to me that the treatment of state_type by all codecvt member
16764 functions should be the same and the current requirements should be
16765 changed. Since the detection of invalid state_type values may be
16766 difficult in general or computationally expensive in some specific
16767 cases, I propose the following:
16768 </p>
16769
16770
16771 <p><b>Proposed resolution:</b></p>
16772 <p>
16773 Add a new paragraph before 22.2.1.5.2, p5, and after the function
16774 declaration below
16775 </p>
16776 <pre>    result do_unshift(stateT&amp; state,
16777     externT* to, externT* to_limit, externT*&amp; to_next) const;
16778 </pre>
16779 <p>
16780 as follows:
16781 </p>
16782 <pre>    Requires: (to &lt;= to_end) well defined and true; state initialized,
16783     if at the beginning of a sequence, or else equal to the result of
16784     converting the preceding characters in the sequence.
16785 </pre>
16786 <p>
16787 and change the text in Table 54, row 4, the <b>error</b> row, under
16788 the heading Meaning, from
16789 </p>
16790 <pre>    state has invalid value
16791 </pre>
16792 <p>
16793 to
16794 </p>
16795 <pre>    an unspecified error has occurred
16796 </pre>
16797
16798
16799 <p><b>Rationale:</b></p>
16800 <p>The intent is that implementations should not be required to detect
16801 invalid state values; such a requirement appears nowhere else.  An
16802 invalid state value is a precondition violation, <i>i.e.</i> undefined
16803 behavior.  Implementations that do choose to detect invalid state
16804 values, or that choose to detect any other kind of error, may return
16805 <b>error</b> as an indication.</p>
16806
16807
16808
16809
16810
16811 <hr>
16812 <h3><a name="383"></a>383. Bidirectional iterator assertion typo</h3>
16813 <p><b>Section:</b> 24.1.4 [bidirectional.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16814  <b>Submitter:</b> ysapir (submitted via comp.std.c++) <b>Date:</b> 2002-10-17</p>
16815 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#bidirectional.iterators">issues</a> in [bidirectional.iterators].</p>
16816 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16817 <p><b>Discussion:</b></p>
16818 <p>
16819 Following a discussion on the boost list regarding end iterators and
16820 the possibility of performing operator--() on them, it seems to me
16821 that there is a typo in the standard.  This typo has nothing to do
16822 with that discussion.
16823 </p>
16824
16825 <p>
16826 I have checked this newsgroup, as well as attempted a search of the
16827 Active/Defect/Closed Issues List on the site for the words "s is
16828 derefer" so I believe this has not been proposed before.  Furthermore,
16829 the "Lists by Index" mentions only DR <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299">299</a> on section
16830 24.1.4, and DR <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299">299</a> is not related to this issue.
16831 </p>
16832
16833 <p>
16834 The standard makes the following assertion on bidirectional iterators,
16835 in section 24.1.4 [lib.bidirectional.iterators], Table 75:
16836 </p>
16837
16838 <pre>                         operational  assertion/note
16839 expression  return type   semantics    pre/post-condition
16840
16841 --r          X&amp;                        pre: there exists s such
16842                                        that r == ++s.
16843                                        post: s is dereferenceable.
16844                                        --(++r) == r.
16845                                        --r == --s implies r == s.
16846                                        &amp;r == &amp;--r.
16847 </pre>
16848
16849 <p>
16850 (See <a href="http://aspn.activestate.com/ASPN/Mail/Message/boost/1395763">http://aspn.activestate.com/ASPN/Mail/Message/boost/1395763</a>.)
16851 </p>
16852
16853 <p>
16854 In particular, "s is dereferenceable" seems to be in error.  It seems
16855 that the intention was to say "r is dereferenceable".
16856 </p>
16857
16858 <p>
16859 If it were to say "r is dereferenceable" it would
16860 make perfect sense.  Since s must be dereferenceable prior to
16861 operator++, then the natural result of operator-- (to undo operator++)
16862 would be to make r dereferenceable.  Furthermore, without other
16863 assertions, and basing only on precondition and postconditions, we
16864 could not otherwise know this.  So it is also interesting information.
16865 </p>
16866
16867
16868
16869 <p><b>Proposed resolution:</b></p>
16870 <p>
16871 Change the guarantee to "postcondition: r is dereferenceable."
16872 </p>
16873
16874
16875 <p><b>Rationale:</b></p><p>Fixes an obvious typo</p>
16876
16877
16878
16879
16880 <hr>
16881 <h3><a name="384"></a>384. equal_range has unimplementable runtime complexity</h3>
16882 <p><b>Section:</b> 25.3.3.3 [equal.range] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
16883  <b>Submitter:</b> Hans Bos <b>Date:</b> 2002-10-18</p>
16884 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#equal.range">issues</a> in [equal.range].</p>
16885 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
16886 <p><b>Discussion:</b></p>
16887 <p>
16888 Section 25.3.3.3 [equal.range]
16889 states that at most 2 * log(last - first) + 1
16890 comparisons are allowed for equal_range.
16891 </p>
16892
16893 <p>It is not possible to implement equal_range with these constraints.</p>
16894
16895 <p>In a range of one element as in:</p>
16896 <pre>    int x = 1;
16897     equal_range(&amp;x, &amp;x + 1, 1)
16898 </pre>
16899
16900 <p>it is easy to see that at least 2 comparison operations are needed.</p>
16901
16902 <p>For this case at most 2 * log(1) + 1 = 1 comparison is allowed.</p>
16903
16904 <p>I have checked a few libraries and they all use the same (nonconforming)
16905 algorithm for equal_range that has a complexity of</p>
16906 <pre>     2* log(distance(first, last)) + 2.
16907 </pre>
16908 <p>I guess this is the algorithm that the standard assumes for equal_range.</p>
16909
16910 <p>
16911 It is easy to see that 2 * log(distance) + 2 comparisons are enough
16912 since equal range can be implemented with lower_bound and upper_bound
16913 (both log(distance) + 1).
16914 </p>
16915
16916 <p>
16917 I think it is better to require something like 2log(distance) + O(1)  (or
16918 even logarithmic as multiset::equal_range).
16919 Then an implementation has more room to optimize for certain cases (e.g.
16920 have log(distance) characteristics when at most match is found in the range
16921 but 2log(distance) + 4 for the worst case).
16922 </p>
16923
16924
16925
16926 <p><b>Proposed resolution:</b></p>
16927 <p>In 25.3.3.1 [lower.bound]/4, change <tt>log(last - first) + 1</tt>
16928 to <tt>log<sub>2</sub>(last - first) + <i>O</i>(1)</tt>.</p>
16929
16930 <p>In 25.3.3.2 [upper.bound]/4, change <tt>log(last - first) + 1</tt>
16931 to <tt>log<sub>2</sub>(last - first) + <i>O</i>(1)</tt>.</p>
16932
16933 <p>In 25.3.3.3 [equal.range]/4, change <tt>2*log(last - first) + 1</tt>
16934 to <tt>2*log<sub>2</sub>(last - first) + <i>O</i>(1)</tt>.</p>
16935
16936 <p><i>[Matt provided wording]</i></p>
16937
16938
16939
16940 <p><b>Rationale:</b></p>
16941 <p>The LWG considered just saying <i>O</i>(log n) for all three, but
16942   decided that threw away too much valuable information.  The fact
16943   that lower_bound is twice as fast as equal_range is important.
16944   However, it's better to allow an arbitrary additive constant than to
16945   specify an exact count.  An exact count would have to
16946   involve <tt>floor</tt> or <tt>ceil</tt>.  It would be too easy to
16947   get this wrong, and don't provide any substantial value for users.</p>
16948
16949
16950
16951
16952 <hr>
16953 <h3><a name="386"></a>386. Reverse iterator's operator[] has impossible return type</h3>
16954 <p><b>Section:</b> 24.4.1.3.11 [reverse.iter.op-=] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
16955  <b>Submitter:</b> Matt Austern <b>Date:</b> 2002-10-23</p>
16956 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
16957 <p><b>Discussion:</b></p>
16958 <p>In 24.4.1.3.11 [reverse.iter.op-=], <tt>reverse_iterator&lt;&gt;::operator[]</tt> 
16959 is specified as having a return type of <tt>reverse_iterator::reference</tt>,
16960 which is the same as <tt>iterator_traits&lt;Iterator&gt;::reference</tt>.
16961 (Where <tt>Iterator</tt> is the underlying iterator type.)</p>
16962
16963 <p>The trouble is that <tt>Iterator</tt>'s own operator[] doesn't
16964   necessarily have a return type
16965   of <tt>iterator_traits&lt;Iterator&gt;::reference</tt>.   Its
16966   return type is merely required to be convertible
16967   to <tt>Iterator</tt>'s value type.  The return type specified for
16968   reverse_iterator's operator[] would thus appear to be impossible.</p>
16969
16970 <p>With the resolution of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#299">299</a>, the type of
16971   <tt>a[n]</tt> will continue to be required (for random access
16972   iterators) to be convertible to the value type, and also <tt>a[n] =
16973   t</tt> will be a valid expression.  Implementations of
16974   <tt>reverse_iterator</tt> will likely need to return a proxy from
16975   <tt>operator[]</tt> to meet these requirements. As mentioned in the
16976   comment from Dave Abrahams, the simplest way to specify that
16977   <tt>reverse_iterator</tt> meet this requirement to just mandate
16978   it and leave the return type of <tt>operator[]</tt> unspecified.</p>
16979
16980
16981
16982 <p><b>Proposed resolution:</b></p>
16983
16984 <p>In 24.4.1.2 [reverse.iter.requirements] change:</p>
16985
16986 <blockquote>
16987 <pre>reference operator[](difference_type n) const;
16988 </pre>
16989 </blockquote>
16990
16991 <p>to:</p>
16992
16993 <blockquote>
16994 <pre><b><i>unspecified</i></b> operator[](difference_type n) const; // see 24.1.5 [random.access.iterators]
16995 </pre>
16996 </blockquote>
16997
16998
16999
17000
17001 <p><i>[
17002 Comments from Dave Abrahams: IMO we should resolve 386 by just saying
17003     that the return type of reverse_iterator's operator[] is
17004     unspecified, allowing the random access iterator requirements to
17005     impose an appropriate return type.  If we accept 299's proposed
17006     resolution (and I think we should), the return type will be
17007     readable and writable, which is about as good as we can do.
17008 ]</i></p>
17009
17010
17011
17012
17013
17014
17015 <hr>
17016 <h3><a name="389"></a>389. Const overload of valarray::operator[] returns by value</h3>
17017 <p><b>Section:</b> 26.5.2.3 [valarray.access] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17018  <b>Submitter:</b> Gabriel Dos Reis <b>Date:</b> 2002-11-08</p>
17019 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#valarray.access">issues</a> in [valarray.access].</p>
17020 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17021 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#77">77</a></p>
17022 <p><b>Discussion:</b></p>
17023 <p>Consider the following program:</p>
17024 <pre>    #include &lt;iostream&gt;
17025     #include &lt;ostream&gt;
17026     #include &lt;vector&gt;
17027     #include &lt;valarray&gt;
17028     #include &lt;algorithm&gt;
17029     #include &lt;iterator&gt;
17030     template&lt;typename Array&gt;
17031     void print(const Array&amp; a)
17032     {
17033     using namespace std;
17034     typedef typename Array::value_type T;
17035     copy(&amp;a[0], &amp;a[0] + a.size(),
17036     ostream_iterator&lt;T&gt;(std::cout, " "));
17037     }
17038     template&lt;typename T, unsigned N&gt;
17039     unsigned size(T(&amp;)[N]) { return N; }
17040     int main()
17041     {
17042     double array[] = { 0.89, 9.3, 7, 6.23 };
17043     std::vector&lt;double&gt; v(array, array + size(array));
17044     std::valarray&lt;double&gt; w(array, size(array));
17045     print(v); // #1
17046     std::cout &lt;&lt; std::endl;
17047     print(w); // #2
17048     std::cout &lt;&lt; std::endl;
17049     }
17050 </pre>
17051
17052 <p>While the call numbered #1 succeeds, the call numbered #2 fails
17053 because the const version of the member function
17054 valarray&lt;T&gt;::operator[](size_t) returns a value instead of a
17055 const-reference. That seems to be so for no apparent reason, no
17056 benefit. Not only does that defeats users' expectation but it also
17057 does hinder existing software (written either in C or Fortran)
17058 integration within programs written in C++.  There is no reason why
17059 subscripting an expression of type valarray&lt;T&gt; that is const-qualified
17060 should not return a const T&amp;.</p>
17061
17062
17063 <p><b>Proposed resolution:</b></p>
17064 <p>In the class synopsis in 26.5.2 [template.valarray], and in
17065 26.5.2.3 [valarray.access] just above paragraph 1, change</p>
17066 <pre>  T operator[](size_t const);
17067 </pre>
17068 <p>to</p>
17069 <pre>  const T&amp; operator[](size_t const);
17070 </pre>
17071
17072 <p><i>[Kona: fixed a minor typo: put semicolon at the end of the line
17073   wehre it belongs.]</i></p>
17074
17075
17076
17077
17078 <p><b>Rationale:</b></p>
17079 <p>Return by value seems to serve no purpose.  Valaray was explicitly
17080 designed to have a specified layout so that it could easily be
17081 integrated with libraries in other languages, and return by value
17082 defeats that purpose.  It is believed that this change will have no
17083 impact on allowable optimizations.</p>
17084
17085
17086
17087
17088
17089 <hr>
17090 <h3><a name="391"></a>391. non-member functions specified as const</h3>
17091 <p><b>Section:</b> 22.1.3.2 [conversions] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17092  <b>Submitter:</b> James Kanze <b>Date:</b> 2002-12-10</p>
17093 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17094 <p><b>Discussion:</b></p>
17095 <p>
17096 The specifications of toupper and tolower both specify the functions as
17097 const, althought they are not member functions, and are not specified as
17098 const in the header file synopsis in section 22.1 [locales].
17099 </p>
17100
17101
17102 <p><b>Proposed resolution:</b></p>
17103 <p>In 22.1.3.2 [conversions], remove <tt>const</tt> from the function
17104   declarations of std::toupper and std::tolower</p>
17105
17106
17107 <p><b>Rationale:</b></p><p>Fixes an obvious typo</p>
17108
17109
17110
17111
17112 <hr>
17113 <h3><a name="395"></a>395. inconsistencies in the definitions of rand() and random_shuffle()</h3>
17114 <p><b>Section:</b> 26.7 [c.math] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17115  <b>Submitter:</b> James Kanze <b>Date:</b> 2003-01-03</p>
17116 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#c.math">issues</a> in [c.math].</p>
17117 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17118 <p><b>Discussion:</b></p>
17119 <p>
17120 In 26.7 [c.math], the C++ standard refers to the C standard for the
17121 definition of rand(); in the C standard, it is written that "The
17122 implementation shall behave as if no library function calls the rand
17123 function."
17124 </p>
17125
17126 <p>
17127 In 25.2.12 [alg.random.shuffle], there is no specification as to
17128 how the two parameter version of the function generates its random
17129 value.  I believe that all current implementations in fact call rand()
17130 (in contradiction with the requirement avove); if an implementation does
17131 not call rand(), there is the question of how whatever random generator
17132 it does use is seeded.  Something is missing.
17133 </p>
17134
17135
17136
17137 <p><b>Proposed resolution:</b></p>
17138 <p>
17139 In [lib.c.math], add a paragraph specifying that the C definition of
17140 rand shal be modified to say that "Unless otherwise specified, the
17141 implementation shall behave as if no library function calls the rand
17142 function."
17143 </p>
17144
17145 <p>
17146 In [lib.alg.random.shuffle], add a sentence to the effect that "In
17147 the two argument form of the function, the underlying source of
17148 random numbers is implementation defined. [Note: in particular, an
17149 implementation is permitted to use <tt>rand</tt>.]
17150 </p>
17151
17152
17153 <p><b>Rationale:</b></p>
17154 <p>The original proposed resolution proposed requiring the
17155   two-argument from of <tt>random_shuffle</tt> to
17156   use <tt>rand</tt>. We don't want to do that, because some existing
17157   implementations already use something else: gcc
17158   uses <tt>lrand48</tt>, for example.  Using <tt>rand</tt> presents a
17159   problem if the number of elements in the sequence is greater than
17160   RAND_MAX.</p> 
17161
17162
17163
17164
17165
17166 <hr>
17167 <h3><a name="400"></a>400. redundant type cast in lib.allocator.members</h3>
17168 <p><b>Section:</b> 20.7.5.1 [allocator.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17169  <b>Submitter:</b> Markus Mauhart <b>Date:</b> 2003-02-27</p>
17170 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.members">issues</a> in [allocator.members].</p>
17171 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17172 <p><b>Discussion:</b></p>
17173 <p>
17174 20.7.5.1 [allocator.members] allocator members, contains
17175 the following 3 lines:
17176 </p>
17177
17178 <pre>  12 Returns: new((void *) p) T( val)
17179      void destroy(pointer p);
17180   13 Returns: ((T*) p)-&gt;~T()
17181 </pre>
17182
17183 <p>
17184 The type cast "(T*) p" in the last line is redundant cause
17185 we know that std::allocator&lt;T&gt;::pointer is a typedef for T*.
17186 </p>
17187
17188
17189 <p><b>Proposed resolution:</b></p>
17190 <p>
17191 Replace "((T*) p)" with "p".
17192 </p>
17193
17194
17195 <p><b>Rationale:</b></p><p>Just a typo, this is really editorial.</p>
17196
17197
17198
17199
17200 <hr>
17201 <h3><a name="401"></a>401.  incorrect type casts in table 32 in lib.allocator.requirements</h3>
17202 <p><b>Section:</b> 20.1.2 [allocator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17203  <b>Submitter:</b> Markus Mauhart <b>Date:</b> 2003-02-27</p>
17204 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#allocator.requirements">active issues</a> in [allocator.requirements].</p>
17205 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.requirements">issues</a> in [allocator.requirements].</p>
17206 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17207 <p><b>Discussion:</b></p>
17208 <p>
17209 I think that in par2 of  [default.con.req] the last two
17210 lines of table 32 contain two incorrect type casts. The lines are ...
17211 </p>
17212
17213 <pre>  a.construct(p,t)   Effect: new((void*)p) T(t)
17214   a.destroy(p)       Effect: ((T*)p)?-&gt;~T()
17215 </pre>
17216
17217 <p>
17218 .... with the prerequisits coming from the preceding two paragraphs, especially
17219 from table 31:
17220 </p>
17221
17222 <pre>  alloc&lt;T&gt;             a     ;// an allocator for T
17223   alloc&lt;T&gt;::pointer    p     ;// random access iterator
17224                               // (may be different from T*)
17225   alloc&lt;T&gt;::reference  r = *p;// T&amp;
17226   T const&amp;             t     ;
17227 </pre>
17228
17229 <p>
17230 For that two type casts ("(void*)p" and "(T*)p") to be well-formed
17231 this would require then conversions to T* and void* for all
17232 alloc&lt;T&gt;::pointer, so it would implicitely introduce extra
17233 requirements for alloc&lt;T&gt;::pointer, additionally to the only
17234 current requirement (being a random access iterator).
17235 </p>
17236
17237
17238 <p><b>Proposed resolution:</b></p>
17239
17240 <p>
17241 Accept proposed wording from
17242 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2436.pdf">N2436</a> part 1.
17243 </p>
17244
17245 <p>
17246 Note: Actually I would prefer to replace "((T*)p)?-&gt;dtor_name" with
17247 "p?-&gt;dtor_name", but AFAICS this is not possible cause of an omission
17248 in 13.5.6 [over.ref] (for which I have filed another DR on 29.11.2002).
17249 </p>
17250
17251 <p><i>[Kona: The LWG thinks this is somewhere on the border between
17252   Open and NAD.  The intend is clear: <tt>construct</tt> constructs an
17253   object at the location <i>p</i>.  It's reading too much into the
17254   description to think that literally calling <tt>new</tt> is
17255   required.  Tweaking this description is low priority until we can do
17256   a thorough review of allocators, and, in particular, allocators with
17257   non-default pointer types.]</i></p>
17258
17259
17260 <p><i>[
17261 Batavia:  Proposed resolution changed to less code and more description.
17262 ]</i></p>
17263
17264
17265 <p><i>[
17266 post Oxford:  This would be rendered NAD Editorial by acceptance of
17267 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2257.html">N2257</a>.
17268 ]</i></p>
17269
17270
17271 <p><i>[
17272 Kona (2007): The LWG adopted the proposed resolution of N2387 for this issue which
17273 was subsequently split out into a separate paper N2436 for the purposes of voting.
17274 The resolution in N2436 addresses this issue.  The LWG voted to accelerate this
17275 issue to Ready status to be voted into the WP at Kona.
17276 ]</i></p>
17277
17278
17279
17280
17281
17282
17283
17284 <hr>
17285 <h3><a name="402"></a>402. wrong new expression in [some_]allocator::construct</h3>
17286 <p><b>Section:</b> 20.1.2 [allocator.requirements], 20.7.5.1 [allocator.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17287  <b>Submitter:</b> Markus Mauhart <b>Date:</b> 2003-02-27</p>
17288 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#allocator.requirements">active issues</a> in [allocator.requirements].</p>
17289 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.requirements">issues</a> in [allocator.requirements].</p>
17290 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17291 <p><b>Discussion:</b></p>
17292 <p>
17293 This applies to the new expression that is contained in both par12 of
17294 20.7.5.1 [allocator.members] and in par2 (table 32) of  [default.con.req].
17295 I think this new expression is wrong, involving unintended side
17296 effects.
17297 </p>
17298
17299
17300 <p>20.7.5.1 [allocator.members]  contains the following 3 lines:</p>
17301
17302 <pre>  11 Returns: the largest value N for which the call allocate(N,0) might succeed.
17303      void construct(pointer p, const_reference val);
17304   12 Returns: new((void *) p) T( val)
17305 </pre>
17306
17307
17308 <p> [default.con.req] in table 32 has the following line:</p>
17309 <pre>  a.construct(p,t)   Effect: new((void*)p) T(t)
17310 </pre>
17311
17312 <p>
17313 .... with the prerequisits coming from the preceding two paragraphs,
17314 especially from table 31:
17315 </p>
17316
17317 <pre>  alloc&lt;T&gt;             a     ;// an allocator for T
17318   alloc&lt;T&gt;::pointer    p     ;// random access iterator
17319                               // (may be different from T*)
17320   alloc&lt;T&gt;::reference  r = *p;// T&amp;
17321   T const&amp;             t     ;
17322 </pre>
17323
17324 <p>
17325 Cause of using "new" but not "::new", any existing "T::operator new"
17326 function will hide the global placement new function. When there is no
17327 "T::operator new" with adequate signature,
17328 every_alloc&lt;T&gt;::construct(..) is ill-formed, and most
17329 std::container&lt;T,every_alloc&lt;T&gt;&gt; use it; a workaround
17330 would be adding placement new and delete functions with adequate
17331 signature and semantic to class T, but class T might come from another
17332 party. Maybe even worse is the case when T has placement new and
17333 delete functions with adequate signature but with "unknown" semantic:
17334 I dont like to speculate about it, but whoever implements
17335 any_container&lt;T,any_alloc&gt; and wants to use construct(..)
17336 probably must think about it.
17337 </p>
17338
17339
17340 <p><b>Proposed resolution:</b></p>
17341 <p>
17342 Replace "new" with "::new" in both cases.
17343 </p>
17344
17345
17346
17347
17348
17349
17350
17351 <hr>
17352 <h3><a name="403"></a>403. basic_string::swap should not throw exceptions</h3>
17353 <p><b>Section:</b> 21.3.6.8 [string::swap] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17354  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2003-03-25</p>
17355 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string::swap">issues</a> in [string::swap].</p>
17356 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17357 <p><b>Discussion:</b></p>
17358
17359 <p>
17360 std::basic_string, 21.3 [basic.string] paragraph 2 says that
17361 basic_string "conforms to the requirements of a Sequence, as specified
17362 in (23.1.1)." The sequence requirements specified in (23.1.1) to not
17363 include any prohibition on swap members throwing exceptions.
17364 </p>
17365
17366 <p>
17367 Section 23.1 [container.requirements] paragraph 10 does limit conditions under
17368 which exceptions may be thrown, but applies only to "all container
17369 types defined in this clause" and so excludes basic_string::swap
17370 because it is defined elsewhere.
17371 </p>
17372
17373 <p>
17374 Eric Niebler points out that 21.3 [basic.string] paragraph 5 explicitly
17375 permits basic_string::swap to invalidates iterators, which is
17376 disallowed by 23.1 [container.requirements] paragraph 10. Thus the standard would
17377 be contradictory if it were read or extended to read as having
17378 basic_string meet 23.1 [container.requirements] paragraph 10 requirements.
17379 </p>
17380
17381 <p>
17382 Yet several LWG members have expressed the belief that the original
17383 intent was that basic_string::swap should not throw exceptions as
17384 specified by 23.1 [container.requirements] paragraph 10, and that the standard is
17385 unclear on this issue. The complexity of basic_string::swap is
17386 specified as "constant time", indicating the intent was to avoid
17387 copying (which could cause a bad_alloc or other exception). An
17388 important use of swap is to ensure that exceptions are not thrown in
17389 exception-safe code.
17390 </p>
17391
17392 <p>
17393 Note: There remains long standing concern over whether or not it is
17394 possible to reasonably meet the 23.1 [container.requirements] paragraph 10 swap
17395 requirements when allocators are unequal. The specification of
17396 basic_string::swap exception requirements is in no way intended to
17397 address, prejudice, or otherwise impact that concern.
17398 </p>
17399
17400
17401
17402
17403
17404
17405
17406 <p><b>Proposed resolution:</b></p>
17407 <p>
17408 In 21.3.6.8 [string::swap], add a throws clause:
17409 </p>
17410
17411 <p>
17412 Throws: Shall not throw exceptions.
17413 </p>
17414
17415
17416
17417
17418
17419 <hr>
17420 <h3><a name="404"></a>404. May a replacement allocation function be declared inline?</h3>
17421 <p><b>Section:</b> 17.4.3.5 [replacement.functions], 18.5.1 [new.delete] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17422  <b>Submitter:</b> Matt Austern <b>Date:</b> 2003-04-24</p>
17423 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17424 <p><b>Discussion:</b></p>
17425 <p>
17426 The eight basic dynamic memory allocation functions (single-object
17427 and array versions of ::operator new and ::operator delete, in the
17428 ordinary and nothrow forms) are replaceable.  A C++ program may
17429 provide an alternative definition for any of them, which will be used
17430 in preference to the implementation's definition.  
17431 </p>
17432
17433 <p>
17434 Three different parts of the standard mention requirements on
17435 replacement functions: 17.4.3.5 [replacement.functions], 18.5.1.1 [new.delete.single]
17436 and 18.5.1.2 [new.delete.array], and 3.7.2 [basic.stc.auto].
17437 </p>
17438
17439 <p>None of these three places say whether a replacement function may
17440   be declared inline.  18.5.1.1 [new.delete.single] paragraph 2 specifies a
17441   signature for the replacement function, but that's not enough:
17442   the <tt>inline</tt> specifier is not part of a function's signature.
17443   One might also reason from 7.1.2 [dcl.fct.spec] paragraph 2, which
17444   requires that "an inline function shall be defined in every
17445   translation unit in which it is used," but this may not be quite
17446   specific enough either.  We should either explicitly allow or
17447   explicitly forbid inline replacement memory allocation
17448   functions.</p>
17449
17450
17451 <p><b>Proposed resolution:</b></p>
17452 <p>
17453 Add a new sentence to the end of 17.4.3.5 [replacement.functions] paragraph 3:
17454 "The program's definitions shall not be specified as <tt>inline</tt>.
17455 No diagnostic is required."
17456 </p>
17457
17458 <p><i>[Kona: added "no diagnostic is required"]</i></p>
17459
17460
17461
17462
17463 <p><b>Rationale:</b></p>
17464 <p>
17465 The fact that <tt>inline</tt> isn't mentioned appears to have been
17466 nothing more than an oversight.  Existing implementations do not
17467 permit inline functions as replacement memory allocation functions.
17468 Providing this functionality would be difficult in some cases, and is
17469 believed to be of limited value.
17470 </p>
17471
17472
17473
17474
17475
17476 <hr>
17477 <h3><a name="405"></a>405. qsort and POD</h3>
17478 <p><b>Section:</b> 25.4 [alg.c.library] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17479  <b>Submitter:</b> Ray Lischner <b>Date:</b> 2003-04-08</p>
17480 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.c.library">issues</a> in [alg.c.library].</p>
17481 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17482 <p><b>Discussion:</b></p>
17483 <p>
17484 Section 25.4 [alg.c.library] describes bsearch and qsort, from the C
17485 standard library. Paragraph 4 does not list any restrictions on qsort,
17486 but it should limit the base parameter to point to POD.  Presumably,
17487 qsort sorts the array by copying bytes, which requires POD.
17488 </p>
17489
17490
17491 <p><b>Proposed resolution:</b></p>
17492 <p>
17493 In 25.4 [alg.c.library] paragraph 4, just after the declarations and
17494 before the nonnormative note, add these words: "both of which have the
17495 same behavior as the original declaration.  The behavior is undefined
17496 unless the objects in the array pointed to by <i>base</i> are of POD
17497 type."
17498 </p>
17499
17500 <p><i>[Something along these lines is clearly necessary.  Matt
17501   provided wording.]</i></p>
17502
17503
17504
17505
17506
17507
17508 <hr>
17509 <h3><a name="406"></a>406. vector::insert(s) exception safety</h3>
17510 <p><b>Section:</b> 23.2.6.4 [vector.modifiers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
17511  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2003-04-27</p>
17512 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector.modifiers">issues</a> in [vector.modifiers].</p>
17513 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
17514 <p><b>Discussion:</b></p>
17515 <p>
17516 There is a possible defect in the standard: the standard text was
17517 never intended to prevent arbitrary ForwardIterators, whose operations
17518 may throw exceptions, from being passed, and it also wasn't intended
17519 to require a temporary buffer in the case where ForwardIterators were
17520 passed (and I think most implementations don't use one).  As is, the
17521 standard appears to impose requirements that aren't met by any
17522 existing implementation.
17523 </p>
17524
17525
17526 <p><b>Proposed resolution:</b></p>
17527 <p>Replace 23.2.6.4 [vector.modifiers] paragraph 1 with:</p>
17528 <blockquote><p>
17529   1- Notes: Causes reallocation if the new size is greater than the
17530   old capacity. If no reallocation happens, all the iterators and
17531   references before the insertion point remain valid. If an exception
17532   is thrown other than by the copy constructor or assignment operator
17533   of T or by any InputIterator operation there are no effects.
17534 </p></blockquote>
17535
17536 <p><i>[We probably need to say something similar for deque.]</i></p>
17537
17538
17539
17540
17541
17542
17543
17544 <hr>
17545 <h3><a name="407"></a>407. Can singular iterators be destroyed?</h3>
17546 <p><b>Section:</b> 24.1 [iterator.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17547  <b>Submitter:</b> Nathan Myers <b>Date:</b> 2003-06-03</p>
17548 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#iterator.requirements">active issues</a> in [iterator.requirements].</p>
17549 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iterator.requirements">issues</a> in [iterator.requirements].</p>
17550 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17551 <p><b>Discussion:</b></p>
17552 <p>
17553 Clause 24.1 [iterator.requirements], paragraph 5, says that the only expression
17554 that is defined for a singular iterator is "an assignment of a
17555 non-singular value to an iterator that holds a singular value".  This 
17556 means that destroying a singular iterator (e.g. letting an automatic
17557 variable go out of scope) is technically undefined behavior.  This
17558 seems overly strict, and probably unintentional.
17559 </p>
17560
17561
17562 <p><b>Proposed resolution:</b></p>
17563 <p>
17564 Change the sentence in question to "... the only exceptions are
17565 destroying an iterator that holds a singular value, or the assignment
17566 of a non-singular value to an iterator that holds a singular value."
17567 </p>
17568
17569
17570
17571
17572
17573 <hr>
17574 <h3><a name="409"></a>409. Closing an fstream should clear error state</h3>
17575 <p><b>Section:</b> 27.8.1.9 [ifstream.members], 27.8.1.13 [ofstream.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
17576  <b>Submitter:</b> Nathan Myers <b>Date:</b> 2003-06-03</p>
17577 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ifstream.members">issues</a> in [ifstream.members].</p>
17578 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
17579 <p><b>Discussion:</b></p>
17580 <p>
17581 A strict reading of 27.8.1 [fstreams] shows that opening or
17582 closing a basic_[io]fstream does not affect the error bits.  This
17583 means, for example, that if you read through a file up to EOF, and
17584 then close the stream and reopen it at the beginning of the file,
17585 the EOF bit in the stream's error state is still set.  This is
17586 counterintuitive.
17587 </p>
17588 <p>
17589 The LWG considered this issue once before, as issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#22">22</a>,
17590 and put in a footnote to clarify that the strict reading was indeed
17591 correct.  We did that because we believed the standard was
17592 unambiguous and consistent, and that we should not make architectural
17593 changes in a TC.  Now that we're working on a new revision of the
17594 language, those considerations no longer apply.
17595 </p>
17596
17597
17598 <p><b>Proposed resolution:</b></p>
17599
17600 <p>Change 27.8.1.9 [ifstream.members], para. 3 from:</p>
17601
17602 <blockquote><p>
17603 Calls rdbuf()-&gt;open(s,mode|in). If that function returns a null
17604 pointer, calls setstate(failbit) (which may throw ios_base::failure
17605 [Footnote: (lib.iostate.flags)].
17606 </p></blockquote>
17607
17608 <p>to:</p>
17609
17610 <blockquote><p>Calls rdbuf()-&gt;open(s,mode|in). If that function
17611 returns a null pointer, calls setstate(failbit) (which may throw
17612 ios_base::failure [Footnote: (lib.iostate.flags)), else calls clear().
17613 </p></blockquote>
17614
17615 <p>Change 27.8.1.13 [ofstream.members], para. 3 from:</p>
17616
17617 <blockquote><p>Calls rdbuf()-&gt;open(s,mode|out). If that function
17618 returns a null pointer, calls setstate(failbit) (which may throw
17619 ios_base::failure [Footnote: (lib.iostate.flags)).
17620 </p></blockquote>
17621
17622 <p>to:</p>
17623
17624 <blockquote><p>Calls rdbuf()-&gt;open(s,mode|out). If that function
17625 returns a null pointer, calls setstate(failbit) (which may throw
17626 ios_base::failure [Footnote: (lib.iostate.flags)), else calls clear().
17627 </p></blockquote>
17628
17629 <p>Change 27.8.1.17 [fstream.members], para. 3 from:</p>
17630
17631 <blockquote><p>Calls rdbuf()-&gt;open(s,mode), If that function returns
17632 a null pointer, calls setstate(failbit), (which may throw
17633 ios_base::failure). (lib.iostate.flags) )
17634 </p></blockquote>
17635
17636 <p>to:</p>
17637
17638 <blockquote><p>Calls rdbuf()-&gt;open(s,mode), If that function returns
17639 a null pointer, calls setstate(failbit), (which may throw
17640 ios_base::failure). (lib.iostate.flags) ), else calls clear().
17641 </p></blockquote>
17642
17643
17644
17645 <p><i>[Kona: the LWG agrees this is a good idea.  Post-Kona: Bill
17646 provided wording.  He suggests having open, not close, clear the error
17647 flags.]</i></p>
17648
17649
17650 <p><i>[Post-Sydney: Howard provided a new proposed resolution.  The
17651   old one didn't make sense because it proposed to fix this at the
17652   level of basic_filebuf, which doesn't have access to the stream's
17653   error state.  Howard's proposed resolution fixes this at the level
17654   of the three fstream class template instead.]</i></p>
17655
17656
17657
17658
17659
17660
17661
17662
17663 <hr>
17664 <h3><a name="410"></a>410. Missing semantics for stack and queue comparison operators</h3>
17665 <p><b>Section:</b> 23.2.4.1 [list.cons], 23.2.4.3 [list.modifiers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17666  <b>Submitter:</b> Hans Bos <b>Date:</b> 2003-06-07</p>
17667 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#list.cons">issues</a> in [list.cons].</p>
17668 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17669 <p><b>Discussion:</b></p>
17670 <p>
17671 Sections 23.2.4.1 [list.cons] and 23.2.4.3 [list.modifiers] list
17672 comparison operators (==, !=, &lt;, &lt;=, &gt;, =&gt;) for queue and
17673 stack.  Only the semantics for queue::operator== (23.2.4.1 [list.cons] par2) and queue::operator&lt; (23.2.4.1 [list.cons]
17674 par3) are defined.
17675 </p>
17676
17677
17678 <p><b>Proposed resolution:</b></p>
17679
17680 <p>Add the following new paragraphs after 23.2.4.1 [list.cons]
17681   paragraph 3:</p>
17682
17683 <blockquote>
17684
17685 <pre>  operator!=
17686 </pre>
17687 <p>Returns: <tt>x.c != y.c</tt></p>
17688
17689 <pre>  operator&gt;
17690 </pre>
17691 <p>Returns: <tt>x.c &gt; y.c</tt></p>
17692
17693 <pre>  operator&lt;=
17694 </pre>
17695 <p>Returns: <tt>x.c &lt;= y.c</tt></p>
17696
17697 <pre>  operator&gt;=
17698 </pre>
17699 <p>Returns: <tt>x.c &gt;= y.c</tt></p>
17700
17701 </blockquote>
17702
17703 <p>Add the following paragraphs at the end of 23.2.4.3 [list.modifiers]:</p>
17704
17705 <blockquote>
17706
17707 <pre>  operator==
17708 </pre>
17709 <p>Returns: <tt>x.c == y.c</tt></p>
17710
17711 <pre>  operator&lt;
17712 </pre>
17713 <p>Returns: <tt>x.c &lt; y.c</tt></p>
17714
17715 <pre>  operator!=
17716 </pre>
17717 <p>Returns: <tt>x.c != y.c</tt></p>
17718
17719 <pre>  operator&gt;
17720 </pre>
17721 <p>Returns: <tt>x.c &gt; y.c</tt></p>
17722
17723 <pre>  operator&lt;=
17724 </pre>
17725 <p>Returns: <tt>x.c &lt;= y.c</tt></p>
17726
17727 <pre>  operator&gt;=
17728 </pre>
17729 <p>Returns: <tt>x.c &gt;= y.c</tt></p>
17730
17731 </blockquote>
17732
17733
17734 <p><i>[Kona: Matt provided wording.]</i></p>
17735
17736
17737
17738
17739 <p><b>Rationale:</b></p>
17740 <p>There isn't any real doubt about what these operators are
17741 supposed to do, but we ought to spell it out.</p>
17742
17743
17744
17745
17746
17747 <hr>
17748 <h3><a name="411"></a>411. Wrong names of set member functions</h3>
17749 <p><b>Section:</b> 25.3.5 [alg.set.operations] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17750  <b>Submitter:</b> Daniel Frey <b>Date:</b> 2003-07-09</p>
17751 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.set.operations">issues</a> in [alg.set.operations].</p>
17752 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17753 <p><b>Discussion:</b></p>
17754 <p>
17755 25.3.5 [alg.set.operations] paragraph 1 reads:
17756 "The semantics of the set operations are generalized to multisets in a 
17757 standard way by defining union() to contain the maximum number of 
17758 occurrences of every element, intersection() to contain the minimum, and 
17759 so on."
17760 </p>
17761
17762 <p>
17763 This is wrong.  The name of the functions are set_union() and
17764 set_intersection(), not union() and intersection().
17765 </p>
17766
17767
17768 <p><b>Proposed resolution:</b></p>
17769 <p>Change that sentence to use the correct names.</p>
17770
17771
17772
17773
17774
17775 <hr>
17776 <h3><a name="412"></a>412. Typo in 27.4.4.3</h3>
17777 <p><b>Section:</b> 27.4.4.3 [iostate.flags] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17778  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-07-10</p>
17779 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostate.flags">issues</a> in [iostate.flags].</p>
17780 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17781 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#429">429</a></p>
17782 <p><b>Discussion:</b></p>
17783 <p>
17784 The Effects clause in 27.4.4.3 [iostate.flags] paragraph 5 says that the
17785 function only throws if the respective bits are already set prior to
17786 the function call. That's obviously not the intent. The typo ought to
17787 be corrected and the text reworded as: "If (<i>state</i> &amp;
17788 exceptions()) == 0, returns. ..."
17789 </p>
17790
17791
17792 <p><b>Proposed resolution:</b></p>
17793 <p>
17794 In 27.4.4.3 [iostate.flags] paragraph 5, replace "If (rdstate() &amp;
17795 exceptions()) == 0" with "If ((state | (rdbuf() ? goodbit : badbit))
17796 &amp; exceptions()) == 0".
17797 </p>
17798
17799 <p><i>[Kona: the original proposed resolution wasn't quite right.  We
17800   really do mean rdstate(); the ambiguity is that the wording in the
17801   standard doesn't make it clear whether we mean rdstate() before
17802   setting the new state, or rdsate() after setting it.  We intend the
17803   latter, of course. Post-Kona: Martin provided wording.]</i></p>
17804
17805
17806
17807
17808
17809
17810
17811 <hr>
17812 <h3><a name="413"></a>413. Proposed resolution to LDR#64 still wrong</h3>
17813 <p><b>Section:</b> 27.6.1.2.3 [istream::extractors] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
17814  <b>Submitter:</b> Bo Persson <b>Date:</b> 2003-07-13</p>
17815 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream::extractors">issues</a> in [istream::extractors].</p>
17816 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
17817 <p><b>Discussion:</b></p>
17818 <p>
17819 The second sentence of the proposed resolution says:
17820 </p>
17821
17822 <p>
17823 "If it inserted no characters because it caught an exception thrown
17824 while extracting characters from sb and ..."
17825 </p>
17826
17827 <p>
17828 However, we are not extracting from sb, but extracting from the
17829 basic_istream (*this) and inserting into sb. I can't really tell if
17830 "extracting" or "sb" is a typo.
17831 </p>
17832
17833 <p><i>[
17834 Sydney: Definitely a real issue. We are, indeed, extracting characters
17835 from an istream and not from sb. The problem was there in the FDIS and
17836 wasn't fixed by issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#64">64</a>. Probably what was intended was
17837 to have *this instead of sb. We're talking about the exception flag
17838 state of a basic_istream object, and there's only one basic_istream
17839 object in this discussion, so that would be a consistent
17840 interpretation.  (But we need to be careful: the exception policy of
17841 this member function must be consistent with that of other
17842 extractors.)  PJP will provide wording.
17843 ]</i></p>
17844
17845
17846
17847
17848 <p><b>Proposed resolution:</b></p>
17849 <p>Change the sentence from:</p>
17850
17851 <blockquote><p>
17852 If it inserted no characters because it caught an exception thrown
17853 while extracting characters from sb and failbit is on in exceptions(),
17854 then the caught exception is rethrown.
17855 </p></blockquote>
17856
17857 <p>to:</p>
17858
17859 <blockquote><p>
17860 If it inserted no characters because it caught an exception thrown
17861 while extracting characters from *this and failbit is on in exceptions(),
17862 then the caught exception is rethrown.
17863 </p></blockquote>
17864
17865
17866
17867
17868
17869 <hr>
17870 <h3><a name="414"></a>414. Which iterators are invalidated by v.erase()?</h3>
17871 <p><b>Section:</b> 23.2.6.4 [vector.modifiers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17872  <b>Submitter:</b> Matt Austern <b>Date:</b> 2003-08-19</p>
17873 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector.modifiers">issues</a> in [vector.modifiers].</p>
17874 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17875 <p><b>Discussion:</b></p>
17876 <p>
17877 Consider the following code fragment:
17878 </p>
17879 <blockquote>
17880 <pre>int A[8] = { 1,3,5,7,9,8,4,2 };
17881 std::vector&lt;int&gt; v(A, A+8);
17882
17883 std::vector&lt;int&gt;::iterator i1 = v.begin() + 3;
17884 std::vector&lt;int&gt;::iterator i2 = v.begin() + 4;
17885 v.erase(i1);
17886 </pre>
17887 </blockquote>
17888
17889 <p>
17890 Which iterators are invalidated by <tt>v.erase(i1)</tt>: i1, i2,
17891 both, or neither?
17892 </p>
17893
17894 <p>
17895 On all existing implementations that I know of, the status of i1 and
17896 i2 is the same: both of them will be iterators that point to some
17897 elements of the vector (albeit not the same elements they did
17898 before).  You won't get a crash if you use them.  Depending on 
17899 exactly what you mean by "invalidate", you might say that neither one
17900 has been invalidated because they still point to <i>something</i>,
17901 or you might say that both have been invalidated because in both
17902 cases the elements they point to have been changed out from under the
17903 iterator.
17904 </p>
17905
17906 <p>
17907 The standard doesn't say either of those things.  It says that erase
17908 invalidates all iterators and references "after the point of the
17909 erase".  This doesn't include i1, since it's at the point of the
17910 erase instead of after it.  I can't think of any sensible definition
17911 of invalidation by which one can say that i2 is invalidated but i1
17912 isn't.
17913 </p>
17914
17915 <p>
17916 (This issue is important if you try to reason about iterator validity
17917 based only on the guarantees in the standard, rather than reasoning
17918 from typical implementation techniques.  Strict debugging modes,
17919 which some programmers find useful, do not use typical implementation
17920 techniques.)
17921 </p>
17922
17923
17924 <p><b>Proposed resolution:</b></p>
17925 <p>
17926 In 23.2.6.4 [vector.modifiers] paragraph 3, change "Invalidates all the
17927 iterators and references after the point of the erase" to
17928 "Invalidates iterators and references at or after the point of the
17929 erase". 
17930 </p>
17931
17932
17933 <p><b>Rationale:</b></p>
17934 <p>I believe this was essentially a typographical error, and that it
17935   was taken for granted that erasing an element invalidates iterators
17936   that point to it.  The effects clause in question treats iterators
17937   and references in parallel, and it would seem counterintuitive to
17938   say that a reference to an erased value remains valid.</p>
17939
17940
17941
17942
17943
17944 <hr>
17945 <h3><a name="415"></a>415. behavior of std::ws</h3>
17946 <p><b>Section:</b> 27.6.1.4 [istream.manip] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17947  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
17948 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17949 <p><b>Discussion:</b></p>
17950 <p>
17951 According to 27.6.1.4, the ws() manipulator is not required to construct
17952 the sentry object. The manipulator is also not a member function so the
17953 text in 27.6.1, p1 through 4 that describes the exception policy for
17954 istream member functions does not apply. That seems inconsistent with
17955 the rest of extractors and all the other input functions (i.e., ws will
17956 not cause a tied stream to be flushed before extraction, it doesn't check
17957 the stream's exceptions or catch exceptions thrown during input, and it
17958 doesn't affect the stream's gcount).
17959 </p>
17960
17961
17962 <p><b>Proposed resolution:</b></p>
17963 <p>
17964 Add to 27.6.1.4 [istream.manip], immediately before the first sentence
17965 of paragraph 1, the following text:
17966 </p>
17967
17968     <blockquote><p>
17969     Behaves as an unformatted input function (as described in
17970     27.6.1.3, paragraph 1), except that it does not count the number
17971     of characters extracted and does not affect the value returned by
17972     subsequent calls to is.gcount(). After constructing a sentry
17973     object...  
17974     </p></blockquote>
17975
17976 <p><i>[Post-Kona: Martin provided wording]</i></p>
17977
17978
17979
17980
17981
17982
17983 <hr>
17984 <h3><a name="416"></a>416. definitions of XXX_MIN and XXX_MAX macros in climits</h3>
17985 <p><b>Section:</b> 18.2.2 [c.limits] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
17986  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
17987 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
17988 <p><b>Discussion:</b></p>
17989         <p>
17990
17991 Given two overloads of the function foo(), one taking an argument of type
17992 int and the other taking a long, which one will the call foo(LONG_MAX)
17993 resolve to? The expected answer should be foo(long), but whether that
17994 is true depends on the #defintion of the LONG_MAX macro, specifically
17995 its type. This issue is about the fact that the type of these macros
17996 is not actually required to be the same as the the type each respective
17997 limit.
17998 <br>
17999
18000 Section 18.2.2 of the C++ Standard does not specify the exact types of
18001 the XXX_MIN and XXX_MAX macros #defined in the &lt;climits&gt; and &lt;limits.h&gt;
18002 headers such as INT_MAX and LONG_MAX and instead defers to the C standard.
18003 <br>
18004
18005 Section 5.2.4.2.1, p1 of the C standard specifies that "The values [of
18006 these constants] shall be replaced by constant expressions suitable for use
18007 in #if preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX,
18008 the following shall be replaced by expressions that have the same type as
18009 would an expression that is an object of the corresponding type converted
18010 according to the integer promotions."
18011 <br>
18012
18013 The "corresponding type converted according to the integer promotions" for
18014 LONG_MAX is, according to 6.4.4.1, p5 of the C standard, the type of long
18015 converted to the first of the following set of types that can represent it:
18016 int, long int, long long int. So on an implementation where (sizeof(long)
18017 == sizeof(int)) this type is actually int, while on an implementation where
18018 (sizeof(long) &gt; sizeof(int)) holds this type will be long.
18019 <br>
18020
18021 This is not an issue in C since the type of the macro cannot be detected
18022 by any conforming C program, but it presents a portability problem in C++
18023 where the actual type is easily detectable by overload resolution.
18024
18025         </p>
18026 <p><i>[Kona: the LWG does not believe this is a defect.  The C macro
18027   definitions are what they are; we've got a better
18028   mechanism, <tt>std::numeric_limits</tt>, that is specified more
18029   precisely than the C limit macros.  At most we should add a
18030   nonnormative note recommending that users who care about the exact
18031   types of limit quantities should use &lt;limits&gt; instead of
18032   &lt;climits&gt;.]</i></p>
18033
18034
18035     
18036
18037 <p><b>Proposed resolution:</b></p>
18038
18039 <p>
18040 Change 18.2.2 [c.limits], paragraph 2:
18041 </p>
18042
18043 <blockquote><p>
18044 -2- The contents are the same as the Standard C library header <tt>&lt;limits.h&gt;</tt>.
18045 <ins>[<i>Note:</i> The types of the macros in <tt>&lt;climits&gt;</tt> are not guaranteed
18046 to match the type to which they refer.<i>--end note</i>]</ins>
18047 </p></blockquote>
18048
18049
18050
18051
18052
18053 <hr>
18054 <h3><a name="420"></a>420. is std::FILE a complete type?</h3>
18055 <p><b>Section:</b> 27.8.1 [fstreams] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18056  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
18057 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#fstreams">issues</a> in [fstreams].</p>
18058 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18059 <p><b>Discussion:</b></p>
18060 <p>
18061 7.19.1, p2, of C99 requires that the FILE type only be declared in
18062 &lt;stdio.h&gt;.  None of the (implementation-defined) members of the
18063 struct is mentioned anywhere for obvious reasons.
18064 </p>
18065
18066 <p>
18067 C++ says in 27.8.1, p2 that FILE is a type that's defined in &lt;cstdio&gt;. Is
18068 it really the intent that FILE be a complete type or is an implementation
18069 allowed to just declare it without providing a full definition?
18070 </p>
18071
18072
18073 <p><b>Proposed resolution:</b></p>
18074 <p>In the first sentence of 27.8.1 [fstreams] paragraph 2, change
18075   "defined" to "declared".</p>
18076
18077
18078 <p><b>Rationale:</b></p>
18079 <p>We don't want to impose any restrictions beyond what the C standard
18080   already says. We don't want to make anything implementation defined,
18081   because that imposes new requirements in implementations.</p>
18082
18083
18084
18085
18086
18087 <hr>
18088 <h3><a name="422"></a>422. explicit specializations of member functions of class templates</h3>
18089 <p><b>Section:</b> 17.4.3.2 [reserved.names] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18090  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
18091 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#reserved.names">issues</a> in [reserved.names].</p>
18092 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18093 <p><b>Discussion:</b></p>
18094 <p>
18095 It has been suggested that 17.4.3.1, p1 may or may not allow programs to
18096 explicitly specialize members of standard templates on user-defined types.
18097 The answer to the question might have an impact where library requirements
18098 are given using the "as if" rule. I.e., if programs are allowed to specialize
18099 member functions they will be able to detect an implementation's strict
18100 conformance to Effects clauses that describe the behavior of the function
18101 in terms of the other member function (the one explicitly specialized by
18102 the program) by relying on the "as if" rule.
18103 </p>
18104
18105
18106 <p><b>Proposed resolution:</b></p>
18107
18108 <p>
18109   Add the following sentence to 17.4.3.2 [reserved.names], p1:
18110 </p>
18111
18112 <blockquote><p>
18113 It is undefined for a C++ program to add declarations or definitions to
18114 namespace std or namespaces within namespace <tt>std</tt> unless otherwise specified. A
18115 program may add template specializations for any standard library template to
18116 namespace <tt>std</tt>. Such a specialization (complete or partial) of a standard library
18117 template results in undefined behavior unless the declaration depends on a
18118 user-defined type of external linkage and unless the specialization meets the
18119 standard library requirements for the original template.<sup>168)</sup>
18120 <ins>A program has undefined behavior if it declares</ins>
18121 </p>
18122 <ul>
18123 <li><ins>an explicit specialization of any member function of a standard
18124             library class template, or</ins></li>
18125 <li><ins>an explicit specialization of any member function template of a
18126             standard library class or class template, or</ins></li>
18127 <li><ins>an explicit or partial specialization of any member class
18128             template of a standard library class or class template.</ins></li>
18129 </ul>
18130 <p>
18131 A program may explicitly instantiate any templates in the standard library only
18132 if the declaration depends on the name of a user-defined type of external
18133 linkage and the instantiation meets the standard library requirements for the
18134 original template.
18135 </p></blockquote>
18136
18137 <p><i>[Kona: straw poll was 6-1 that user programs should not be
18138   allowed to specialize individual member functions of standard
18139   library class templates, and that doing so invokes undefined
18140   behavior. Post-Kona: Martin provided wording.]</i></p>
18141
18142
18143 <p><i>[Sydney: The LWG agrees that the standard shouldn't permit users
18144 to specialize individual member functions unless they specialize the
18145 whole class, but we're not sure these words say what we want them to;
18146 they could be read as prohibiting the specialization of any standard
18147 library class templates. We need to consult with CWG to make sure we
18148 use the right wording.]</i></p>
18149
18150
18151
18152
18153
18154
18155 <hr>
18156 <h3><a name="425"></a>425. return value of std::get_temporary_buffer</h3>
18157 <p><b>Section:</b> 20.7.8 [temporary.buffer] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18158  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
18159 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18160 <p><b>Discussion:</b></p>
18161 <p>
18162 The standard is not clear about the requirements on the value returned from
18163 a call to get_temporary_buffer(0). In particular, it fails to specify whether
18164 the call should return a distinct pointer each time it is called (like
18165 operator new), or whether the value is unspecified (as if returned by
18166 malloc). The standard also fails to mention what the required behavior
18167 is when the argument is less than 0.
18168 </p>
18169
18170
18171 <p><b>Proposed resolution:</b></p>
18172 <p>Change 20.5.3 [meta.help] paragraph 2 from "...or a pair of 0
18173 values if no storage can be obtained" to "...or a pair of 0 values if
18174 no storage can be obtained or if <i>n</i> &lt;= 0."</p>
18175 <p><i>[Kona: Matt provided wording]</i></p>
18176
18177
18178
18179
18180
18181 <hr>
18182 <h3><a name="426"></a>426. search_n(), fill_n(), and generate_n() with negative n</h3>
18183 <p><b>Section:</b> 25.1.12 [alg.search], 25.2.6 [alg.fill], 25.2.7 [alg.generate] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18184  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
18185 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.search">issues</a> in [alg.search].</p>
18186 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18187 <p><b>Discussion:</b></p>
18188 <p>
18189 The complexity requirements for these function templates are incorrect
18190 (or don't even make sense) for negative n:</p>
18191
18192 <p>25.1.9, p7 (search_n):
18193 <br>
18194 Complexity: At most (last1 - first1) * count applications
18195 of the corresponding predicate.</p>
18196
18197 <p>25.2.5, p3 (fill_n):
18198 <br>
18199 Complexity: Exactly last - first (or n) assignments.</p>
18200
18201 <p>25.2.6, p3 (generate_n):
18202 <br>
18203 Complexity: Exactly last - first (or n) assignments.</p>
18204
18205 <p>
18206 In addition, the Requirements or the Effects clauses for the latter two
18207 templates don't say anything about the behavior when n is negative.
18208 </p>
18209
18210
18211 <p><b>Proposed resolution:</b></p>
18212 <p>Change 25.1.9, p7 to</p>
18213
18214 <blockquote><p>
18215 Complexity: At most (last1 - first1) * count applications
18216 of the corresponding predicate if count is positive,
18217 or 0 otherwise.
18218 </p></blockquote>
18219
18220 <p>Change 25.2.5, p2 to</p>
18221 <blockquote><p>
18222 Effects: Assigns value through all the iterators in the range [first,
18223 last), or [first, first + n) if n is positive, none otherwise.
18224 </p></blockquote>
18225
18226 <p>Change 25.2.5, p3 to:</p>
18227 <blockquote><p>
18228 Complexity: Exactly last - first (or n if n is positive,
18229 or 0 otherwise) assignments.
18230 </p></blockquote>
18231
18232 <p>
18233 Change 25.2.6, p1 
18234 to (notice the correction for the misspelled "through"):
18235 </p>
18236 <blockquote><p>
18237 Effects: Invokes the function object genand assigns the return
18238 value of gen through all the iterators in the range [first, last),
18239 or [first, first + n) if n is positive, or [first, first)
18240 otherwise.
18241 </p></blockquote>
18242
18243 <p>Change 25.2.6, p3 to:</p>
18244 <blockquote><p>
18245 Complexity: Exactly last - first (or n if n is positive,
18246 or 0 otherwise) assignments.
18247 </p></blockquote>
18248
18249
18250 <p><b>Rationale:</b></p>
18251 <p>Informally, we want to say that whenever we see a negative number
18252   we treat it the same as if it were zero.  We believe the above
18253   changes do that (although they may not be the minimal way of saying
18254   so).  The LWG considered and rejected the alternative of saying that
18255   negative numbers are undefined behavior.</p>
18256
18257
18258
18259
18260
18261 <hr>
18262 <h3><a name="428"></a>428. string::erase(iterator) validity</h3>
18263 <p><b>Section:</b> 21.3.6.5 [string::erase] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18264  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-09-18</p>
18265 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string::erase">issues</a> in [string::erase].</p>
18266 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18267 <p><b>Discussion:</b></p>
18268 <p>
18269 23.1.1, p3 along with Table 67 specify as a prerequisite for a.erase(q)
18270 that q must be a valid dereferenceable iterator into the sequence a.
18271 </p>
18272
18273 <p>
18274 However, 21.3.5.5, p5 describing string::erase(p) only requires that
18275 p be a valid iterator.
18276 </p>
18277
18278 <p>
18279 This may be interepreted as a relaxation of the general requirement,
18280 which is most likely not the intent.
18281 </p>
18282
18283
18284 <p><b>Proposed resolution:</b></p>
18285 <p>Remove 21.3.6.5 [string::erase] paragraph 5.</p>
18286
18287
18288 <p><b>Rationale:</b></p>
18289 <p>The LWG considered two options: changing the string requirements to
18290   match the general container requirements, or just removing the
18291   erroneous string requirements altogether.  The LWG chose the latter
18292   option, on the grounds that duplicating text always risks the
18293   possibility that it might be duplicated incorrectly.</p>
18294
18295
18296
18297
18298
18299 <hr>
18300 <h3><a name="432"></a>432. stringbuf::overflow() makes only one write position available</h3>
18301 <p><b>Section:</b> 27.7.1.4 [stringbuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18302  <b>Submitter:</b> Christian W Brock <b>Date:</b> 2003-09-24</p>
18303 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#stringbuf.virtuals">issues</a> in [stringbuf.virtuals].</p>
18304 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18305 <p><b>Discussion:</b></p>
18306 <p>27.7.1.3 par 8 says:</p>
18307 <blockquote><p>
18308 Notes: The function can make a write position available only if
18309     ( mode &amp; ios_base::out) != 0. To make a write position
18310     available, the function reallocates (or initially allocates) an
18311     array object with a sufficient number of elements to hold the
18312     current array object (if any), plus one additional write position.
18313     If ( mode &amp; ios_base::in) != 0, the function alters the read end
18314     pointer egptr() to point just past the new write position (as
18315     does the write end pointer epptr()).
18316 </p></blockquote>
18317
18318 <p>
18319 The sentences "plus one additional write position." and especially
18320     "(as does the write end pointer epptr())" COULD by interpreted
18321     (and is interpreted by at least my library vendor) as:
18322 </p>
18323
18324 <blockquote><p>
18325     post-condition: epptr() == pptr()+1
18326 </p></blockquote>
18327
18328 <p>
18329 This WOULD force sputc() to call the virtual overflow() each time.
18330 </p>
18331
18332 <p>The proposed change also affects Defect Report 169.</p>
18333
18334
18335
18336 <p><b>Proposed resolution:</b></p>
18337 <p>27.7.1.1/2 Change:</p>
18338
18339 <blockquote><p>
18340 2- Notes: The function allocates no array object.
18341 </p></blockquote>
18342
18343 <p>
18344 to:
18345 </p>
18346
18347 <blockquote><p>
18348 2- Postcondition: str() == "".
18349 </p></blockquote>
18350
18351 <p>
18352 27.7.1.1/3 Change:
18353 </p>
18354
18355 <blockquote>
18356 <p>
18357 -3- Effects: Constructs an object of class basic_stringbuf,
18358 initializing the base class with basic_streambuf()
18359 (lib.streambuf.cons), and initializing mode with which . Then copies
18360 the content of str into the basic_stringbuf underlying character
18361 sequence and initializes the input and output sequences according to
18362 which. If which &amp; ios_base::out is true, initializes the output
18363 sequence with the underlying sequence. If which &amp; ios_base::in is
18364 true, initializes the input sequence with the underlying sequence.
18365 </p>
18366 </blockquote>
18367
18368 <p>to:</p>
18369
18370 <blockquote>
18371 <p>
18372 -3- Effects: Constructs an object of class basic_stringbuf,
18373 initializing the base class with basic_streambuf()
18374 (lib.streambuf.cons), and initializing mode with which. Then copies
18375 the content of str into the basic_stringbuf underlying character
18376 sequence. If which &amp; ios_base::out is true, initializes the output
18377 sequence such that pbase() points to the first underlying character,
18378 epptr() points one past the last underlying character, and if (which &amp;
18379 ios_base::ate) is true, pptr() is set equal to
18380 epptr() else pptr() is set equal to pbase(). If which &amp; ios_base::in
18381 is true, initializes the input sequence such that eback() and gptr()
18382 point to the first underlying character and egptr() points one past
18383 the last underlying character.
18384 </p>
18385 </blockquote>
18386
18387 <p>27.7.1.2/1 Change:</p>
18388
18389 <blockquote>
18390 <p>
18391 -1- Returns: A basic_string object whose content is equal to the
18392 basic_stringbuf underlying character sequence. If the buffer is only
18393 created in input mode, the underlying character sequence is equal to
18394 the input sequence; otherwise, it is equal to the output sequence. In
18395 case of an empty underlying character sequence, the function returns
18396 basic_string&lt;charT,traits,Allocator&gt;().
18397 </p>
18398 </blockquote>
18399
18400 <p>to:</p>
18401
18402 <blockquote>
18403 <p>
18404 -1- Returns: A basic_string object whose content is equal to the
18405 basic_stringbuf underlying character sequence. If the basic_stringbuf
18406 was created only in input mode, the resultant basic_string contains
18407 the character sequence in the range [eback(), egptr()).  If the
18408 basic_stringbuf was created with (which &amp; ios_base::out) being true
18409 then the resultant basic_string contains the character sequence in the
18410 range [pbase(), high_mark) where high_mark represents the position one
18411 past the highest initialized character in the buffer.  Characters can
18412 be initialized either through writing to the stream, or by
18413 constructing the basic_stringbuf with a basic_string, or by calling
18414 the str(basic_string) member function.  In the case of calling the
18415 str(basic_string) member function, all characters initialized prior to
18416 the call are now considered uninitialized (except for those
18417 characters re-initialized by the new basic_string).  Otherwise the
18418 basic_stringbuf has been created in neither input nor output mode and
18419 a zero length basic_string is returned.
18420 </p>
18421 </blockquote>
18422
18423 <p>
18424 27.7.1.2/2 Change:
18425 </p>
18426
18427 <blockquote>
18428 <p>
18429 -2- Effects: If the basic_stringbuf's underlying character sequence is
18430 not empty, deallocates it. Then copies the content of s into the
18431 basic_stringbuf underlying character sequence and initializes the
18432 input and output sequences according to the mode stored when creating
18433 the basic_stringbuf object. If (mode&amp;ios_base::out) is true, then
18434 initializes the output sequence with the underlying sequence. If
18435 (mode&amp;ios_base::in) is true, then initializes the input sequence with
18436 the underlying sequence.
18437 </p>
18438 </blockquote>
18439
18440 <p>to:</p>
18441
18442 <blockquote>
18443 <p>
18444 -2- Effects: Copies the content of s into the basic_stringbuf
18445 underlying character sequence. If mode &amp; ios_base::out is true,
18446 initializes the output sequence such that pbase() points to the first
18447 underlying character, epptr() points one past the last underlying
18448 character, and if (mode &amp; ios_base::ate) is true,
18449 pptr() is set equal to epptr() else pptr() is set equal to pbase(). If
18450 mode &amp; ios_base::in is true, initializes the input sequence such that
18451 eback() and gptr() point to the first underlying character and egptr()
18452 points one past the last underlying character.
18453 </p>
18454 </blockquote>
18455
18456 <p>Remove 27.2.1.2/3.  (Same rationale as issue 238: incorrect and unnecessary.)</p>
18457
18458 <p>27.7.1.3/1 Change:</p>
18459
18460 <blockquote>
18461 <p>
18462 1- Returns: If the input sequence has a read position available,
18463 returns traits::to_int_type(*gptr()).  Otherwise, returns
18464 traits::eof().
18465 </p>
18466 </blockquote>
18467
18468 <p>to:</p>
18469
18470 <blockquote>
18471 <p>
18472 1- Returns: If the input sequence has a read position available,
18473 returns traits::to_int_type(*gptr()).  Otherwise, returns
18474 traits::eof().  Any character in the underlying buffer which has been
18475 initialized is considered to be part of the input sequence.
18476 </p>
18477 </blockquote>
18478
18479 <p>27.7.1.3/9 Change:</p>
18480
18481 <blockquote>
18482 <p>
18483 -9- Notes: The function can make a write position available only if (
18484 mode &amp; ios_base::out) != 0. To make a write position available, the
18485 function reallocates (or initially allocates) an array object with a
18486 sufficient number of elements to hold the current array object (if
18487 any), plus one additional write position. If ( mode &amp; ios_base::in) !=
18488 0, the function alters the read end pointer egptr() to point just past
18489 the new write position (as does the write end pointer epptr()).
18490 </p>
18491 </blockquote>
18492
18493 <p>to:</p>
18494
18495 <blockquote>
18496 <p>
18497 -9- The function can make a write position available only if ( mode &amp;
18498 ios_base::out) != 0. To make a write position available, the function
18499 reallocates (or initially allocates) an array object with a sufficient
18500 number of elements to hold the current array object (if any), plus one
18501 additional write position. If ( mode &amp; ios_base::in) != 0, the
18502 function alters the read end pointer egptr() to point just past the
18503 new write position.
18504 </p>
18505 </blockquote>
18506
18507 <p>27.7.1.3/12 Change:</p>
18508
18509 <blockquote>
18510 <p>
18511 -12- _ If (newoff + off) &lt; 0, or (xend - xbeg) &lt; (newoff + off), the
18512 positioning operation fails. Otherwise, the function assigns xbeg +
18513 newoff + off to the next pointer xnext .
18514 </p>
18515 </blockquote>
18516
18517 <p>to:</p>
18518
18519 <blockquote>
18520 <p>
18521 -12- _ If (newoff + off) &lt; 0, or if (newoff + off) refers to an
18522 uninitialized character (as defined in 27.7.1.3 [stringbuf.members]
18523 paragraph 1), the positioning operation fails. Otherwise, the function
18524 assigns xbeg + newoff + off to the next pointer xnext .
18525 </p>
18526 </blockquote>
18527
18528 <p><i>[post-Kona: Howard provided wording.  At Kona the LWG agreed that
18529   something along these lines was a good idea, but the original
18530   proposed resolution didn't say enough about the effect of various
18531   member functions on the underlying character sequences.]</i></p>
18532
18533
18534
18535
18536 <p><b>Rationale:</b></p>
18537 <p>The current basic_stringbuf description is over-constrained in such
18538 a way as to prohibit vendors from making this the high-performance
18539 in-memory stream it was meant to be.  The fundamental problem is that
18540 the pointers: eback(), gptr(), egptr(), pbase(), pptr(), epptr() are
18541 observable from a derived client, and the current description
18542 restricts the range [pbase(), epptr()) from being grown geometrically.
18543 This change allows, but does not require, geometric growth of this
18544 range.</p>
18545
18546 <p>Backwards compatibility issues: These changes will break code that
18547 derives from basic_stringbuf, observes epptr(), and depends upon
18548 [pbase(), epptr()) growing by one character on each call to overflow()
18549 (i.e. test suites).  Otherwise there are no backwards compatibility
18550 issues.</p>
18551
18552 <p>27.7.1.1/2: The non-normative note is non-binding, and if it were
18553 binding, would be over specification.  The recommended change focuses
18554 on the important observable fact.</p>
18555
18556 <p>27.7.1.1/3: This change does two things: 1.  It describes exactly
18557 what must happen in terms of the sequences.  The terms "input
18558 sequence" and "output sequence" are not well defined.  2.  It
18559 introduces a common extension: open with app or ate mode.  I concur
18560 with issue 238 that paragraph 4 is both wrong and unnecessary.</p>
18561
18562 <p>27.7.1.2/1: This change is the crux of the efficiency issue.  The
18563 resultant basic_string is not dependent upon epptr(), and thus
18564 implementors are free to grow the underlying buffer geometrically
18565 during overflow() *and* place epptr() at the end of that buffer.</p>
18566
18567 <p>27.7.1.2/2:  Made consistent with the proposed 27.7.1.1/3.</p>
18568
18569 <p>27.7.1.3/1: Clarifies that characters written to the stream beyond
18570 the initially specified string are available for reading in an i/o
18571 basic_streambuf.</p>
18572
18573 <p>27.7.1.3/9: Made normative by removing "Notes:", and removed the
18574 trailing parenthetical comment concerning epptr().</p>
18575
18576 <p>27.7.1.3/12: Restricting the positioning to [xbeg, xend) is no
18577 longer allowable since [pbase(), epptr()) may now contain
18578 uninitialized characters.  Positioning is only allowable over the
18579 initialized range.</p>
18580
18581
18582
18583
18584
18585 <hr>
18586 <h3><a name="434"></a>434. bitset::to_string() hard to use</h3>
18587 <p><b>Section:</b> 23.3.5.2 [bitset.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
18588  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-10-15</p>
18589 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#bitset.members">issues</a> in [bitset.members].</p>
18590 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
18591 <p><b>Discussion:</b></p>
18592 <p>
18593 It has been pointed out a number of times that the bitset to_string() member
18594 function template is tedious to use since callers must explicitly specify the
18595 entire template argument list (3 arguments). At least two implementations
18596 provide a number of overloads of this template to make it easier to use.
18597 </p>
18598
18599
18600
18601 <p><b>Proposed resolution:</b></p>
18602 <p>In order to allow callers to specify no template arguments at all, just the
18603 first one (charT), or the first 2 (charT and traits), in addition to all
18604 three template arguments, add the following three overloads to both the
18605 interface (declarations only) of the class template bitset as well as to
18606 section 23.3.5.2, immediately after p34, the Returns clause of the existing
18607 to_string() member function template:</p>
18608
18609 <pre>    template &lt;class charT, class traits&gt;
18610     basic_string&lt;charT, traits, allocator&lt;charT&gt; &gt;
18611     to_string () const;
18612
18613     -34.1- Returns: to_string&lt;charT, traits, allocator&lt;charT&gt; &gt;().
18614
18615     template &lt;class charT&gt;
18616     basic_string&lt;charT, char_traits&lt;charT&gt;, allocator&lt;charT&gt; &gt;
18617     to_string () const;
18618
18619     -34.2- Returns: to_string&lt;charT, char_traits&lt;charT&gt;, allocator&lt;charT&gt; &gt;().
18620
18621     basic_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt;
18622     to_string () const;
18623
18624     -34.3- Returns: to_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt;().
18625 </pre>
18626
18627 <p><i>[Kona: the LWG agrees that this is an improvement over the
18628   status quo.  Dietmar thought about an alternative using a proxy
18629   object but now believes that the proposed resolution above is the
18630   right choice.
18631 ]</i></p>
18632
18633
18634
18635
18636
18637
18638
18639
18640 <hr>
18641 <h3><a name="435"></a>435. bug in DR 25</h3>
18642 <p><b>Section:</b> 21.3.8.9 [string.io] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18643  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-10-15</p>
18644 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.io">issues</a> in [string.io].</p>
18645 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18646 <p><b>Discussion:</b></p>
18647
18648 <p>
18649 It has been pointed out that the proposed resolution in DR 25 may not be
18650 quite up to snuff: <br>
18651 http://gcc.gnu.org/ml/libstdc++/2003-09/msg00147.html
18652 http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#25<br>
18653 </p>
18654
18655 <p>
18656 It looks like Petur is right. The complete corrected text is copied below.
18657 I think we may have have been confused by the reference to 22.2.2.2.2 and
18658 the subsequent description of `n' which actually talks about the second
18659 argument to sputn(), not about the number of fill characters to pad with.
18660 </p>
18661
18662 <p>
18663 So the question is: was the original text correct? If the intent was to
18664 follow classic iostreams then it most likely wasn't, since setting width()
18665 to less than the length of the string doesn't truncate it on output. This
18666 is also the behavior of most implementations (except for SGI's standard
18667 iostreams where the operator does truncate).
18668 </p>
18669
18670
18671
18672 <p><b>Proposed resolution:</b></p>
18673 <p>Change the text in 21.3.7.9, p4 from</p>
18674     <blockquote><p>
18675     If bool(k) is true, inserts characters as if by calling
18676     os.rdbuf()-&gt;sputn(str.data(), n), padding as described in stage 3
18677     of lib.facet.num.put.virtuals, where n is the larger of os.width()
18678     and str.size(); 
18679     </p></blockquote>
18680 <p>to</p>
18681     <blockquote><p>
18682     If bool(k) is true, determines padding as described in
18683     lib.facet.num.put.virtuals, and then inserts the resulting
18684     sequence of characters <tt>seq</tt> as if by calling
18685     <tt>os.rdbuf()-&gt;sputn(seq, n)</tt>, where <tt>n</tt> is the larger of
18686     <tt>os.width()</tt> and <tt>str.size()</tt>;
18687      </p></blockquote>
18688
18689 <p><i>[Kona: it appears that neither the original wording, DR25, nor the
18690   proposed resolution, is quite what we want.  We want to say that
18691   the string will be output, padded to os.width() if necessary.  We
18692   don't want to duplicate the padding rules in clause 22, because
18693   they're complicated, but we need to be careful because they weren't
18694   quite written with quite this case in mind.  We need to say what
18695   the character sequence is, and then defer to clause 22.  Post-Kona:
18696   Benjamin provided wording.]</i></p>
18697
18698
18699
18700
18701
18702
18703
18704 <hr>
18705 <h3><a name="436"></a>436. are cv-qualified facet types valid facets?</h3>
18706 <p><b>Section:</b> 22.1.1.1.2 [locale.facet] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
18707  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2003-10-15</p>
18708 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
18709 <p><b>Discussion:</b></p>
18710 <p>
18711 Is "const std::ctype&lt;char&gt;" a valid template argument to has_facet, use_facet,
18712 and the locale template ctor? And if so, does it designate the same Facet as
18713 the non-const "std::ctype&lt;char&gt;?" What about "volatile std::ctype&lt;char&gt;?"
18714 Different implementations behave differently: some fail to compile, others
18715 accept such types but behave inconsistently.
18716 </p>
18717
18718
18719 <p><b>Proposed resolution:</b></p>
18720 <p>Change 22.1.1.1.2, p1 to read:</p>
18721
18722 <p>Template parameters in this clause which are required to be facets
18723 are those named Facet in declarations. A program that passes a type
18724 that is not a facet, or a type that refers to volatile-qualified
18725 facet, as an (explicit or deduced) template parameter to a locale
18726 function expecting a facet, is ill-formed.  A const-qualified facet is
18727 a valid template argument to any locale function that expects a Facet
18728 template parameter.</p>
18729
18730 <p><i>[Kona: changed the last sentence from a footnote to normative
18731 text.]</i></p>
18732
18733
18734
18735
18736
18737
18738 <hr>
18739 <h3><a name="438"></a>438. Ambiguity in the "do the right thing" clause</h3>
18740 <p><b>Section:</b> 23.1.3 [sequence.reqmts] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
18741  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2003-10-20</p>
18742 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#sequence.reqmts">issues</a> in [sequence.reqmts].</p>
18743 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
18744 <p><b>Discussion:</b></p>
18745
18746 <p>Section 23.1.3 [sequence.reqmts], paragraphs 9-11, fixed up the problem
18747 noticed with statements like:</p>
18748 <pre>vector&lt;int&gt; v(10, 1);
18749 </pre>
18750
18751 <p>The intent of the above statement was to construct with:</p>
18752 <pre>vector(size_type, const value_type&amp;);
18753 </pre>
18754
18755 <p>but early implementations failed to compile as they bound to:</p>
18756 <pre>template &lt;class InputIterator&gt;
18757 vector(InputIterator f, InputIterator l);
18758 </pre>
18759 <p>instead.</p>
18760
18761 <p>Paragraphs 9-11 say that if InputIterator is an integral type, then the
18762 member template constructor will have the same effect as:</p>
18763 <pre>vector&lt;static_cast&lt;size_type&gt;(f), static_cast&lt;value_type&gt;(l));
18764 </pre>
18765 <p>(and similarly for the other member template functions of sequences).</p>
18766
18767 <p>There is also a note that describes one implementation technique:</p>
18768 <blockquote><p>
18769    One way that sequence implementors can satisfy this requirement is to
18770    specialize the member template for every integral type.
18771 </p></blockquote>
18772
18773 <p>This might look something like:</p>
18774 <blockquote>
18775 <pre>template &lt;class T&gt;
18776 struct vector
18777 {
18778      typedef unsigned size_type;
18779
18780      explicit vector(size_type) {}
18781      vector(size_type, const T&amp;) {}
18782
18783      template &lt;class I&gt;
18784      vector(I, I);
18785
18786      // ...
18787 };
18788
18789 template &lt;class T&gt;
18790 template &lt;class I&gt;
18791 vector&lt;T&gt;::vector(I, I) { ... }
18792
18793 template &lt;&gt;
18794 template &lt;&gt;
18795 vector&lt;int&gt;::vector(int, int) { ... }
18796
18797 template &lt;&gt;
18798 template &lt;&gt;
18799 vector&lt;int&gt;::vector(unsigned, unsigned) { ... }
18800
18801 //  ...
18802 </pre>
18803 </blockquote>
18804
18805 <p>Label this solution 'A'.</p>
18806
18807 <p>The standard also says:</p>
18808 <blockquote><p>
18809  Less cumbersome implementation techniques also exist.
18810 </p></blockquote>
18811 <p>
18812 A popular technique is to not specialize as above, but instead catch
18813 every call with the member template, detect the type of InputIterator,
18814 and then redirect to the correct logic.  Something like:
18815 </p>
18816 <blockquote>
18817 <pre>template &lt;class T&gt;
18818 template &lt;class I&gt;
18819 vector&lt;T&gt;::vector(I f, I l)
18820 {
18821      choose_init(f, l, int2type&lt;is_integral&lt;I&gt;::value&gt;());
18822 }
18823
18824 template &lt;class T&gt;
18825 template &lt;class I&gt;
18826 vector&lt;T&gt;::choose_init(I f, I l, int2type&lt;false&gt;)
18827 {
18828     // construct with iterators
18829 }
18830
18831 template &lt;class T&gt;
18832 template &lt;class I&gt;
18833 vector&lt;T&gt;::choose_init(I f, I l, int2type&lt;true&gt;)
18834 {
18835     size_type sz = static_cast&lt;size_type&gt;(f);
18836     value_type v = static_cast&lt;value_type&gt;(l);
18837     // construct with sz,v
18838 }
18839 </pre>
18840 </blockquote>
18841
18842 <p>Label this solution 'B'.</p>
18843
18844 <p>Both of these solutions solve the case the standard specifically
18845 mentions:</p>
18846 <pre>vector&lt;int&gt; v(10, 1);  // ok, vector size 10, initialized to 1
18847 </pre>
18848
18849 <p>
18850 However, (and here is the problem), the two solutions have different
18851 behavior in some cases where the value_type of the sequence is not an
18852 integral type.  For example consider:
18853 </p>
18854 <blockquote><pre>     pair&lt;char, char&gt;                     p('a', 'b');
18855      vector&lt;vector&lt;pair&lt;char, char&gt; &gt; &gt;   d('a', 'b');
18856 </pre></blockquote>
18857 <p>
18858 The second line of this snippet is likely an error.  Solution A catches
18859 the error and refuses to compile.  The reason is that there is no
18860 specialization of the member template constructor that looks like:
18861 </p>
18862 <pre>template &lt;&gt;
18863 template &lt;&gt;
18864 vector&lt;vector&lt;pair&lt;char, char&gt; &gt; &gt;::vector(char, char) { ... }
18865 </pre>
18866
18867 <p>
18868 So the expression binds to the unspecialized member template
18869 constructor, and then fails (compile time) because char is not an
18870 InputIterator.
18871 </p>
18872
18873 <p>
18874 Solution B compiles the above example though.  'a' is casted to an
18875 unsigned integral type and used to size the outer vector.  'b' is
18876 static casted to the inner vector using it's explicit constructor:
18877 </p>
18878
18879 <pre>explicit vector(size_type n);
18880 </pre>
18881
18882 <p>
18883 and so you end up with a static_cast&lt;size_type&gt;('a') by
18884 static_cast&lt;size_type&gt;('b') matrix.
18885 </p>
18886
18887 <p>
18888 It is certainly possible that this is what the coder intended.  But the
18889 explicit qualifier on the inner vector has been thwarted at any rate.
18890 </p>
18891
18892 <p>
18893 The standard is not clear whether the expression:
18894 </p>
18895
18896 <pre>     vector&lt;vector&lt;pair&lt;char, char&gt; &gt; &gt;   d('a', 'b');
18897 </pre>
18898
18899 <p>
18900 (and similar expressions) are:
18901 </p>
18902
18903 <ol>
18904 <li>  undefined behavior.</li>
18905 <li>  illegal and must be rejected.</li>
18906 <li>  legal and must be accepted.</li>
18907 </ol>
18908
18909 <p>My preference is listed in the order presented.</p>
18910
18911 <p>There are still other techniques for implementing the requirements of
18912 paragraphs 9-11, namely the "restricted template technique" (e.g.
18913 enable_if).  This technique is the most compact and easy way of coding
18914 the requirements, and has the behavior of #2 (rejects the above
18915 expression).
18916 </p>
18917
18918 <p>
18919 Choosing 1 would allow all implementation techniques I'm aware of.
18920 Choosing 2 would allow only solution 'A' and the enable_if technique.
18921 Choosing 3 would allow only solution 'B'.
18922 </p>
18923
18924 <p>
18925 Possible wording for a future standard if we wanted to actively reject
18926 the expression above would be to change "static_cast" in paragraphs
18927 9-11 to "implicit_cast" where that is defined by:
18928 </p>
18929
18930 <blockquote>
18931 <pre>template &lt;class T, class U&gt;
18932 inline
18933 T implicit_cast(const U&amp; u)
18934 {
18935      return u;
18936 }
18937 </pre>
18938 </blockquote>
18939
18940
18941
18942 <p><b>Proposed resolution:</b></p>
18943
18944 <p>Replace 23.1.3 [sequence.reqmts] paragraphs 9 - 11 with:</p>
18945
18946 <p>For every sequence defined in this clause and in clause lib.strings:</p>
18947
18948 <ul>
18949   <li>
18950     <p>If the constructor</p>
18951        <pre>       template &lt;class InputIterator&gt;
18952        X(InputIterator f, InputIterator l,
18953          const allocator_type&amp; a = allocator_type())
18954        </pre>
18955     <p>is called with a type InputIterator that does not qualify as
18956     an input iterator, then the constructor will behave as if the
18957     overloaded constructor:</p>
18958        <pre>       X(size_type, const value_type&amp; = value_type(),
18959          const allocator_type&amp; = allocator_type())
18960        </pre>
18961     <p>were called instead, with the arguments static_cast&lt;size_type&gt;(f), l and a, respectively.</p>
18962   </li>
18963
18964   <li>
18965     <p>If the member functions of the forms:</p>
18966        <pre>       template &lt;class InputIterator&gt;          //  such as  insert()
18967        rt fx1(iterator p, InputIterator f, InputIterator l);
18968
18969        template &lt;class InputIterator&gt;          //  such as  append(), assign()
18970        rt fx2(InputIterator f, InputIterator l);
18971
18972        template &lt;class InputIterator&gt;          //  such as  replace()
18973        rt fx3(iterator i1, iterator i2, InputIterator f, InputIterator l);
18974        </pre>
18975     <p>are called with a type InputIterator that does not qualify as
18976     an input iterator, then these functions will behave as if the
18977     overloaded member functions:</p>
18978        <pre>       rt fx1(iterator, size_type, const value_type&amp;);
18979
18980        rt fx2(size_type, const value_type&amp;);
18981
18982        rt fx3(iterator, iterator, size_type, const value_type&amp;);
18983        </pre>
18984     <p>were called instead, with the same arguments.</p>
18985   </li>
18986 </ul>
18987
18988 <p>In the previous paragraph the alternative binding will fail if f 
18989 is not implicitly convertible to X::size_type or if l is not implicitly 
18990 convertible to X::value_type.</p>
18991
18992 <p>
18993 The extent to which an implementation determines that a type cannot be
18994 an input iterator is unspecified, except that as a minimum integral
18995 types shall not qualify as input iterators.
18996 </p>
18997
18998
18999
19000 <p><i>[
19001 Kona: agreed that the current standard requires <tt>v('a', 'b')</tt>
19002 to be accepted, and also agreed that this is surprising behavior.  The
19003 LWG considered several options, including something like
19004 implicit_cast, which doesn't appear to be quite what we want.  We
19005 considered Howards three options: allow acceptance or rejection,
19006 require rejection as a compile time error, and require acceptance.  By
19007 straw poll (1-6-1), we chose to require a compile time error.
19008 Post-Kona: Howard provided wording.
19009 ]</i></p>
19010
19011
19012 <p><i>[
19013 Sydney: The LWG agreed with this general direction, but there was some
19014 discomfort with the wording in the original proposed resolution.
19015 Howard submitted new wording, and we will review this again in
19016 Redmond.
19017 ]</i></p>
19018
19019
19020 <p><i>[Redmond: one very small change in wording: the first argument
19021   is cast to size_t.  This fixes the problem of something like
19022   <tt>vector&lt;vector&lt;int&gt; &gt;(5, 5)</tt>, where int is not 
19023   implicitly convertible to the value type.]</i></p>
19024
19025
19026
19027
19028 <p><b>Rationale:</b></p>
19029 <p>The proposed resolution fixes:</p>
19030
19031 <pre>  vector&lt;int&gt; v(10, 1);
19032 </pre>
19033
19034 <p>
19035 since as integral types 10 and 1 must be disqualified as input
19036 iterators and therefore the (size,value) constructor is called (as
19037 if).</p>
19038
19039 <p>The proposed resolution breaks:</p>
19040
19041 <pre>  vector&lt;vector&lt;T&gt; &gt; v(10, 1);
19042 </pre>
19043
19044 <p>
19045 because the integral type 1 is not *implicitly* convertible to
19046 vector&lt;T&gt;.  The wording above requires a diagnostic.</p>
19047
19048 <p>
19049 The proposed resolution leaves the behavior of the following code
19050 unspecified.
19051 </p>
19052
19053 <pre>  struct A
19054   {
19055     operator int () const {return 10;}
19056   };
19057
19058   struct B
19059   {
19060     B(A) {}
19061   };
19062
19063   vector&lt;B&gt; v(A(), A());
19064 </pre>
19065
19066 <p>
19067 The implementation may or may not detect that A is not an input
19068 iterator and employee the (size,value) constructor.  Note though that
19069 in the above example if the B(A) constructor is qualified explicit,
19070 then the implementation must reject the constructor as A is no longer
19071 implicitly convertible to B.
19072 </p>
19073
19074
19075
19076
19077
19078 <hr>
19079 <h3><a name="441"></a>441. Is fpos::state const?</h3>
19080 <p><b>Section:</b> 27.4.3 [fpos] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19081  <b>Submitter:</b> Vincent Leloup <b>Date:</b> 2003-11-17</p>
19082 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#fpos">issues</a> in [fpos].</p>
19083 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19084 <p><b>Discussion:</b></p>
19085 <p>
19086 In section 27.4.3.1 [fpos.members] fpos&lt;stateT&gt;::state() is declared
19087 non const, but in section 27.4.3 [fpos] it is declared const.
19088 </p>
19089
19090
19091 <p><b>Proposed resolution:</b></p>
19092 <p>
19093 In section 27.4.3.1 [fpos.members], change the declaration of 
19094 <tt>fpos&lt;stateT&gt;::state()</tt> to const.
19095 </p>
19096
19097
19098
19099
19100
19101 <hr>
19102 <h3><a name="442"></a>442. sentry::operator bool() inconsistent signature</h3>
19103 <p><b>Section:</b> 27.6.2.4 [ostream::sentry] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19104  <b>Submitter:</b> Vincent Leloup <b>Date:</b> 2003-11-18</p>
19105 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#ostream::sentry">active issues</a> in [ostream::sentry].</p>
19106 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream::sentry">issues</a> in [ostream::sentry].</p>
19107 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19108 <p><b>Discussion:</b></p>
19109 <p>
19110 In section 27.6.2.4 [ostream::sentry] paragraph 4, in description part
19111 basic_ostream&lt;charT, traits&gt;::sentry::operator bool() is declared
19112 as non const, but in section 27.6.2.3, in synopsis it is declared
19113 const.
19114 </p>
19115
19116
19117 <p><b>Proposed resolution:</b></p>
19118 <p>
19119 In section 27.6.2.4 [ostream::sentry] paragraph 4, change the declaration
19120 of <tt>sentry::operator bool()</tt> to const.
19121 </p>
19122
19123
19124
19125
19126
19127 <hr>
19128 <h3><a name="443"></a>443. filebuf::close() inconsistent use of EOF</h3>
19129 <p><b>Section:</b> 27.8.1.4 [filebuf.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19130  <b>Submitter:</b> Vincent Leloup <b>Date:</b> 2003-11-20</p>
19131 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#filebuf.members">issues</a> in [filebuf.members].</p>
19132 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19133 <p><b>Discussion:</b></p>
19134 <p>
19135 In section 27.8.1.4 [filebuf.members] par6, in effects description of
19136 basic_filebuf&lt;charT, traits&gt;::close(), overflow(EOF) is used twice;
19137 should be overflow(traits::eof()).
19138 </p>
19139
19140
19141 <p><b>Proposed resolution:</b></p>
19142 <p>
19143 Change overflow(EOF) to overflow(traits::eof()).
19144 </p>
19145
19146
19147
19148
19149
19150 <hr>
19151 <h3><a name="444"></a>444. Bad use of casts in fstream</h3>
19152 <p><b>Section:</b> 27.8.1 [fstreams] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
19153  <b>Submitter:</b> Vincent Leloup <b>Date:</b> 2003-11-20</p>
19154 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#fstreams">issues</a> in [fstreams].</p>
19155 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
19156 <p><b>Discussion:</b></p>
19157 <p>27.8.1.9 [ifstream.members] p1, 27.8.1.13 [ofstream.members] p1,
19158 27.8.1.17 [fstream.members] p1 seems have same problem as exposed in
19159 LWG issue
19160 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#252">252</a>.
19161 </p>
19162
19163
19164 <p><b>Proposed resolution:</b></p>
19165
19166 <p><i>[Sydney: Genuine defect. 27.8.1.13 needs a cast to cast away
19167  constness. The other two places are stylistic: we could change the
19168  C-style casts to const_cast. Post-Sydney: Howard provided wording.
19169 ]</i></p>
19170
19171
19172 <p>Change 27.8.1.7/1 from:</p>
19173 <blockquote><p>
19174   Returns: (basic_filebuf&lt;charT,traits&gt;*)&amp;sb.
19175 </p></blockquote>
19176
19177 <p>to:</p>
19178 <blockquote><p>
19179   Returns: const_cast&lt;basic_filebuf&lt;charT,traits&gt;*&gt;(&amp;sb).
19180 </p></blockquote>
19181
19182 <p>Change 27.8.1.10/1 from:</p>
19183 <blockquote><p>
19184   Returns: (basic_filebuf&lt;charT,traits&gt;*)&amp;sb.
19185 </p></blockquote>
19186
19187 <p>to:</p>
19188 <blockquote><p>
19189   Returns: const_cast&lt;basic_filebuf&lt;charT,traits&gt;*&gt;(&amp;sb).
19190 </p></blockquote>
19191
19192 <p>Change 27.8.1.13/1 from:</p>
19193 <blockquote><p>
19194   Returns: &amp;sb.
19195 </p></blockquote>
19196
19197 <p>to:</p>
19198 <blockquote><p>
19199   Returns: const_cast&lt;basic_filebuf&lt;charT,traits&gt;*&gt;(&amp;sb).
19200 </p></blockquote>
19201
19202
19203
19204
19205
19206
19207
19208
19209 <hr>
19210 <h3><a name="445"></a>445. iterator_traits::reference unspecified for some iterator categories</h3>
19211 <p><b>Section:</b> 24.3.1 [iterator.traits] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
19212  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2003-12-09</p>
19213 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
19214 <p><b>Discussion:</b></p>
19215 <p>
19216 The standard places no restrictions at all on the reference type
19217 of input, output, or forward iterators (for forward iterators it
19218 only specifies that *x must be value_type&amp; and doesn't mention
19219 the reference type).  Bidirectional iterators' reference type is
19220 restricted only by implication, since the base iterator's
19221 reference type is used as the return type of reverse_iterator's
19222 operator*, which must be T&amp; in order to be a conforming forward
19223 iterator.
19224 </p>
19225
19226 <p>
19227 Here's what I think we ought to be able to expect from an input
19228 or forward iterator's reference type R, where a is an iterator
19229 and V is its value_type
19230 </p>
19231
19232 <ul>
19233   <li>
19234       *a is convertible to R
19235   </li>
19236
19237   <li>
19238       R is convertible to V
19239   </li>
19240
19241   <li>
19242       static_cast&lt;V&gt;(static_cast&lt;R&gt;(*a)) is equivalent to
19243       static_cast&lt;V&gt;(*a) 
19244   </li>
19245 </ul>
19246
19247 <p>A mutable forward iterator ought to satisfy, for x of type V:</p>
19248   <pre>      { R r = *a; r = x; } is equivalent to *a = x;
19249   </pre>
19250
19251 <p>
19252 I think these requirements capture existing container iterators
19253 (including vector&lt;bool&gt;'s), but render istream_iterator invalid;
19254 its reference type would have to be changed to a constant
19255 reference.
19256 </p>
19257
19258
19259 <p>
19260 (Jeremy Siek) During the discussion in Sydney, it was felt that a
19261 simpler long term solution for this was needed. The solution proposed
19262 was to require <tt>reference</tt> to be the same type as <tt>*a</tt>
19263 and <tt>pointer</tt> to be the same type as <tt>a-&gt;</tt>.  Most
19264 iterators in the Standard Library already meet this requirement. Some
19265 iterators are output iterators, and do not need to meet the
19266 requirement, and others are only specified through the general
19267 iterator requirements (which will change with this resolution). The
19268 sole case where there is an explicit definition of the reference type
19269 that will need to change is <tt>istreambuf_iterator</tt> which returns
19270 <tt>charT</tt> from <tt>operator*</tt> but has a reference type of
19271 <tt>charT&amp;</tt>. We propose changing the reference type of
19272 <tt>istreambuf_iterator</tt> to <tt>charT</tt>.
19273 </p>
19274
19275 <p>The other option for resolving the issue with <tt>pointer</tt>,
19276   mentioned in the note below, is to remove <tt>pointer</tt>
19277   altogether. I prefer placing requirements on <tt>pointer</tt> to
19278   removing it for two reasons. First, <tt>pointer</tt> will become
19279   useful for implementing iterator adaptors and in particular,
19280   <tt>reverse_iterator</tt> will become more well defined. Second,
19281   removing <tt>pointer</tt> is a rather drastic and publicly-visible
19282   action to take.</p>
19283
19284 <p>The proposed resolution technically enlarges the requirements for
19285 iterators, which means there are existing iterators (such as
19286 <tt>istreambuf_iterator</tt>, and potentially some programmer-defined
19287 iterators) that will no longer meet the requirements. Will this break
19288 existing code? The scenario in which it would is if an algorithm
19289 implementation (say in the Standard Library) is changed to rely on
19290 <tt>iterator_traits::reference</tt>, and then is used with one of the
19291 iterators that do not have an appropriately defined
19292 <tt>iterator_traits::reference</tt>.
19293 </p>
19294
19295
19296 <p>The proposed resolution makes one other subtle change. Previously,
19297 it was required that output iterators have a <tt>difference_type</tt>
19298 and <tt>value_type</tt> of <tt>void</tt>, which means that a forward
19299 iterator could not be an output iterator. This is clearly a mistake,
19300 so I've changed the wording to say that those types may be
19301 <tt>void</tt>.
19302 </p>
19303
19304
19305
19306 <p><b>Proposed resolution:</b></p>
19307
19308 <p>In 24.3.1 [iterator.traits], after:</p>
19309
19310 <blockquote><p>
19311 be defined as the iterator's difference type, value type and iterator
19312 category, respectively.
19313 </p></blockquote>
19314
19315 <p>add</p>
19316
19317 <blockquote><p>
19318 In addition, the types</p>
19319 <pre>iterator_traits&lt;Iterator&gt;::reference
19320 iterator_traits&lt;Iterator&gt;::pointer
19321 </pre>
19322 <p>must be defined as the iterator's reference and pointer types, that
19323 is, the same type as the type of <tt>*a</tt> and <tt>a-&gt;</tt>,
19324 respectively.</p>
19325 </blockquote>
19326
19327 <p>In 24.3.1 [iterator.traits], change:</p>
19328
19329 <blockquote><p>
19330 In the case of an output iterator, the types</p>
19331 <pre>iterator_traits&lt;Iterator&gt;::difference_type
19332 iterator_traits&lt;Iterator&gt;::value_type
19333 </pre>
19334 <p>are both defined as <tt>void</tt>.</p>
19335 </blockquote>
19336
19337 <p>to:</p>
19338 <blockquote><p>
19339 In the case of an output iterator, the types</p>
19340 <pre>iterator_traits&lt;Iterator&gt;::difference_type
19341 iterator_traits&lt;Iterator&gt;::value_type
19342 iterator_traits&lt;Iterator&gt;::reference
19343 iterator_traits&lt;Iterator&gt;::pointer
19344 </pre>
19345 <p>may be defined as <tt>void</tt>.</p>
19346 </blockquote>
19347
19348 <p>In 24.5.3 [istreambuf.iterator], change:</p>
19349 <blockquote>
19350 <pre>typename traits::off_type, charT*, charT&amp;&gt;
19351 </pre>
19352 </blockquote>
19353 <p>to:</p>
19354 <blockquote>
19355 <pre>typename traits::off_type, charT*, charT&gt;
19356 </pre>
19357 </blockquote>
19358
19359 <p><i>[
19360 Redmond: there was concern in Sydney that this might not be the only place
19361 where things were underspecified and needed to be changed.  Jeremy
19362 reviewed iterators in the standard and confirmed that nothing else
19363 needed to be changed.
19364 ]</i></p>
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374 <hr>
19375 <h3><a name="448"></a>448. Random Access Iterators over abstract classes</h3>
19376 <p><b>Section:</b> 24.1.5 [random.access.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19377  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2004-01-07</p>
19378 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#random.access.iterators">issues</a> in [random.access.iterators].</p>
19379 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19380 <p><b>Discussion:</b></p>
19381 <p>
19382 Table 76, the random access iterator requirement table, says that the
19383 return type of a[n] must be "convertible to T".  When an iterator's
19384 value_type T is an abstract class, nothing is convertible to T.
19385 Surely this isn't an intended restriction?
19386 </p>
19387
19388
19389 <p><b>Proposed resolution:</b></p>
19390 <p>
19391 Change the return type to "convertible to T const&amp;".
19392 </p>
19393
19394
19395
19396
19397
19398 <hr>
19399 <h3><a name="449"></a>449. Library Issue 306 Goes Too Far</h3>
19400 <p><b>Section:</b> 18.1 [support.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19401  <b>Submitter:</b> Pete Becker <b>Date:</b> 2004-01-15</p>
19402 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#support.types">issues</a> in [support.types].</p>
19403 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19404 <p><b>Discussion:</b></p>
19405 <p>Original text:</p>
19406 <blockquote><p>
19407 The macro offsetof accepts a restricted set of type arguments in this
19408 International Standard. type shall be a POD structure or a POD union
19409 (clause 9). The result of applying the offsetof macro to a field that
19410 is a static data member or a function member is undefined."
19411 </p></blockquote>
19412
19413 <p>Revised text:</p>
19414 <blockquote><p>
19415 "If type is not a POD structure or a POD union the results are undefined."
19416 </p></blockquote>
19417
19418 <p>
19419 Looks to me like the revised text should have replaced only the second
19420 sentence. It doesn't make sense standing alone.
19421 </p>
19422
19423
19424
19425 <p><b>Proposed resolution:</b></p>
19426 <p>Change 18.1, paragraph 5, to:</p>
19427
19428 <blockquote><p>
19429 The macro offsetof accepts a restricted set of type arguments in this
19430 International Standard.  If type is not a POD structure or a POD union
19431 the results are undefined.  The result of applying the offsetof macro
19432 to a field that is a static data member or a function member is
19433 undefined."
19434 </p></blockquote>
19435
19436
19437
19438
19439
19440 <hr>
19441 <h3><a name="453"></a>453. basic_stringbuf::seekoff need not always fail for an empty stream</h3>
19442 <p><b>Section:</b> 27.7.1.4 [stringbuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19443  <b>Submitter:</b> Bill Plauger <b>Date:</b> 2004-01-30</p>
19444 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#stringbuf.virtuals">issues</a> in [stringbuf.virtuals].</p>
19445 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19446 <p><b>Discussion:</b></p>
19447 <pre>  pos_type basic_stringbuf::seekoff(off_type, ios_base::seekdir,
19448                                     ios_base::openmode);
19449 </pre>
19450 <p>
19451 is obliged to fail if nothing has been inserted into the stream. This
19452 is unnecessary and undesirable. It should be permissible to seek to
19453 an effective offset of zero.</p>
19454
19455 <p><i>[
19456  Sydney: Agreed that this is an annoying problem: seeking to zero should be
19457  legal. Bill will provide wording.
19458 ]</i></p>
19459
19460
19461
19462
19463 <p><b>Proposed resolution:</b></p>
19464 <p>Change the sentence from:</p>
19465 <blockquote><p>
19466 For a sequence to be positioned, if its next pointer (either
19467 gptr() or pptr()) is a null pointer, the positioning operation
19468 fails.
19469 </p></blockquote>
19470
19471 <p>to:</p>
19472
19473 <blockquote><p>
19474 For a sequence to be positioned, if its next pointer (either
19475 gptr() or pptr()) is a null pointer and the new offset newoff
19476 is nonzero, the positioning operation fails.
19477 </p></blockquote>
19478
19479
19480
19481
19482
19483 <hr>
19484 <h3><a name="455"></a>455. cerr::tie() and wcerr::tie() are overspecified</h3>
19485 <p><b>Section:</b> 27.3 [iostream.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
19486  <b>Submitter:</b> Bill Plauger <b>Date:</b> 2004-01-30</p>
19487 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostream.objects">issues</a> in [iostream.objects].</p>
19488 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
19489 <p><b>Discussion:</b></p>
19490 <p>
19491 Both cerr::tie() and wcerr::tie() are obliged to be null at program
19492 startup. This is overspecification and overkill. It is both traditional
19493 and useful to tie cerr to cout, to ensure that standard output is drained
19494 whenever an error message is written. This behavior should at least be
19495 permitted if not required. Same for wcerr::tie().
19496 </p>
19497
19498
19499 <p><b>Proposed resolution:</b></p>
19500
19501 <p>Add to the description of cerr:</p>
19502 <blockquote><p>
19503 After the object cerr is initialized, cerr.tie() returns &amp;cout.
19504 Its state is otherwise the same as required for basic_ios&lt;char&gt;::init
19505 (lib.basic.ios.cons).
19506 </p></blockquote>
19507
19508 <p>Add to the description of wcerr:</p>
19509
19510 <blockquote><p>
19511 After the object wcerr is initialized, wcerr.tie() returns &amp;wcout.
19512 Its state is otherwise the same as required for basic_ios&lt;wchar_t&gt;::init
19513 (lib.basic.ios.cons).
19514 </p></blockquote>
19515
19516 <p><i>[Sydney: straw poll (3-1): we should <i>require</i>, not just
19517   permit, cout and cerr to be tied on startup.  Pre-Redmond: Bill will
19518   provide wording.]</i></p>
19519
19520
19521
19522
19523
19524
19525 <hr>
19526 <h3><a name="456"></a>456. Traditional C header files are overspecified</h3>
19527 <p><b>Section:</b> 17.4.1.2 [headers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19528  <b>Submitter:</b> Bill Plauger <b>Date:</b> 2004-01-30</p>
19529 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#headers">issues</a> in [headers].</p>
19530 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19531 <p><b>Discussion:</b></p>
19532
19533 <p>The C++ Standard effectively requires that the traditional C headers
19534 (of the form &lt;xxx.h&gt;) be defined in terms of the newer C++
19535 headers (of the form &lt;cxxx&gt;). Clauses 17.4.1.2/4 and D.5 combine
19536 to require that:</p>
19537
19538 <ul>
19539  <li>Including the header &lt;cxxx&gt; declares a C name in namespace std.</li>
19540
19541  <li> Including the header &lt;xxx.h&gt; declares a C name in namespace std
19542     (effectively by including &lt;cxxx&gt;), then imports it into the global
19543     namespace with an individual using declaration.</li>
19544 </ul>
19545
19546 <p>
19547 The rules were left in this form despited repeated and heated objections
19548 from several compiler vendors. The C headers are often beyond the direct
19549 control of C++ implementors. In some organizations, it's all they can do
19550 to get a few #ifdef __cplusplus tests added. Third-party library vendors
19551 can perhaps wrap the C headers. But neither of these approaches supports
19552 the drastic restructuring required by the C++ Standard. As a result, it is
19553 still widespread practice to ignore this conformance requirement, nearly
19554 seven years after the committee last debated this topic. Instead, what is
19555 often implemented is:
19556 </p>
19557
19558 <ul>
19559  <li> Including the header &lt;xxx.h&gt; declares a C name in the
19560  global namespace.</li> 
19561
19562  <li> Including the header &lt;cxxx&gt; declares a C name in the
19563  global namespace (effectively by including &lt;xxx.h&gt;), then
19564  imports it into namespace std with an individual using declaration.</li>
19565 </ul>
19566
19567 <p>
19568 The practical benefit for implementors with the second approach is that
19569 they can use existing C library headers, as they are pretty much obliged
19570 to do. The practical cost for programmers facing a mix of implementations
19571 is that they have to assume weaker rules:</p>
19572
19573 <ul>
19574   <li> If you want to assuredly declare a C name in the global
19575   namespace, include &lt;xxx.h&gt;. You may or may not also get the
19576   declaration in namespace std.</li>
19577
19578   <li> If you want to assuredly declare a C name in namespace std,
19579   include &lt;cxxx&gt;. You may or may not also get the declaration in
19580   the global namespace.</li>
19581 </ul>
19582
19583 <p>
19584 There also exists the <i>possibility</i> of subtle differences due to
19585 Koenig lookup, but there are so few non-builtin types defined in the C
19586 headers that I've yet to see an example of any real problems in this
19587 area.
19588 </p>
19589
19590 <p>
19591 It is worth observing that the rate at which programmers fall afoul of
19592 these differences has remained small, at least as measured by newsgroup
19593 postings and our own bug reports. (By an overwhelming margin, the
19594 commonest problem is still that programmers include &lt;string&gt; and can't
19595 understand why the typename string isn't defined -- this a decade after
19596 the committee invented namespace std, nominally for the benefit of all
19597 programmers.)
19598 </p>
19599
19600 <p>
19601 We should accept the fact that we made a serious mistake and rectify it,
19602 however belatedly, by explicitly allowing either of the two schemes for
19603 declaring C names in headers.
19604 </p>
19605
19606 <p><i>[Sydney: This issue has been debated many times, and will
19607   certainly have to be discussed in full committee before any action
19608   can be taken.  However, the preliminary sentiment of the LWG was in
19609   favor of the change.  (6 yes, 0 no, 2 abstain) Robert Klarer
19610   suggests that we might also want to undeprecate the
19611   C-style <tt>.h</tt> headers.]</i></p>
19612
19613
19614
19615
19616 <p><b>Proposed resolution:</b></p>
19617 <p>
19618 Add to 17.4.1.2 [headers], para. 4:
19619 </p>
19620
19621 <blockquote><p>
19622 Except as noted in clauses 18 through 27 and Annex D, the contents of each
19623 header <i>cname</i> shall be the same as that of the corresponding header
19624 <i>name.h</i>, as specified in ISO/IEC 9899:1990 Programming Languages C (Clause
19625 7), or ISO/IEC:1990 Programming Languages-C AMENDMENT 1: C Integrity, (Clause
19626 7), as appropriate, as if by inclusion. In the C++ Standard Library, however,
19627 the declarations <del>and definitions</del> (except for names which are defined
19628 as macros in C) are within namespace scope (3.3.5) of the namespace std. 
19629 <ins>It is unspecified whether these names are first declared within the global
19630 namespace scope and are then injected into namespace std by explicit
19631 using-declarations (7.3.3 [namespace.udecl]).</ins>
19632 </p></blockquote>
19633
19634 <p>
19635 Change D.5 [depr.c.headers], para. 2-3:
19636 </p>
19637
19638 <blockquote>
19639 <p>
19640 -2- Every C header, each of which has a name of the form <i>name.h</i>, behaves
19641 as if each name placed in the Standard library namespace by the corresponding
19642 <i>cname</i> header is <del>also</del> placed within the <ins>global</ins>
19643 namespace scope<ins>.</ins> <del>of the namespace <tt>std</tt> and is followed
19644 by an explicit <i>using-declaration</i> (7.3.3 [namespace.udecl]).</del>
19645 <ins>It is unspecified whether these names are first declared or defined within
19646 namespace scope (3.3.5 [basic.scope.namespace]) of the namespace
19647 <tt>std</tt> and are then injected into the global namespace scope by explicit
19648 using-declarations (7.3.3 [namespace.udecl]).</ins>
19649 </p>
19650 <p>
19651 -3- [<i>Example:</i> The header <tt>&lt;cstdlib&gt;</tt> <ins>assuredly</ins>
19652 provides its declarations and definitions within the namespace <tt>std</tt>.
19653 <ins>It may also provide these names within the global namespace.</ins> The
19654 header <tt>&lt;stdlib.h&gt;</tt> <del>makes these available also in</del>
19655 <ins>assuredly provides the same declarations and definitions within</ins> the
19656 global namespace, much as in the C Standard. <ins>It may also provide these
19657 names within the namespace <tt>std</tt>.</ins> <i>-- end example</i>]
19658 </p>
19659 </blockquote>
19660
19661
19662
19663
19664
19665 <hr>
19666 <h3><a name="457"></a>457. bitset constructor: incorrect number of initialized bits</h3>
19667 <p><b>Section:</b> 23.3.5.1 [bitset.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
19668  <b>Submitter:</b> Dag Henriksson <b>Date:</b> 2004-01-30</p>
19669 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#bitset.cons">issues</a> in [bitset.cons].</p>
19670 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
19671 <p><b>Discussion:</b></p>
19672 <p>
19673 The constructor from unsigned long says it initializes "the first M
19674 bit positions to the corresponding bit values in val. M is the smaller
19675 of N and the value CHAR_BIT * sizeof(unsigned long)."
19676 </p>
19677
19678 <p>
19679 Object-representation vs. value-representation strikes again. CHAR_BIT *
19680 sizeof (unsigned long) does not give us the number of bits an unsigned long
19681 uses to hold the value. Thus, the first M bit position above is not
19682 guaranteed to have any corresponding bit values in val.
19683 </p>
19684
19685
19686 <p><b>Proposed resolution:</b></p>
19687 <p>In 23.3.5.1 [bitset.cons] paragraph 2, change "M is the smaller of
19688   N and the value CHAR_BIT * sizeof (unsigned long). (249)" to
19689   "<tt>M</tt> is the smaller of <tt>N</tt> and the number of bits in
19690   the value representation (section 3.9 [basic.types]) of <tt>unsigned
19691   long</tt>."
19692 </p>
19693
19694
19695
19696
19697
19698 <hr>
19699 <h3><a name="460"></a>460. Default modes missing from basic_fstream member specifications</h3>
19700 <p><b>Section:</b> 27.8.1 [fstreams] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
19701  <b>Submitter:</b> Ben Hutchings <b>Date:</b> 2004-04-01</p>
19702 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#fstreams">issues</a> in [fstreams].</p>
19703 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
19704 <p><b>Discussion:</b></p>
19705 <p>
19706 The second parameters of the non-default constructor and of the open
19707 member function for basic_fstream, named "mode", are optional
19708 according to the class declaration in 27.8.1.11 [lib.fstream].  The
19709 specifications of these members in 27.8.1.12 [lib.fstream.cons] and
19710 27.8.1.13 lib.fstream.members] disagree with this, though the
19711 constructor declaration has the "explicit" function-specifier implying
19712 that it is intended to be callable with one argument.
19713 </p>
19714
19715
19716 <p><b>Proposed resolution:</b></p>
19717 <p>In 27.8.1.15 [fstream.cons], change</p>
19718 <pre>  explicit basic_fstream(const char* s, ios_base::openmode mode); 
19719 </pre>
19720 <p>to</p>
19721 <pre>  explicit basic_fstream(const char* s,
19722                          ios_base::openmode mode = ios_base::in|ios_base::out);
19723 </pre>
19724 <p>In 27.8.1.17 [fstream.members], change</p>
19725 <pre>  void open(const char*s, ios_base::openmode mode); 
19726 </pre>
19727 <p>to</p>
19728 <pre>  void open(const char*s,
19729             ios_base::openmode mode = ios_base::in|ios_base::out);
19730 </pre>
19731
19732
19733
19734
19735
19736 <hr>
19737 <h3><a name="461"></a>461. time_get hard or impossible to implement</h3>
19738 <p><b>Section:</b> 22.2.5.1.2 [locale.time.get.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19739  <b>Submitter:</b> Bill Plauger <b>Date:</b> 2004-03-23</p>
19740 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19741 <p><b>Discussion:</b></p>
19742 <p>
19743 Template time_get currently contains difficult, if not impossible,
19744 requirements for do_date_order, do_get_time, and do_get_date. All require
19745 the implementation to scan a field generated by the %x or %X conversion
19746 specifier in strftime. Yes, do_date_order can always return no_order, but
19747 that doesn't help the other functions. The problem is that %x can be
19748 nearly anything, and it can vary widely with locales. It's horribly
19749 onerous to have to parse "third sunday after Michaelmas in the year of
19750 our Lord two thousand and three," but that's what we currently ask of
19751 do_get_date. More practically, it leads some people to think that if
19752 %x produces 10.2.04, we should know to look for dots as separators. Still
19753 not easy.
19754 </p>
19755
19756 <p>
19757 Note that this is the <i>opposite</i> effect from the intent stated in the
19758 footnote earlier in this subclause:
19759 </p>
19760
19761 <blockquote><p>
19762 "In other words, user confirmation is required for reliable parsing of
19763 user-entered dates and times, but machine-generated formats can be
19764 parsed reliably. This allows parsers to be aggressive about interpreting
19765 user variations on standard formats."
19766 </p></blockquote>
19767
19768 <p>
19769 We should give both implementers and users an easier and more reliable
19770 alternative: provide a (short) list of alternative delimiters and say
19771 what the default date order is for no_order. For backward compatibility,
19772 and maximum latitude, we can permit an implementation to parse whatever
19773 %x or %X generates, but we shouldn't require it.
19774 </p>
19775
19776
19777 <p><b>Proposed resolution:</b></p>
19778
19779 <p><b>In the description:</b></p>
19780 <pre>iter_type do_get_time(iter_type s, iter_type end, ios_base&amp; str,
19781         ios_base::iostate&amp; err, tm* t) const;
19782 </pre>
19783
19784 <p>
19785 2 Effects: Reads characters starting at suntil it has extracted those
19786 struct tm members, and remaining format characters, used by
19787 time_put&lt;&gt;::put to produce the format specified by 'X', or until it
19788 encounters an error or end of sequence.
19789 </p>
19790
19791 <p><b>change:</b> 'X'</p>
19792
19793 <p><b>to:</b> "%H:%M:%S"</p>
19794
19795
19796 <p>Change</p>
19797 <pre>iter_type do_get_date(iter_type s, iter_type end, ios_base&amp; str,
19798         ios_base::iostate&amp; err, tm* t) const;
19799
19800 4 Effects: Reads characters starting at s until it has extracted those
19801 struct tm members, and remaining format characters, used by
19802 time_put&lt;&gt;::put to produce the format specified by 'x', or until it
19803 encounters an error.
19804 </pre>
19805
19806 <p>to</p>
19807 <pre>iter_type do_get_date(iter_type s, iter_type end, ios_base&amp; str,
19808         ios_base::iostate&amp; err, tm* t) const;
19809 </pre>
19810
19811 <p>
19812 4 Effects: Reads characters starting at s until it has extracted those
19813 struct tm members, and remaining format characters, used by
19814 time_put&lt;&gt;::put to produce one of the following formats, or until it
19815 encounters an error. The format depends on the value returned by
19816 date_order() as follows:
19817 </p>
19818
19819 <pre>        date_order()  format
19820
19821         no_order      "%m/%d/%y"
19822         dmy           "%d/%m/%y"
19823         mdy           "%m/%d/%y"
19824         ymd           "%y/%m/%d"
19825         ydm           "%y/%d/%m"
19826 </pre>
19827 <p>
19828 An implementation may also accept additional implementation-defined formats.
19829 </p>
19830
19831 <p><i>[Redmond: agreed that this is a real problem.  The solution is
19832   probably to match C99's parsing rules.  Bill provided wording.
19833 ]</i></p>
19834
19835
19836
19837
19838
19839
19840
19841 <hr>
19842 <h3><a name="464"></a>464. Suggestion for new member functions in standard containers</h3>
19843 <p><b>Section:</b> 23.2.6 [vector], 23.3.1 [map] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19844  <b>Submitter:</b> Thorsten Ottosen <b>Date:</b> 2004-05-12</p>
19845 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector">issues</a> in [vector].</p>
19846 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19847 <p><b>Discussion:</b></p>
19848
19849 <p>To add slightly more convenience to vector&lt;T&gt; and map&lt;Key,T&gt; we should consider to add</p>
19850 <ol>
19851 <li> add vector&lt;T&gt;::data() member (const and non-const version)
19852 semantics: if( empty() ) return 0; else return buffer_;</li>
19853 <li> add map&lt;Key,T&gt;::at( const Key&amp; k ) member (const and non-const version)
19854 <i>semantics</i>: iterator i = find( k ); if( i != end() ) return *i; else throw range_error();</li>
19855 </ol>
19856
19857 <p>Rationale:</p>
19858
19859 <ul>
19860 <li>To obtain a pointer to the vector's buffer, one must use either
19861 operator[]() (which can give undefined behavior for empty vectors) or
19862 at() (which will then throw if the vector is empty). </li>
19863 <li>tr1::array&lt;T,sz&gt; already has a data() member</li>
19864 <li>e cannot use operator[]() when T is not DefaultDonstructible</li>
19865 <li>Neither when the map is const.</li>
19866 <li>when we want to make sure we don't add an element accidently</li>
19867 <li>when it should be considered an error if a key is not in the map</li>
19868 </ul>
19869
19870
19871
19872 <p><b>Proposed resolution:</b></p>
19873 <p>In 23.2.6 [vector], add the following to the <tt>vector</tt>
19874   synopsis after "element access" and before "modifiers":</p>
19875 <pre>  // <i>[lib.vector.data] data access</i>
19876   pointer       data();
19877   const_pointer data() const;
19878 </pre>
19879
19880 <p>Add a new subsection of 23.2.6 [vector]:</p>
19881 <blockquote>
19882 <p>23.2.4.x <tt>vector</tt> data access</p>
19883 <pre>   pointer       data();
19884    const_pointer data() const;
19885 </pre>
19886 <p><b>Returns:</b> A pointer such that [data(), data() + size()) is a valid
19887    range.  For a non-empty vector, data() == &amp;front().</p>
19888 <p><b>Complexity:</b> Constant time.</p>
19889 <p><b>Throws:</b> Nothing.</p>
19890 </blockquote>
19891
19892 <p>In 23.3.1 [map], add the following to the <tt>map</tt>
19893 synopsis immediately after the line for operator[]:</p>
19894 <pre>  T&amp;       at(const key_type&amp; x);
19895   const T&amp; at(const key_type&amp; x) const;
19896 </pre>
19897
19898 <p>Add the following to 23.3.1.2 [map.access]:</p>
19899 <blockquote>
19900 <pre>  T&amp;       at(const key_type&amp; x);
19901   const T&amp; at(const key_type&amp; x) const;
19902 </pre>
19903
19904 <p><b>Returns:</b> A reference to the element whose key is equivalent
19905   to x, if such an element is present in the map.</p>
19906 <p><b>Throws:</b> <tt>out_of_range</tt> if no such element is present.</p>
19907
19908 </blockquote>
19909
19910
19911
19912 <p><b>Rationale:</b></p>
19913 <p>Neither of these additions provides any new functionality but the
19914   LWG agreed that they are convenient, especially for novices.  The
19915   exception type chosen for <tt>at</tt>, <tt>std::out_of_range</tt>,
19916   was chosen to match <tt>vector::at</tt>.</p>
19917
19918
19919
19920
19921
19922 <hr>
19923 <h3><a name="465"></a>465. Contents of &lt;ciso646&gt;</h3>
19924 <p><b>Section:</b> 17.4.1.2 [headers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19925  <b>Submitter:</b> Steve Clamage <b>Date:</b> 2004-06-03</p>
19926 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#headers">issues</a> in [headers].</p>
19927 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19928 <p><b>Discussion:</b></p>
19929 <p>C header &lt;iso646.h&gt; defines macros for some operators, such as
19930 not_eq for !=.</p>
19931
19932 <p>Section 17.4.1.2 [headers] "Headers" says that except as noted in
19933 clauses 18 through 27, the &lt;cname&gt; C++ header contents are the same
19934 as the C header &lt;name.h&gt;. In particular, table 12 lists
19935 &lt;ciso646&gt; as a C++ header.</p>
19936
19937 <p>I don't find any other mention of &lt;ciso646&gt;, or any mention of
19938 &lt;iso646.h&gt;, in clauses 17 thorough 27. That implies that the
19939 contents of &lt;ciso646&gt; are the same as C header &lt;iso646.h&gt;.</p>
19940
19941 <p>Annex C (informative, not normative) in [diff.header.iso646.h] C.2.2.2
19942 "Header &lt;iso646.h&gt;" says that the alternative tokens are not
19943 defined as macros in &lt;ciso646&gt;, but does not mention the contents
19944 of &lt;iso646.h&gt;.</p>
19945
19946 <p>I don't find any normative text to support C.2.2.2.</p>
19947
19948
19949
19950 <p><b>Proposed resolution:</b></p>
19951 <p>Add to section 17.4.1.2 Headers [lib.headers] a new paragraph after
19952   paragraph 6 (the one about functions must be functions):</p> 
19953
19954 <blockquote>
19955 <p>Identifiers that are keywords or operators in C++ shall not be defined
19956 as macros in C++ standard library headers. 
19957 [Footnote:In particular, including the standard header &lt;iso646.h&gt;
19958 or &lt;ciso646&gt; has no effect. </p>
19959 </blockquote>
19960
19961 <p><i>[post-Redmond: Steve provided wording.]</i></p>
19962
19963
19964
19965
19966
19967
19968
19969 <hr>
19970 <h3><a name="467"></a>467. char_traits::lt(), compare(), and memcmp()</h3>
19971 <p><b>Section:</b> 21.1.3.1 [char.traits.specializations.char] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
19972  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2004-06-28</p>
19973 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
19974 <p><b>Discussion:</b></p>
19975
19976 <p>
19977 Table 37 describes the requirements on Traits::compare() in terms of
19978 those on Traits::lt(). 21.1.3.1, p6 requires char_traits&lt;char&gt;::lt()
19979 to yield the same result as operator&lt;(char, char).
19980 </p>
19981
19982 <p>
19983 Most, if not all, implementations of char_traits&lt;char&gt;::compare()
19984 call memcmp() for efficiency. However, the C standard requires both
19985 memcmp() and strcmp() to interpret characters under comparison as
19986 unsigned, regardless of the signedness of char. As a result, all
19987 these char_traits implementations fail to meet the requirement
19988 imposed by Table 37 on compare() when char is signed.
19989 </p>
19990
19991
19992 <p>Read email thread starting with c++std-lib-13499 for more. </p>
19993
19994
19995 <p><b>Proposed resolution:</b></p>
19996
19997
19998 <p>Change 21.1.3.1, p6 from</p>
19999 <blockquote><p>
20000     The two-argument members assign, eq, and lt are defined identically
20001     to the built-in operators =, ==, and &lt; respectively.
20002 </p></blockquote>
20003 <p>to</p>
20004 <blockquote><p>
20005   The two-argument member assign is defined identically to
20006   the built-in operator =. The two
20007   argument members eq and lt are defined identically to
20008   the built-in operators == and &lt; for type unsigned char.
20009 </p></blockquote>
20010
20011 <p><i>[Redmond: The LWG agreed with this general direction, but we
20012   also need to change <tt>eq</tt> to be consistent with this change.
20013   Post-Redmond: Martin provided wording.]</i></p>
20014
20015
20016
20017
20018
20019
20020 <hr>
20021 <h3><a name="468"></a>468. unexpected consequences of ios_base::operator void*()</h3>
20022 <p><b>Section:</b> 27.4.4.3 [iostate.flags] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20023  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2004-06-28</p>
20024 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostate.flags">issues</a> in [iostate.flags].</p>
20025 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20026 <p><b>Discussion:</b></p>
20027
20028 <p>The program below is required to compile but when run it typically
20029 produces unexpected results due to the user-defined conversion from
20030 std::cout or any object derived from basic_ios to void*.
20031 </p>
20032
20033 <pre>    #include &lt;cassert&gt;
20034     #include &lt;iostream&gt;
20035
20036     int main ()
20037     {
20038         assert (std::cin.tie () == std::cout);
20039         // calls std::cout.ios::operator void*()
20040     }
20041 </pre>
20042
20043
20044 <p><b>Proposed resolution:</b></p>
20045
20046 <p>
20047 Replace std::basic_ios&lt;charT, traits&gt;::operator void*() with another
20048 conversion operator to some unspecified type that is guaranteed not
20049 to be convertible to any other type except for bool (a pointer-to-member
20050 might be one such suitable type). In addition, make it clear that the
20051 pointer type need not be a pointer to a complete type and when non-null,
20052 the value need not be valid.
20053 </p>
20054
20055 <p>Specifically, change in [lib.ios] the signature of</p>
20056 <pre>    operator void*() const;
20057 </pre>
20058 <p>to</p>
20059 <pre>    operator unspecified-bool-type() const;
20060 </pre>
20061 <p>and change [lib.iostate.flags], p1 from</p>
20062 <pre>    operator void*() const;
20063 </pre>
20064 <p>to</p>
20065 <pre>operator unspecified-bool-type() const;
20066
20067      -1- Returns: if fail() then a value that will evaluate false in a
20068       boolean context; otherwise a value that will evaluate true in a
20069       boolean context. The value type returned shall not be
20070       convertible to int.
20071
20072      -2- [Note: This conversion can be used in contexts where a bool
20073       is expected (e.g., an if condition); however, implicit
20074       conversions (e.g., to int) that can occur with bool are not
20075       allowed, eliminating some sources of user error. One possible
20076       implementation choice for this type is pointer-to-member.  - end
20077       note]
20078 </pre>
20079
20080 <p><i>[Redmond: 5-4 straw poll in favor of doing this.]</i></p>
20081
20082 <p><i>[Lillehammer: Doug provided revised wording for
20083   "unspecified-bool-type".]</i></p>
20084  
20085
20086
20087
20088
20089
20090
20091
20092 <hr>
20093 <h3><a name="469"></a>469. vector&lt;bool&gt; ill-formed relational operators</h3>
20094 <p><b>Section:</b> 23.2.6 [vector] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
20095  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2004-06-28</p>
20096 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector">issues</a> in [vector].</p>
20097 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
20098 <p><b>Discussion:</b></p>
20099
20100 <p>
20101 The overloads of relational operators for vector&lt;bool&gt; specified
20102 in [lib.vector.bool] are redundant (they are semantically identical
20103 to those provided for the vector primary template) and may even be
20104 diagnosed as ill-formed (refer to Daveed Vandevoorde's explanation
20105 in c++std-lib-13647).
20106 </p>
20107
20108
20109
20110 <p><b>Proposed resolution:</b></p>
20111 <p>
20112 Remove all overloads of overloads of relational operators for
20113 vector&lt;bool&gt; from [lib.vector.bool].
20114 </p>
20115
20116
20117
20118
20119 <hr>
20120 <h3><a name="474"></a>474. confusing Footnote 297</h3>
20121 <p><b>Section:</b> 27.6.2.6.4 [ostream.inserters.character] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20122  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2004-07-01</p>
20123 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.inserters.character">issues</a> in [ostream.inserters.character].</p>
20124 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20125 <p><b>Discussion:</b></p>
20126
20127 <p>
20128 I think Footnote 297 is confused. The paragraph it applies to seems
20129 quite clear in that widen() is only called if the object is not a char
20130 stream (i.e., not basic_ostream&lt;char&gt;), so it's irrelevant what the
20131 value of widen(c) is otherwise.
20132 </p>
20133
20134
20135 <p><b>Proposed resolution:</b></p>
20136 <p>
20137 I propose to strike the Footnote.
20138 </p>
20139
20140
20141
20142
20143 <hr>
20144 <h3><a name="475"></a>475. May the function object passed to for_each modify the elements of the iterated sequence?</h3>
20145 <p><b>Section:</b> 25.1.4 [alg.foreach] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20146  <b>Submitter:</b> Stephan T. Lavavej, Jaakko Jarvi <b>Date:</b> 2004-07-09</p>
20147 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
20148 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20149 <p><b>Discussion:</b></p>
20150 <p>
20151 It is not clear whether the function object passed to for_each is allowed to
20152 modify the elements of the sequence being iterated over.
20153 </p>
20154
20155 <p>
20156 for_each is classified without explanation in [lib.alg.nonmodifying], "25.1
20157 Non-modifying sequence operations". 'Non-modifying sequence operation' is
20158 never defined.
20159 </p>
20160
20161 <p>
20162 25(5) says: "If an algorithm's Effects section says that a value pointed to
20163 by any iterator passed as an argument is modified, then that algorithm has
20164 an additional type requirement: The type of that argument shall satisfy the
20165 requirements of a mutable iterator (24.1)."
20166 </p>
20167
20168 <p>for_each's Effects section does not mention whether arguments can be
20169 modified:</p>
20170
20171 <blockquote><p>
20172   "Effects: Applies f to the result of dereferencing every iterator in the
20173    range [first, last), starting from first and proceeding to last - 1."
20174 </p></blockquote>
20175
20176 <p>
20177 Every other algorithm in [lib.alg.nonmodifying] is "really" non-modifying in
20178 the sense that neither the algorithms themselves nor the function objects
20179 passed to the algorithms may modify the sequences or elements in any way.
20180 This DR affects only for_each.
20181 </p>
20182
20183 <p>
20184 We suspect that for_each's classification in "non-modifying sequence
20185 operations" means that the algorithm itself does not inherently modify the
20186 sequence or the elements in the sequence, but that the function object
20187 passed to it may modify the elements it operates on. 
20188 </p>
20189
20190 <p>
20191 The original STL document by Stepanov and Lee explicitly prohibited the
20192 function object from modifying its argument.
20193 The "obvious" implementation of for_each found in several standard library 
20194 implementations, however, does not impose this restriction.
20195 As a result, we suspect that the use of for_each with function objects that modify
20196 their arguments is wide-spread. 
20197 If the restriction was reinstated, all such code would become non-conforming.
20198 Further, none of the other algorithms in the Standard
20199 could serve the purpose of for_each (transform does not guarantee the order in
20200 which its function object is called). 
20201 </p>
20202
20203 <p>
20204 We suggest that the standard be clarified to explicitly allow the function object 
20205 passed to for_each modify its argument.</p>
20206
20207
20208
20209 <p><b>Proposed resolution:</b></p>
20210 <p>Add a nonnormative note to the Effects in 25.1.4 [alg.foreach]: If
20211 the type of 'first' satisfies the requirements of a mutable iterator,
20212 'f' may apply nonconstant functions through the dereferenced iterators
20213 passed to it.
20214 </p>
20215
20216
20217
20218 <p><b>Rationale:</b></p>
20219 <p>The LWG believes that nothing in the standard prohibits function
20220   objects that modify the sequence elements. The problem is that
20221   for_each is in a secion entitled "nonmutating algorithms", and the
20222   title may be confusing.  A nonnormative note should clarify that.</p>
20223
20224
20225
20226
20227
20228 <hr>
20229 <h3><a name="478"></a>478. Should forward iterator requirements table have a line for r-&gt;m?</h3>
20230 <p><b>Section:</b> 24.1.3 [forward.iterators] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20231  <b>Submitter:</b> Dave Abrahams <b>Date:</b> 2004-07-11</p>
20232 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#forward.iterators">issues</a> in [forward.iterators].</p>
20233 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20234 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#477">477</a></p>
20235 <p><b>Discussion:</b></p>
20236 <p>
20237 The Forward Iterator requirements table contains the following:
20238 </p>
20239 <pre> expression  return type         operational  precondition
20240                                   semantics
20241   ==========  ==================  ===========  ==========================
20242   a-&gt;m        U&amp; if X is mutable, (*a).m       pre: (*a).m is well-defined.
20243               otherwise const U&amp;
20244
20245   r-&gt;m        U&amp;                  (*r).m       pre: (*r).m is well-defined.
20246 </pre>
20247
20248 <p>The second line may be unnecessary.  Paragraph 11 of
20249   [lib.iterator.requirements] says:
20250 </p>
20251
20252 <blockquote><p>
20253    In the following sections, a and b denote values of type const X, n
20254    denotes a value of the difference type Distance, u, tmp, and m
20255    denote identifiers, r denotes a value of X&amp;, t denotes a value of
20256    value type T, o denotes a value of some type that is writable to
20257    the output iterator.
20258 </p></blockquote>
20259
20260 <p>
20261 Because operators can be overloaded on an iterator's const-ness, the
20262 current requirements allow iterators to make many of the operations
20263 specified using the identifiers a and b invalid for non-const
20264 iterators.</p>
20265
20266 <p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#477">477</a></p>
20267
20268
20269 <p><b>Proposed resolution:</b></p>
20270
20271 <p>Remove the "r-&gt;m" line from the Forward Iterator requirements
20272 table. Change</p>
20273 <blockquote><p>
20274     "const X"
20275 </p></blockquote>
20276
20277 <p> to </p>
20278
20279 <blockquote><p>
20280     "X or const X" 
20281 </p></blockquote>
20282
20283 <p>in paragraph 11 of [lib.iterator.requirements].</p>
20284
20285
20286
20287
20288 <p><b>Rationale:</b></p>
20289 <p>
20290 This is a defect because it constrains an lvalue to returning a modifiable lvalue.
20291 </p>
20292
20293
20294
20295
20296
20297 <hr>
20298 <h3><a name="488"></a>488. rotate throws away useful information</h3>
20299 <p><b>Section:</b> 25.2.11 [alg.rotate] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20300  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2004-11-22</p>
20301 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20302 <p><b>Discussion:</b></p>
20303 <p>
20304 rotate takes 3 iterators:  first, middle and last which point into a
20305 sequence, and rearranges the sequence such that the subrange [middle,
20306 last) is now at the beginning of the sequence and the subrange [first,
20307 middle) follows.  The return type is void. 
20308 </p>
20309
20310 <p>
20311 In many use cases of rotate, the client needs to know where the
20312 subrange [first, middle) starts after the rotate is performed.  This
20313 might look like: 
20314 </p>
20315 <pre>  rotate(first, middle, last);
20316   Iterator i = advance(first, distance(middle, last));
20317 </pre>
20318
20319 <p>
20320 Unless the iterators are random access, the computation to find the
20321 start of the subrange [first, middle) has linear complexity.  However,
20322 it is not difficult for rotate to return this information with
20323 negligible additional computation expense.  So the client could code: 
20324 </p>
20325 <pre>  Iterator i = rotate(first, middle, last);
20326 </pre>
20327
20328 <p>
20329 and the resulting program becomes significantly more efficient.
20330 </p>
20331
20332 <p>
20333 While the backwards compatibility hit with this change is not zero, it
20334 is very small (similar to that of lwg <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#130">130</a>), and there is
20335 a significant benefit to the change. 
20336 </p>
20337
20338
20339
20340 <p><b>Proposed resolution:</b></p>
20341 <p>In 25 [algorithms] p2, change:</p>
20342
20343 <blockquote><pre>  template&lt;class ForwardIterator&gt;
20344     <del>void</del> <ins>ForwardIterator</ins> rotate(ForwardIterator first, ForwardIterator middle,
20345                 ForwardIterator last);
20346 </pre></blockquote>
20347
20348 <p>In 25.2.11 [alg.rotate], change:</p>
20349
20350 <blockquote><pre>  template&lt;class ForwardIterator&gt;
20351     <del>void</del> <ins>ForwardIterator</ins> rotate(ForwardIterator first, ForwardIterator middle,
20352                 ForwardIterator last);
20353 </pre></blockquote>
20354
20355 <p>In 25.2.11 [alg.rotate] insert a new paragraph after p1:</p>
20356
20357 <blockquote>
20358 <p><b>Returns</b>: <tt>first + (last - middle)</tt>.</p>
20359 </blockquote>
20360
20361 <p><i>[
20362 The LWG agrees with this idea, but has one quibble: we want to make
20363 sure not to give the impression that the function "advance" is
20364 actually called, just that the nth iterator is returned.  (Calling
20365 advance is observable behavior, since users can specialize it for
20366 their own iterators.)  Howard will provide wording.
20367 ]</i></p>
20368
20369
20370 <p><i>[Howard provided wording for mid-meeting-mailing Jun. 2005.]</i></p>
20371
20372
20373 <p><i>[
20374 Toronto: moved to Ready.
20375 ]</i></p>
20376
20377
20378
20379
20380
20381
20382
20383 <hr>
20384 <h3><a name="495"></a>495. Clause 22 template parameter requirements</h3>
20385 <p><b>Section:</b> 22 [localization] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20386  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2005-01-10</p>
20387 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#localization">issues</a> in [localization].</p>
20388 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20389 <p><b>Discussion:</b></p>
20390 <p>It appears that there are no requirements specified for many of the
20391 template parameters in clause 22. It looks like this issue has never
20392 come up, except perhaps for Facet.</p>
20393
20394 <p>Clause 22 isn't even listed in 17.3.2.1 [lib.type.descriptions],
20395 either, which is the wording that allows requirements on template
20396 parameters to be identified by name.</p>
20397
20398 <p>So one issue is that 17.3.2.1 [lib.type.descriptions] Should be
20399 changed to cover clause 22. A better change, which will cover us in
20400 the future, would be to say that it applies to all the library
20401 clauses. Then if a template gets added to any library clause we are
20402 covered.</p>
20403
20404 <p>charT, InputIterator, and other names with requirements defined
20405 elsewhere are fine, assuming the 17.3.2.1 [lib.type.descriptions] fix.
20406 But there are a few template arguments names which I don't think have
20407 requirements given elsewhere:</p>
20408
20409 <ul>
20410 <li>internT and externT.  The fix is to add wording saying that internT
20411 and externT must meet the same requirements as template arguments
20412 named charT.</li>
20413
20414 <li>stateT.  I'm not sure about this one. There already is some wording,
20415 but it seems a bit vague.</li>
20416
20417 <li>Intl.  [lib.locale.moneypunct.byname] The fix for this one is to
20418 rename "Intl" to "International". The name is important because other
20419 text identifies the requirements for the name International but not
20420 for Intl.</li>
20421 </ul>
20422
20423 <p><b>Proposed resolution:</b></p>
20424 <p>Change 17.3.2.1 [type.descriptions], paragraph 1, from:</p>
20425 <blockquote><p>
20426 The Requirements subclauses may describe names that are used to
20427 specify constraints on template arguments.153) These names are used in
20428 clauses 20, 23, 25, and 26 to describe the types that may be supplied
20429 as arguments by a C++ program when instantiating template components
20430 from the library. 
20431 </p></blockquote>
20432 <p>to:</p>
20433 <blockquote><p>
20434 The Requirements subclauses may describe names that are used to
20435 specify constraints on template arguments.153) These names are used in
20436 library clauses to describe the types that may be supplied as
20437 arguments by a C++ program when instantiating template components from
20438 the library.
20439 </p></blockquote>
20440
20441 <p>In the front matter of class 22, locales, add:</p>
20442 <blockquote><p>
20443 Template parameter types internT and externT shall meet the
20444 requirements of charT (described in 21 [strings]).
20445 </p></blockquote>
20446
20447
20448 <p><b>Rationale:</b></p>
20449 <p>
20450  Again, a blanket clause isn't blanket enough. Also, we've got a
20451  couple of names that we don't have blanket requirement statements
20452  for. The only issue is what to do about stateT. This wording is
20453  thin, but probably adequate.</p>
20454
20455
20456
20457
20458
20459 <hr>
20460 <h3><a name="496"></a>496. Illegal use of "T" in vector&lt;bool&gt;</h3>
20461 <p><b>Section:</b> 23.2.6 [vector] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20462  <b>Submitter:</b> richard@ex-parrot.com <b>Date:</b> 2005-02-10</p>
20463 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector">issues</a> in [vector].</p>
20464 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20465 <p><b>Discussion:</b></p>
20466 <p>
20467 In the synopsis of the std::vector&lt;bool&gt; specialisation in 23.2.6 [vector],
20468 the non-template assign() function has the signature</p>
20469
20470 <pre>  void assign( size_type n, const T&amp; t );
20471 </pre>
20472
20473 <p>The type, T, is not defined in this context.</p>
20474
20475
20476 <p><b>Proposed resolution:</b></p>
20477 <p>Replace "T" with "value_type".</p>
20478
20479
20480
20481
20482
20483 <hr>
20484 <h3><a name="497"></a>497. meaning of numeric_limits::traps for floating point types</h3>
20485 <p><b>Section:</b> 18.2.1.2 [numeric.limits.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20486  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2005-03-02</p>
20487 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#numeric.limits.members">issues</a> in [numeric.limits.members].</p>
20488 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20489 <p><b>Discussion:</b></p>
20490
20491 <p>18.2.1.2, p59 says this much about the traps member of numeric_limits:</p>
20492
20493 <blockquote>
20494 <p>static const bool traps;<br>
20495 -59- true if trapping is implemented for the type.204)
20496 <br>
20497 Footnote 204: Required by LIA-1.
20498 </p>
20499 </blockquote>
20500
20501 <p>It's not clear what is meant by "is implemented" here.</p>
20502
20503 <p>
20504 In the context of floating point numbers it seems reasonable to expect
20505 to be able to use traps to determine whether a program can "safely" use
20506 infinity(), quiet_NaN(), etc., in arithmetic expressions, that is
20507 without causing a trap (i.e., on UNIX without having to worry about
20508 getting a signal). When traps is true, I would expect any of the
20509 operations in section 7 of IEEE 754 to cause a trap (and my program
20510 to get a SIGFPE). So, for example, on Alpha, I would expect traps
20511 to be true by default (unless I compiled my program with the -ieee
20512 option), false by default on most other popular architectures,
20513 including IA64, MIPS, PA-RISC, PPC, SPARC, and x86 which require
20514 traps to be explicitly enabled by the program.
20515 </p>
20516
20517 <p>
20518 Another possible interpretation of p59 is that traps should be true
20519 on any implementation that supports traps regardless of whether they
20520 are enabled by default or not. I don't think such an interpretation
20521 makes the traps member very useful, even though that is how traps is
20522 implemented on several platforms. It is also the only way to implement
20523 traps on platforms that allow programs to enable and disable trapping
20524 at runtime.
20525 </p>
20526
20527
20528 <p><b>Proposed resolution:</b></p>
20529 <p>Change p59 to read:</p>
20530 <blockquote><p>True if, at program startup, there exists a value of the type that
20531   would cause an arithmetic operation using that value to trap.</p></blockquote>
20532
20533
20534 <p><b>Rationale:</b></p>
20535 <p>
20536  Real issue, since trapping can be turned on and off. Unclear what a
20537  static query can say about a dynamic issue. The real advice we should
20538  give users is to use cfenv for these sorts of queries. But this new
20539  proposed resolution is at least consistent and slightly better than
20540  nothing.</p>
20541
20542
20543
20544
20545
20546 <hr>
20547 <h3><a name="505"></a>505. Result_type in random distribution requirements</h3>
20548 <p><b>Section:</b> 26.4.1 [rand.req], TR1 5.1.1 [tr.rand.req] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20549  <b>Submitter:</b> Walter Brown <b>Date:</b> 2005-07-03</p>
20550 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.req">issues</a> in [rand.req].</p>
20551 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20552 <p><b>Discussion:</b></p>
20553 <p>
20554 Table 17: Random distribution requirements
20555 </p>
20556 <p>
20557 Row 1 requires that each random distribution provide a nested type "input_type";
20558 this type denotes the type of the values that the distribution consumes.
20559 </p>
20560 <p>
20561 Inspection of all distributions in [tr.rand.dist] reveals that each distribution
20562 provides a second typedef ("result_type") that denotes the type of the values the
20563 distribution produces when called.  
20564 </p>
20565
20566
20567 <p><b>Proposed resolution:</b></p>
20568 <p>
20569 It seems to me that this is also a requirement
20570 for all distributions and should therefore be  indicated as such via a new second
20571 row to this table 17:
20572 </p>
20573 <table border="1" cellpadding="5">
20574 <tbody><tr><td>X::result_type</td><td>T</td><td>---</td><td>compile-time</td></tr>
20575 </tbody></table>
20576
20577 <p><i>[
20578 Berlin:  Voted to WP.  N1932 adopts the proposed resolution:  see Table 5 row 1.
20579 ]</i></p>
20580
20581
20582
20583
20584
20585
20586
20587 <hr>
20588 <h3><a name="507"></a>507. Missing requirement for variate_generator::operator()</h3>
20589 <p><b>Section:</b> 26.4 [rand], TR1 5.1.3 [tr.rand.var] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20590  <b>Submitter:</b> Walter Brown <b>Date:</b> 2005-07-03</p>
20591 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand">issues</a> in [rand].</p>
20592 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20593 <p><b>Discussion:</b></p>
20594 <p>
20595 Paragraph 11 of [tr.rand.var] equires that the member template
20596 </p>
20597 <blockquote><pre>template&lt;class T&gt; result_type operator() (T value);
20598 </pre></blockquote>
20599 <p>
20600 return
20601 </p>
20602 <blockquote><pre>distribution()(e, value)
20603 </pre></blockquote>
20604 <p>
20605 However, not all distributions have an operator() with a corresponding signature.
20606 </p>
20607
20608 <p><i>[
20609 Berlin:  As a working group we voted in favor of N1932 which makes this moot:
20610 variate_generator has been eliminated.  Then in full committee we voted to give
20611 this issue WP status (mistakenly).
20612 ]</i></p>
20613
20614
20615
20616
20617 <p><b>Proposed resolution:</b></p>
20618 <p>
20619 We therefore  recommend that we insert the following precondition before paragraph 11:
20620 </p>
20621 <blockquote><p>
20622 Precondition:  <tt>distribution().operator()(e,value)</tt> is well-formed.
20623 </p></blockquote>
20624
20625
20626
20627
20628
20629 <hr>
20630 <h3><a name="508"></a>508. Bad parameters for ranlux64_base_01</h3>
20631 <p><b>Section:</b> 26.4.5 [rand.predef], TR1 5.1.5 [tr.rand.predef] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20632  <b>Submitter:</b> Walter Brown <b>Date:</b> 2005-07-03</p>
20633 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.predef">issues</a> in [rand.predef].</p>
20634 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20635 <p><b>Discussion:</b></p>
20636 <p>
20637 The fifth of these engines with predefined parameters, ranlux64_base_01,
20638 appears to have an unintentional error for which there is a simple correction.
20639 The two pre-defined  subtract_with_carry_01 engines are given as: 
20640 </p>
20641 <blockquote><pre>typedef subtract_with_carry_01&lt;float,  24, 10, 24&gt; ranlux_base_01;
20642 typedef subtract_with_carry_01&lt;double, 48, 10, 24&gt; ranlux64_base_01;
20643 </pre></blockquote>
20644 <p>
20645 We demonstrate below that ranlux64_base_01 fails to meet the intent of the
20646 random number generation proposal, but that the simple correction to
20647 </p>
20648 <blockquote><pre>typedef subtract_with_carry_01&lt;double, 48,  5, 12&gt; ranlux64_base_01;
20649 </pre></blockquote>
20650 <p>
20651 does meet the intent of defining well-known good parameterizations.
20652 </p>
20653 <p>
20654 The ranlux64_base_01 engine as presented fails to meet the intent for
20655 predefined engines, stated in proposal N1398 (section E):
20656 </p>
20657 <blockquote><p>
20658 In order to make good random numbers available to a large number of library
20659 users, this proposal not only defines generic random-number engines, but also
20660 provides a number of predefined well-known good parameterizations for those.
20661 </p></blockquote>
20662 <p>
20663 The predefined ranlux_base_01 engine has been proven [1,2,3] to have a very
20664 long period and so meets this criterion.  This property makes it suitable for
20665 use in the excellent discard_block  engines defined subsequently.  The proof
20666 of long period relies on the fact (proven in [1]) that 2**(w*r) - 2**(w*s)
20667 + 1 is prime (w, r, and s are template parameters to subtract_with_carry_01,
20668 as defined in [tr.rand.eng.sub1]).
20669 </p>
20670 <p>
20671 The ranlux64_base_01 engine as presented in [tr.rand.predef] uses w=48, r=24, s=10.
20672 For these numbers, the combination 2**(w*r)-2**(w*s)+1 is non-prime (though
20673 explicit factorization  would be a challenge).  In consequence, while it is
20674 certainly possible for some seeding states that this engine would have a very
20675 long period, it is not at all "well-known" that this is the case. The intent
20676 in the N1398 proposal involved the base of the ranlux64 engine, which finds heavy
20677 use in the physics community.  This is isomorphic to the predefined ranlux_base_01,
20678 but exploits the ability of double variables to hold (at least) 48 bits of mantissa,
20679 to deliver 48 random bits at a time rather than 24.
20680 </p>
20681
20682
20683 <p><b>Proposed resolution:</b></p>
20684 <p>
20685 To achieve this intended behavior, the correct template parameteriztion  would be:
20686 </p>
20687 <blockquote><pre>typedef subtract_with_carry_01&lt;double, 48, 5, 12&gt; ranlux64_base_01;
20688 </pre></blockquote>
20689 <p>
20690 The sequence of mantissa bits delivered by this is isomorphic (treating each
20691 double as having the  bits of two floats) to that delivered by ranlux_base_01.
20692 </p>
20693 <p>
20694 <b>References:</b>
20695 </p>
20696 <ol>
20697 <li>F. James, Comput. Phys. Commun. 60(1990) 329</li>
20698 <li>G. Marsaglia and A. Zaman, Ann. Appl. Prob 1(1991) 462</li>
20699 <li>M. Luscher, Comput. Phys. Commun. 79(1994) 100-110</li>
20700 </ol>
20701
20702 <p><i>[
20703 Berlin: Voted to WP.  N1932 adopts the proposed resolution in 26.3.5,
20704 just above paragraph 5.
20705 ]</i></p>
20706
20707
20708
20709
20710
20711
20712
20713 <hr>
20714 <h3><a name="518"></a>518. Are insert and erase stable for unordered_multiset and unordered_multimap?</h3>
20715 <p><b>Section:</b> 23.1.5 [unord.req], TR1 6.3.1 [tr.unord.req] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20716  <b>Submitter:</b> Matt Austern <b>Date:</b> 2005-07-03</p>
20717 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#unord.req">active issues</a> in [unord.req].</p>
20718 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#unord.req">issues</a> in [unord.req].</p>
20719 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20720 <p><b>Discussion:</b></p>
20721 <p>
20722 Issue 371 deals with stability of multiset/multimap under insert and erase
20723 (i.e. do they preserve the relative order in ranges of equal elements).
20724 The same issue applies to unordered_multiset and unordered_multimap.
20725 </p>
20726 <p><i>[
20727 Moved to open (from review):  There is no resolution.
20728 ]</i></p>
20729
20730
20731 <p><i>[
20732 Toronto:  We have a resolution now.  Moved to Review.  Some concern was noted
20733 as to whether this conflicted with existing practice or not.  An additional
20734 concern was in specifying (partial) ordering for an unordered container.
20735 ]</i></p>
20736
20737
20738
20739
20740 <p><b>Proposed resolution:</b></p>
20741 <p>
20742 Wording for the proposed resolution is taken from the equivalent text for associative containers.
20743 </p>
20744
20745 <p>
20746 Change 23.1.5 [unord.req], Unordered associative containers, paragraph 6 to:
20747 </p>
20748
20749 <blockquote><p>
20750 An unordered associative container supports <i>unique</i> keys if it may 
20751 contain at most one element for each key. Otherwise, it supports <i>equivalent 
20752 keys</i>. <tt>unordered_set</tt> and <tt>unordered_map</tt> support 
20753 unique keys. <tt>unordered_multiset</tt> and <tt>unordered_multimap</tt> 
20754 support equivalent keys. In containers that support equivalent keys, elements 
20755 with equivalent keys are adjacent to each other. <ins>For
20756 <tt>unordered_multiset</tt> 
20757 and <tt>unordered_multimap</tt>,<tt> insert</tt> and <tt>erase</tt> 
20758 preserve the relative ordering of equivalent elements.</ins>
20759 </p></blockquote>
20760
20761 <p>
20762 Change 23.1.5 [unord.req], Unordered associative containers, paragraph 8 to:
20763 </p>
20764
20765 <blockquote>
20766 <p>The elements of an unordered associative container are organized into <i>
20767 buckets</i>. Keys with the same hash code appear in the same bucket. The number 
20768 of buckets is automatically increased as elements are added to an unordered 
20769 associative container, so that the average number of elements per bucket is kept 
20770 below a bound. Rehashing invalidates iterators, changes ordering between 
20771 elements, and changes which buckets elements appear in, but does not invalidate 
20772 pointers or references to elements. <ins>For <tt>unordered_multiset</tt> 
20773 and <tt>unordered_multimap</tt>, rehashing 
20774 preserves the relative ordering of equivalent elements.</ins></p>
20775 </blockquote>
20776
20777
20778
20779
20780
20781
20782 <hr>
20783 <h3><a name="519"></a>519. Data() undocumented</h3>
20784 <p><b>Section:</b> 23.2.1 [array], TR1 6.2.2 [tr.array.array] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20785  <b>Submitter:</b> Pete Becker <b>Date:</b> 2005-07-03</p>
20786 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#array">active issues</a> in [array].</p>
20787 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#array">issues</a> in [array].</p>
20788 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20789 <p><b>Discussion:</b></p>
20790 <p>
20791 <tt>array&lt;&gt;::data()</tt> is present in the class synopsis, but not documented.
20792 </p>
20793
20794
20795 <p><b>Proposed resolution:</b></p>
20796 <p>
20797 Add a new section, after 6.2.2.3:
20798 </p>
20799 <blockquote><pre>T*       data()
20800 const T* data() const;
20801 </pre></blockquote>
20802 <p>
20803 <b>Returns:</b> <tt>elems</tt>.
20804 </p>
20805 <p>
20806 Change 6.2.2.4/2 to:
20807 </p>
20808 <blockquote><p>
20809 In the case where <tt>N == 0</tt>, <tt>begin() == end()</tt>. The return value
20810 of <tt>data()</tt> is unspecified.
20811 </p></blockquote>
20812
20813
20814
20815
20816
20817 <hr>
20818 <h3><a name="520"></a>520. Result_of and pointers to data members</h3>
20819 <p><b>Section:</b> 20.6.11.1 [func.bind], TR1 3.6 [tr.func.bind] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20820  <b>Submitter:</b> Pete Becker <b>Date:</b> 2005-07-03</p>
20821 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20822 <p><b>Discussion:</b></p>
20823 <p>
20824 In the original proposal for binders, the return type of bind() when
20825 called with a pointer to member data as it's callable object was
20826 defined to be mem_fn(ptr); when Peter Dimov and I  unified the
20827 descriptions of the TR1 function objects we hoisted the descriptions
20828 of return types into the INVOKE pseudo-function and into result_of.
20829 Unfortunately, we left pointer to member data out of result_of, so
20830 bind doesn't have any specified behavior when called with a pointer
20831 to  member data.
20832 </p>
20833
20834
20835 <p><b>Proposed resolution:</b></p>
20836 <p><i>[
20837 Pete and Peter will provide wording.
20838 ]</i></p>
20839
20840
20841 <p>
20842 In 20.5.4 [lib.func.ret] ([tr.func.ret]) p3 add the following bullet after bullet 2:
20843 </p>
20844 <ol start="3">
20845 <li>If <tt>F</tt> is a member data pointer type <tt>R T::*</tt>, <tt>type</tt>
20846 shall be <tt><i>cv</i> R&amp;</tt> when <tt>T1</tt> is <tt><i>cv</i> U1&amp;</tt>,
20847 <tt>R</tt> otherwise.</li>
20848 </ol>
20849
20850 <p><i>[
20851 Peter provided wording.
20852 ]</i></p>
20853
20854
20855
20856
20857
20858
20859
20860 <hr>
20861 <h3><a name="521"></a>521. Garbled requirements for argument_type in reference_wrapper</h3>
20862 <p><b>Section:</b> 20.6.5 [refwrap], TR1 2.1.2 [tr.util.refwrp.refwrp] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20863  <b>Submitter:</b> Pete Becker <b>Date:</b> 2005-07-03</p>
20864 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20865 <p><b>Discussion:</b></p>
20866 <p>
20867 2.1.2/3, second bullet item currently says that reference_wrapper&lt;T&gt; is
20868 derived from unary_function&lt;T, R&gt; if T is:
20869 </p>
20870 <blockquote><p>
20871 a pointer to member function type with cv-qualifier cv and no arguments;
20872 the type T1 is cv T* and R is the return type of the pointer to member function;
20873 </p></blockquote>
20874 <p>
20875 The type of T1 can't be cv T*, 'cause that's a pointer to a pointer to member
20876 function. It should be a pointer to the class that T is a pointer to member of.
20877 Like this:
20878 </p>
20879 <blockquote><p>
20880 a pointer to a member function R T0::f() cv (where cv represents the member
20881 function's cv-qualifiers); the type T1 is cv T0*
20882 </p></blockquote>
20883 <p>
20884 Similarly, bullet item 2 in 2.1.2/4 should be:
20885 </p>
20886 <blockquote><p>
20887 a pointer to a member function R T0::f(T2) cv (where cv represents the member
20888 function's cv-qualifiers); the type T1 is cv T0*
20889 </p></blockquote>
20890
20891
20892 <p><b>Proposed resolution:</b></p>
20893
20894 <p>
20895 Change bullet item 2 in 2.1.2/3:
20896 </p>
20897
20898 <blockquote>
20899 <ul>
20900 <li>
20901 a pointer to member function <del>type with cv-qualifier <tt><i>cv</i></tt> and no arguments;
20902 the type <tt>T1</tt> is <tt><i>cv</i> T*</tt> and <tt>R</tt> is the return 
20903 type of the pointer to member function</del> <ins><tt>R T0::f() <i>cv</i></tt>
20904 (where <tt><i>cv</i></tt> represents the member function's cv-qualifiers);
20905 the type <tt>T1</tt> is <tt><i>cv</i> T0*</tt></ins>
20906 </li>
20907 </ul>
20908 </blockquote>
20909
20910 <p>
20911 Change bullet item 2 in 2.1.2/4:
20912 </p>
20913
20914 <blockquote>
20915 <ul>
20916 <li>
20917 a pointer to member function <del>with cv-qualifier <tt><i>cv</i></tt> and taking one argument
20918 of type <tt>T2</tt>; the type <tt>T1</tt> is <tt><i>cv</i> T*</tt> and 
20919 <tt>R</tt> is the return type of the pointer to member function</del>
20920 <ins><tt>R T0::f(T2) <i>cv</i></tt> (where <tt><i>cv</i></tt> represents the member
20921 function's cv-qualifiers); the type <tt>T1</tt> is <tt><i>cv</i> T0*</tt></ins>
20922 </li>
20923 </ul>
20924 </blockquote>
20925
20926
20927
20928
20929
20930
20931 <hr>
20932 <h3><a name="524"></a>524. regex named character classes and case-insensitivity don't mix</h3>
20933 <p><b>Section:</b> 28 [re] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
20934  <b>Submitter:</b> Eric Niebler <b>Date:</b> 2005-07-01</p>
20935 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#re">issues</a> in [re].</p>
20936 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
20937 <p><b>Discussion:</b></p>
20938 <p>
20939 This defect is also being discussed on the Boost developers list. The 
20940 full discussion can be found here:
20941 http://lists.boost.org/boost/2005/07/29546.php
20942 </p>
20943 <p>
20944 -- Begin original message --
20945 </p>
20946 <p>
20947 Also, I may have found another issue, closely related to the one under
20948 discussion. It regards case-insensitive matching of named character
20949 classes. The regex_traits&lt;&gt; provides two functions for working with
20950 named char classes: lookup_classname and isctype. To match a char class
20951 such as [[:alpha:]], you pass "alpha" to lookup_classname and get a
20952 bitmask. Later, you pass a char and the bitmask to isctype and get a
20953 bool yes/no answer.
20954 </p>
20955 <p>
20956 But how does case-insensitivity work in this scenario? Suppose we're
20957 doing a case-insensitive match on [[:lower:]]. It should behave as if it
20958 were [[:lower:][:upper:]], right? But there doesn't seem to be enough
20959 smarts in the regex_traits interface to do this.
20960 </p>
20961 <p>
20962 Imagine I write a traits class which recognizes [[:fubar:]], and the
20963 "fubar" char class happens to be case-sensitive. How is the regex engine
20964 to know that? And how should it do a case-insensitive match of a
20965 character against the [[:fubar:]] char class? John, can you confirm this
20966 is a legitimate problem?
20967 </p>
20968 <p>
20969 I see two options:
20970 </p>
20971 <p>
20972 1) Add a bool icase parameter to lookup_classname. Then,
20973 lookup_classname( "upper", true ) will know to return lower|upper
20974 instead of just upper.
20975 </p>
20976 <p>
20977 2) Add a isctype_nocase function
20978 </p>
20979 <p>
20980 I prefer (1) because the extra computation happens at the time the
20981 pattern is compiled rather than when it is executed.
20982 </p>
20983 <p>
20984 -- End original message --
20985 </p>
20986
20987 <p>
20988 For what it's worth, John has also expressed his preference for option 
20989 (1) above.
20990 </p>
20991
20992
20993 <p><b>Proposed resolution:</b></p>
20994 <p>
20995 Adopt the proposed resolution in
20996 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2409.pdf">N2409</a>.
20997 </p>
20998
20999
21000 <p><i>[
21001 Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue.
21002 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
21003 ]</i></p>
21004
21005
21006
21007
21008
21009 <hr>
21010 <h3><a name="527"></a>527. tr1::bind has lost its Throws clause</h3>
21011 <p><b>Section:</b> 20.6.11.1.3 [func.bind.bind], TR1 3.6.3 [tr.func.bind.bind] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21012  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2005-10-01</p>
21013 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#func.bind.bind">active issues</a> in [func.bind.bind].</p>
21014 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#func.bind.bind">issues</a> in [func.bind.bind].</p>
21015 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21016 <p><b>Discussion:</b></p>
21017 <p>
21018 The original bind proposal gives the guarantee that tr1::bind(f, t1,
21019 ..., tN) does not throw when the copy constructors of f, t1, ..., tN
21020 don't.
21021 </p>
21022
21023 <p>
21024 This guarantee is not present in the final version of TR1.
21025 </p>
21026
21027 <p>
21028 I'm pretty certain that we never removed it on purpose. Editorial omission? :-)
21029 </p>
21030
21031 <p><i>[
21032 Berlin: not quite editorial, needs proposed wording.
21033 ]</i></p>
21034
21035 <p><i>[
21036 Batavia:  Doug to translate wording to variadic templates.
21037 ]</i></p>
21038
21039
21040 <p><i>[
21041 Toronto:  We agree but aren't quite happy with the wording.  The "t"'s no
21042 longer refer to anything.  Alan to provide improved wording.
21043 ]</i></p>
21044
21045
21046
21047 <p><i>[
21048 Pre-Bellevue:  Alisdair provided wording.
21049 ]</i></p>
21050
21051
21052 <p>
21053 TR1 proposed resolution:
21054 </p>
21055
21056 <blockquote>
21057 <p>
21058 In TR1 3.6.3 [tr.func.bind.bind], add a new paragraph after p2:
21059 </p>
21060 <blockquote><p>
21061 <i>Throws:</i> Nothing unless one of the copy constructors of <tt>f, t1, t2, ..., tN</tt>
21062 throws an exception.
21063 </p></blockquote>
21064
21065 <p>
21066 Add a new paragraph after p4:
21067 </p>
21068 <blockquote><p>
21069 <i>Throws:</i> nothing unless one of the copy constructors of <tt>f, t1, t2, ..., tN</tt>
21070 throws an exception.
21071 </p></blockquote>
21072
21073 </blockquote>
21074
21075
21076
21077 <p><b>Proposed resolution:</b></p>
21078 <p>
21079 In 20.6.11.1.3 [func.bind.bind], add a new paragraph after p2:
21080 </p>
21081
21082 <blockquote>
21083 <i>Throws:</i> Nothing unless the copy constructor of <tt>F</tt> or of one of the types
21084 in the <tt>BoundArgs...</tt> pack expansion throws an exception. 
21085 </blockquote>
21086
21087 <p>
21088 In 20.6.11.1.3 [func.bind.bind], add a new paragraph after p4:
21089 </p>
21090
21091 <blockquote>
21092 <i>Throws:</i> Nothing unless the copy constructor of <tt>F</tt> or of one of the types
21093 in the <tt>BoundArgs...</tt> pack expansion throws an exception. 
21094 </blockquote>
21095
21096
21097
21098
21099
21100
21101 <hr>
21102 <h3><a name="530"></a>530. Must elements of a string be contiguous?</h3>
21103 <p><b>Section:</b> 21.3 [basic.string] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21104  <b>Submitter:</b> Matt Austern <b>Date:</b> 2005-11-15</p>
21105 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
21106 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.string">issues</a> in [basic.string].</p>
21107 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21108 <p><b>Discussion:</b></p>
21109 <p>Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#69">69</a>, which was incorporated into C++03, mandated
21110    that the elements of a vector must be stored in contiguous memory.
21111    Should the same also apply to <tt>basic_string</tt>?</p>
21112
21113 <p>We almost require contiguity already. Clause 23.3.4 [multiset]
21114   defines <tt>operator[]</tt> as <tt>data()[pos]</tt>. What's missing
21115   is a similar guarantee if we access the string's elements via the
21116   iterator interface.</p>
21117
21118 <p>Given the existence of <tt>data()</tt>, and the definition of
21119   <tt>operator[]</tt> and <tt>at</tt> in terms of <tt>data</tt>,
21120   I don't believe it's possible to write a useful and standard-
21121   conforming <tt>basic_string</tt> that isn't contiguous. I'm not
21122   aware of any non-contiguous implementation. We should just require
21123   it.
21124 </p>
21125
21126
21127 <p><b>Proposed resolution:</b></p>
21128 <p>Add the following text to the end of 21.3 [basic.string],
21129 paragraph 2. </p>
21130
21131 <blockquote>
21132   <p>The characters in a string are stored contiguously, meaning that if
21133   <tt>s</tt> is a <tt>basic_string&lt;charT, Allocator&gt;</tt>, then
21134   it obeys the identity
21135   <tt>&amp;*(s.begin() + n) == &amp;*s.begin() + n</tt>
21136   for all <tt>0 &lt;= n &lt; s.size()</tt>.
21137   </p>
21138 </blockquote>
21139
21140
21141 <p><b>Rationale:</b></p>
21142 <p>
21143 Not standardizing this existing practice does not give implementors more
21144 freedom.  We thought it might a decade ago.  But the vendors have spoken
21145 both with their implementations, and with their voice at the LWG
21146 meetings.  The implementations are going to be contiguous no matter what
21147 the standard says.  So the standard might as well give string clients
21148 more design choices.
21149 </p>
21150
21151
21152
21153
21154
21155 <hr>
21156 <h3><a name="531"></a>531. array forms of unformatted input functions</h3>
21157 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21158  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2005-11-23</p>
21159 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
21160 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21161 <p><b>Discussion:</b></p>
21162 <p>
21163 The array forms of unformatted input functions don't seem to have well-defined
21164 semantics for zero-element arrays in a couple of cases. The affected ones
21165 (<tt>istream::get()</tt> and <tt>istream::getline()</tt>) are supposed to
21166 terminate when <tt>(n - 1)</tt> characters are stored, which obviously can
21167 never be true when <tt>(n == 0)</tt> holds to start with. See
21168 c++std-lib-16071.
21169 </p>
21170
21171
21172 <p><b>Proposed resolution:</b></p>
21173 <p>
21174 I suggest changing 27.6.1.3, p7 (<tt>istream::get()</tt>), bullet 1 to read:
21175 </p>
21176             <ul>
21177                 <li>
21178                     <tt>(n &lt; 1)</tt> is true or <tt>(n - 1)</tt> characters
21179                     are stored;
21180                 </li>
21181             </ul>
21182 <p>
21183 Change 27.6.1.3, p9:
21184 </p>
21185
21186 <blockquote><p>
21187 If the function stores no characters, it calls <tt>setstate(failbit)</tt> (which
21188 may throw <tt>ios_base::failure</tt> (27.4.4.3)).  In any case, <ins>if <tt>(n
21189 &gt; 0)</tt> is true</ins> it then stores a null character into the next
21190 successive location of the array.
21191 </p></blockquote>
21192
21193         <p>
21194
21195 and similarly p17 (<tt>istream::getline()</tt>), bullet 3 to:
21196
21197         </p>
21198             <ul>
21199                 <li>
21200                     <tt>(n &lt; 1)</tt> is true or <tt>(n - 1)</tt> characters
21201                     are stored (in which case the function calls
21202                     <tt>setstate(failbit)</tt>).
21203                 </li>
21204             </ul>
21205
21206         <p>
21207
21208 In addition, to clarify that <tt>istream::getline()</tt> must not store the
21209 terminating NUL character unless the the array has non-zero size, Robert
21210 Klarer suggests in c++std-lib-16082 to change 27.6.1.3, p20 to read:
21211
21212         </p>
21213             <blockquote><p>
21214
21215 In any case, provided <tt>(n &gt; 0)</tt> is true, it then stores a null character
21216 (using charT()) into the next successive location of the array.
21217
21218             </p></blockquote>
21219
21220 <p><i>[
21221 post-Redmond:  Pete noticed that the current resolution for <tt>get</tt> requires
21222 writing to out of bounds memory when <tt>n == 0</tt>.  Martin provided fix.
21223 ]</i></p>
21224
21225
21226
21227
21228
21229
21230
21231 <hr>
21232 <h3><a name="533"></a>533. typo in 2.2.3.10/1</h3>
21233 <p><b>Section:</b> 20.7.12.2.11 [util.smartptr.getdeleter], TR1 2.2.3.10 [tr.util.smartptr.getdeleter] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#DR">DR</a>
21234  <b>Submitter:</b> Paolo Carlini <b>Date:</b> 2005-11-09</p>
21235 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.getdeleter">issues</a> in [util.smartptr.getdeleter].</p>
21236 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#DR">DR</a> status.</p>
21237 <p><b>Discussion:</b></p>
21238 <p>
21239 I'm seeing something that looks like a typo. The Return of <tt>get_deleter</tt>
21240 says:
21241 </p>
21242 <blockquote><p>
21243 If <tt>*this</tt> <i>owns</i> a deleter <tt>d</tt>...
21244 </p></blockquote>
21245 <p>
21246 but <tt>get_deleter</tt> is a free function!
21247 </p>
21248
21249
21250 <p><b>Proposed resolution:</b></p>
21251 <p>
21252 Therefore, I think should be:
21253 </p>
21254 <blockquote><p>
21255 If <tt><del>*this</del> <ins>p</ins></tt> <i>owns</i> a deleter <tt>d</tt>...
21256 </p></blockquote>
21257
21258
21259
21260
21261
21262 <hr>
21263 <h3><a name="534"></a>534. Missing basic_string members</h3>
21264 <p><b>Section:</b> 21.3 [basic.string] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21265  <b>Submitter:</b> Alisdair Meredith <b>Date:</b> 2005-11-16</p>
21266 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
21267 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#basic.string">issues</a> in [basic.string].</p>
21268 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21269 <p><b>Discussion:</b></p>
21270 <p>
21271 OK, we all know std::basic_string is bloated and already has way too
21272 many members.  However, I propose it is missing 3 useful members that
21273 are often expected by users believing it is a close approximation of the
21274 container concept.  All 3 are listed in table 71 as 'optional'
21275 </p>
21276
21277 <p>
21278 i/  pop_back.
21279 </p>
21280
21281 <p>
21282 This is the one I feel most strongly about, as I only just discovered it
21283 was missing as we are switching to a more conforming standard library
21284 &lt;g&gt;
21285 </p>
21286
21287 <p>
21288 I find it particularly inconsistent to support push_back, but not
21289 pop_back.
21290 </p>
21291
21292 <p>
21293 ii/ back.
21294 </p>
21295
21296 <p>
21297 There are certainly cases where I want to examine the last character of
21298 a string before deciding to append, or to trim trailing path separators
21299 from directory names etc.  *rbegin() somehow feels inelegant.
21300 </p>
21301
21302 <p>
21303 iii/ front
21304 </p>
21305
21306 <p>
21307 This one I don't feel strongly about, but if I can get the first two,
21308 this one feels that it should be added as a 'me too' for consistency.
21309 </p>
21310
21311 <p>
21312 I believe this would be similarly useful to the data() member recently
21313 added to vector, or at() member added to the maps.
21314 </p>
21315
21316
21317 <p><b>Proposed resolution:</b></p>
21318 <p>
21319 Add the following members to definition of class template basic_string, 21.3p7
21320 </p>
21321 <blockquote><pre>void pop_back ()
21322
21323 const charT &amp; front() const
21324 charT &amp; front()
21325
21326 const charT &amp; back() const
21327 charT &amp; back()
21328 </pre></blockquote>
21329 <p>
21330 Add the following paragraphs to basic_string description
21331 </p>
21332
21333 <p>
21334 21.3.4p5
21335 </p>
21336 <blockquote>
21337 <pre>const charT &amp; front() const
21338 charT &amp; front()
21339 </pre>
21340 <p>
21341 <i>Precondition:</i> <tt>!empty()</tt>
21342 </p>
21343 <p>
21344 <i>Effects:</i> Equivalent to <tt>operator[](0)</tt>.
21345 </p>
21346 </blockquote>
21347
21348 <p>
21349 21.3.4p6
21350 </p>
21351 <blockquote>
21352 <pre>const charT &amp; back() const
21353 charT &amp; back()
21354 </pre>
21355 <p>
21356 <i>Precondition:</i> <tt>!empty()</tt>
21357 </p>
21358 <p>
21359 <i>Effects:</i> Equivalent to <tt>operator[]( size() - 1)</tt>.
21360 </p>
21361 </blockquote>
21362
21363 <p>
21364 21.3.5.5p10
21365 </p>
21366 <blockquote>
21367 <pre>void pop_back ()
21368 </pre>
21369 <p>
21370 <i>Precondition:</i> <tt>!empty()</tt>
21371 </p>
21372 <p>
21373 <i>Effects:</i> Equivalent to <tt>erase( size() - 1, 1 )</tt>.
21374 </p>
21375 </blockquote>
21376
21377 <p>
21378 Update Table 71: (optional sequence operations)
21379 Add basic_string to the list of containers for the following operations.
21380 </p>
21381 <blockquote><pre>a.front()
21382 a.back()
21383 a.push_back()
21384 a.pop_back()
21385 a[n]
21386 </pre></blockquote>
21387
21388 <p><i>[
21389 Berlin: Has support.  Alisdair provided wording.
21390 ]</i></p>
21391
21392
21393
21394
21395
21396
21397 <hr>
21398 <h3><a name="535"></a>535. std::string::swap specification poorly worded</h3>
21399 <p><b>Section:</b> 21.3.6.8 [string::swap] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21400  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2005-12-14</p>
21401 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string::swap">issues</a> in [string::swap].</p>
21402 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21403 <p><b>Discussion:</b></p>
21404 <p>
21405 std::string::swap currently says for effects and postcondition:
21406 </p>
21407
21408 <blockquote>
21409 <p>
21410 <i>Effects:</i> Swaps the contents of the two strings.
21411 </p>
21412
21413 <p>
21414 <i>Postcondition:</i> <tt>*this</tt> contains the characters that were in <tt><i>s</i></tt>,
21415 <tt><i>s</i></tt> contains the characters that were in <tt>*this</tt>.
21416 </p>
21417 </blockquote>
21418
21419 <p>
21420 Specifying both Effects and Postcondition seems redundant, and the postcondition
21421 needs to be made stronger. Users would be unhappy if the characters were not in
21422 the same order after the swap.
21423 </p>
21424
21425
21426 <p><b>Proposed resolution:</b></p>
21427 <blockquote>
21428 <p>
21429 <del><i>Effects:</i> Swaps the contents of the two strings.</del>
21430 </p>
21431
21432 <p>
21433 <i>Postcondition:</i> <tt>*this</tt> contains the <ins>same sequence of</ins>
21434 characters that <del>were</del> <ins>was</ins> in <tt><i>s</i></tt>,
21435 <tt><i>s</i></tt> contains the <ins>same sequence of</ins> characters that
21436 <del>were</del> <ins>was</ins> in <tt>*this</tt>.
21437 </p>
21438 </blockquote>
21439
21440
21441
21442
21443
21444 <hr>
21445 <h3><a name="537"></a>537. Typos in the signatures in 27.6.1.3/42-43 and 27.6.2.4</h3>
21446 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21447  <b>Submitter:</b> Paolo Carlini <b>Date:</b> 2006-02-12</p>
21448 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
21449 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21450 <p><b>Discussion:</b></p>
21451 <p>
21452 In the most recent working draft, I'm still seeing:
21453 </p>
21454
21455 <blockquote><pre>seekg(off_type&amp; off, ios_base::seekdir dir)
21456 </pre></blockquote>
21457
21458 <p>
21459 and
21460 </p>
21461
21462 <blockquote><pre>seekp(pos_type&amp; pos)
21463
21464 seekp(off_type&amp; off, ios_base::seekdir dir)
21465 </pre></blockquote>
21466
21467 <p>
21468 that is, by reference off and pos arguments.
21469 </p>
21470
21471
21472 <p><b>Proposed resolution:</b></p>
21473 <p>
21474 After 27.6.1.3p42 change:
21475 </p>
21476
21477 <blockquote><pre>basic_istream&lt;charT,traits&gt;&amp; seekg(off_type<del>&amp;</del> <i>off</i>, ios_base::seekdir <i>dir</i>);
21478 </pre></blockquote>
21479
21480 <p>
21481 After 27.6.2.4p1 change:
21482 </p>
21483
21484 <blockquote><pre>basic_ostream&lt;charT,traits&gt;&amp; seekp(pos_type<del>&amp;</del> <i>pos</i>);
21485 </pre></blockquote>
21486
21487 <p>
21488 After 27.6.2.4p3 change:
21489 </p>
21490
21491 <blockquote><pre>basic_ostream&lt;charT,traits&gt;&amp; seekp(off_type<del>&amp;</del> <i>off</i>, ios_base::seekdir <i>dir</i>);
21492 </pre></blockquote>
21493
21494
21495
21496
21497
21498 <hr>
21499 <h3><a name="538"></a>538. 241 again: Does unique_copy() require CopyConstructible and Assignable?</h3>
21500 <p><b>Section:</b> 25.2.9 [alg.unique] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21501  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2006-02-09</p>
21502 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.unique">issues</a> in [alg.unique].</p>
21503 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21504 <p><b>Discussion:</b></p>
21505 <p>
21506 I believe I botched the resolution of
21507 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#241">
21508 241 "Does unique_copy() require CopyConstructible and Assignable?"</a> which now
21509 has WP status.
21510 </p>
21511
21512 <p>
21513 This talks about <tt>unique_copy</tt> requirements and currently reads:
21514 </p>
21515
21516 <blockquote><p>
21517 -5- <i>Requires:</i> The ranges <tt>[<i>first</i>, <i>last</i>)</tt> and
21518 <tt>[<i>result</i>, <i>result</i>+(<i>last</i>-<i>first</i>))</tt>
21519 shall not overlap. The expression <tt>*<i>result</i> = *<i>first</i></tt> shall
21520 be valid. If neither <tt>InputIterator</tt> nor <tt>OutputIterator</tt> meets the
21521 requirements of forward iterator then the value type of <tt>InputIterator</tt>
21522 must be CopyConstructible (20.1.3). Otherwise CopyConstructible is not required.
21523 </p></blockquote>
21524
21525 <p>
21526 The problem (which Paolo discovered) is that when the iterators are at their
21527 most restrictive (<tt>InputIterator</tt>, <tt>OutputIterator</tt>), then we want
21528 <tt>InputIterator::value_type</tt> to be both <tt>CopyConstructible</tt> and
21529 <tt>CopyAssignable</tt> (for the most efficient implementation).  However this
21530 proposed resolution only makes it clear that it is <tt>CopyConstructible</tt>,
21531 and that one can assign from <tt>*<i>first</i></tt> to <tt>*<i>result</i></tt>.
21532 This latter requirement does not necessarily imply that you can:
21533 </p>
21534
21535 <blockquote><pre>*<i>first</i> = *<i>first</i>;
21536 </pre></blockquote>
21537
21538
21539 <p><b>Proposed resolution:</b></p>
21540 <blockquote><p>
21541 -5- <i>Requires:</i> The ranges <tt>[<i>first</i>, <i>last</i>)</tt> and
21542 <tt>[<i>result</i>, <i>result</i>+(<i>last</i>-<i>first</i>))</tt>
21543 shall not overlap. The expression <tt>*<i>result</i> = *<i>first</i></tt>
21544 shall
21545 be valid. If neither <tt>InputIterator</tt> nor <tt>OutputIterator</tt> meets the
21546 requirements of forward iterator then the <del>value type</del> 
21547 <ins><tt>value_type</tt></ins> of <tt>InputIterator</tt>
21548 must be CopyConstructible (20.1.3) <ins>and Assignable</ins>.
21549 Otherwise CopyConstructible is not required.
21550 </p></blockquote>
21551
21552
21553
21554
21555
21556 <hr>
21557 <h3><a name="540"></a>540. shared_ptr&lt;void&gt;::operator*()</h3>
21558 <p><b>Section:</b> 20.7.12.2.5 [util.smartptr.shared.obs], TR1 2.2.3.5 [tr.util.smartptr.shared.obs] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21559  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2005-10-15</p>
21560 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.shared.obs">issues</a> in [util.smartptr.shared.obs].</p>
21561 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21562 <p><b>Discussion:</b></p>
21563 <p>
21564 I'm trying to reconcile the note in tr.util.smartptr.shared.obs, p6
21565 that talks about the operator*() member function of shared_ptr:
21566 </p>
21567
21568 <blockquote><p>
21569   Notes: When T is void, attempting to instantiate this member function
21570   renders the program ill-formed. [Note: Instantiating shared_ptr&lt;void&gt;
21571   does not necessarily result in instantiating this member function.
21572   --end note]
21573 </p></blockquote>
21574
21575 <p>
21576 with the requirement in temp.inst, p1:
21577 </p>
21578
21579 <blockquote><p>
21580   The implicit instantiation of a class template specialization causes
21581   the implicit instantiation of the declarations, but not of the
21582   definitions...
21583 </p></blockquote>
21584
21585 <p>
21586 I assume that what the note is really trying to say is that
21587 "instantiating shared_ptr&lt;void&gt; *must not* result in instantiating
21588 this member function." That is, that this function must not be
21589 declared a member of shared_ptr&lt;void&gt;. Is my interpretation
21590 correct?
21591 </p>
21592
21593
21594 <p><b>Proposed resolution:</b></p>
21595 <p>
21596 Change 2.2.3.5p6
21597 </p>
21598
21599 <blockquote><p>
21600 -6- <del><i>Notes:</i></del> When <tt>T</tt> is <tt>void</tt>, <del>attempting to instantiate
21601 this member function renders the program ill-formed. [<i>Note:</i>
21602 Instantiating <tt>shared_ptr&lt;void&gt;</tt> does not necessarily result in
21603 instantiating this member function. <i>--end note</i>]</del> <ins>it is
21604 unspecified whether this member function is declared or not, and if so, what its
21605 return type is, except that the declaration (although not necessarily the
21606 definition) of the function shall be well-formed.</ins>
21607 </p></blockquote>
21608
21609
21610
21611
21612
21613
21614 <hr>
21615 <h3><a name="541"></a>541. shared_ptr template assignment and void</h3>
21616 <p><b>Section:</b> 20.7.12.2 [util.smartptr.shared], TR1 2.2.3 [tr.util.smartptr.shared] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21617  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2005-10-16</p>
21618 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#util.smartptr.shared">active issues</a> in [util.smartptr.shared].</p>
21619 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.shared">issues</a> in [util.smartptr.shared].</p>
21620 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21621 <p><b>Discussion:</b></p>
21622 <p>
21623 Is the void specialization of the template assignment operator taking
21624 a shared_ptr&lt;void&gt; as an argument supposed be well-formed?
21625 </p>
21626 <p>
21627 I.e., is this snippet well-formed:
21628 </p>
21629 <blockquote><pre>shared_ptr&lt;void&gt; p;
21630 p.operator=&lt;void&gt;(p);
21631 </pre></blockquote>
21632
21633 <p>
21634 Gcc complains about auto_ptr&lt;void&gt;::operator*() returning a reference
21635 to void. I suspect it's because shared_ptr has two template assignment
21636 operators, one of which takes auto_ptr, and the auto_ptr template gets
21637 implicitly instantiated in the process of overload resolution.
21638 </p>
21639
21640 <p>
21641 The only way I see around it is to do the same trick with auto_ptr&lt;void&gt;
21642 operator*() as with the same operator in shared_ptr&lt;void&gt;.
21643 </p>
21644
21645 <p>
21646 PS Strangely enough, the EDG front end doesn't mind the code, even
21647 though in a small test case (below) I can reproduce the error with
21648 it as well.
21649 </p>
21650
21651 <blockquote><pre>template &lt;class T&gt;
21652 struct A { T&amp; operator*() { return *(T*)0; } };
21653
21654 template &lt;class T&gt;
21655 struct B {
21656     void operator= (const B&amp;) { }
21657     template &lt;class U&gt;
21658     void operator= (const B&lt;U&gt;&amp;) { }
21659     template &lt;class U&gt;
21660     void operator= (const A&lt;U&gt;&amp;) { }
21661 };
21662
21663 int main ()
21664 {
21665     B&lt;void&gt; b;
21666     b.operator=&lt;void&gt;(b);
21667 }
21668 </pre></blockquote>
21669
21670
21671 <p><b>Proposed resolution:</b></p>
21672 <p>
21673 In [lib.memory] change:
21674 </p>
21675 <blockquote><pre>template&lt;class X&gt; class auto_ptr;
21676 <ins>template&lt;&gt; class auto_ptr&lt;void&gt;;</ins>
21677 </pre></blockquote>
21678
21679 <p>
21680 In [lib.auto.ptr]/2 add the following before the last closing brace:
21681 </p>
21682
21683 <blockquote><pre>template&lt;&gt; class auto_ptr&lt;void&gt;
21684 {
21685 public:
21686     typedef void element_type;
21687 };
21688 </pre></blockquote>
21689
21690
21691
21692
21693
21694
21695 <hr>
21696 <h3><a name="542"></a>542. shared_ptr observers</h3>
21697 <p><b>Section:</b> 20.7.12.2.5 [util.smartptr.shared.obs], TR1 2.2.3.5 [tr.util.smartptr.shared.obs] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21698  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2005-10-18</p>
21699 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.shared.obs">issues</a> in [util.smartptr.shared.obs].</p>
21700 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21701 <p><b>Discussion:</b></p>
21702 <p>
21703 Peter Dimov wrote:
21704 To: C++ libraries mailing list
21705 Message c++std-lib-15614
21706 [...]
21707 The intent is for both use_count() and unique() to work in a threaded environment.
21708 They are intrinsically prone to race conditions, but they never return garbage.
21709 </p>
21710
21711 <p>
21712 This is a crucial piece of information that I really wish were
21713 captured in the text. Having this in a non-normative note would
21714 have made everything crystal clear to me and probably stopped
21715 me from ever starting this discussion :) Instead, the sentence
21716 in p12 "use only for debugging and testing purposes, not for
21717 production code" very strongly suggests that implementations
21718 can and even are encouraged to return garbage (when threads
21719 are involved) for performance reasons.
21720 </p>
21721 <p>
21722 How about adding an informative note along these lines:
21723 </p>
21724 <blockquote><p>
21725   Note: Implementations are encouraged to provide well-defined
21726   behavior for use_count() and unique() even in the presence of
21727   multiple threads.
21728 </p></blockquote>
21729 <p>
21730 I don't necessarily insist on the exact wording, just that we
21731 capture the intent.
21732 </p>
21733
21734
21735 <p><b>Proposed resolution:</b></p>
21736 <p>
21737 Change 20.7.12.2.5 [util.smartptr.shared.obs] p12:
21738 </p>
21739 <blockquote><p>
21740 [<i>Note:</i> <tt>use_count()</tt> is not necessarily efficient. <del>Use only for
21741 debugging and testing purposes, not for production code.</del> --<i>end note</i>]
21742 </p></blockquote>
21743
21744 <p>
21745 Change 20.7.12.3.5 [util.smartptr.weak.obs] p3:
21746 </p>
21747 <blockquote><p>
21748 [<i>Note:</i> <tt>use_count()</tt> is not necessarily efficient. <del>Use only for
21749 debugging and testing purposes, not for production code.</del> --<i>end note</i>]
21750 </p></blockquote>
21751
21752
21753
21754
21755
21756 <hr>
21757 <h3><a name="543"></a>543. valarray slice default constructor</h3>
21758 <p><b>Section:</b> 26.5.4 [class.slice] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21759  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2005-11-03</p>
21760 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21761 <p><b>Discussion:</b></p>
21762 <p>
21763 If one explicitly constructs a slice or glice with the default
21764 constructor, does the standard require this slice to have any usable
21765 state?  It says "creates a slice which specifies no elements", which
21766 could be interpreted two ways:
21767 </p>
21768 <ol>
21769 <li>There are no elements to which the slice refers (i.e. undefined).</li>
21770 <li>The slice specifies an array with no elements in it (i.e. defined).</li>
21771 </ol>
21772 <p>
21773 Here is a bit of code to illustrate:
21774 </p>
21775 <blockquote><pre>#include &lt;iostream&gt;
21776 #include &lt;valarray&gt;
21777
21778 int main()
21779 {
21780     std::valarray&lt;int&gt; v(10);
21781     std::valarray&lt;int&gt; v2 = v[std::slice()];
21782     std::cout &lt;&lt; "v[slice()].size() = " &lt;&lt; v2.size() &lt;&lt; '\n';
21783 }
21784 </pre></blockquote>
21785
21786 <p>
21787 Is the behavior undefined?  Or should the output be:
21788 </p>
21789
21790 <blockquote><pre>v[slice()].size() = 0
21791 </pre></blockquote>
21792
21793 <p>
21794 There is a similar question and wording for gslice at 26.3.6.1p1.
21795 </p>
21796
21797
21798 <p><b>Proposed resolution:</b></p>
21799
21800 <p><i>[Martin suggests removing the second sentence in 26.5.4.1 [cons.slice] as well.]</i></p>
21801
21802
21803 <p>
21804 Change 26.5.4.1 [cons.slice]:
21805 </p>
21806
21807 <blockquote><p>
21808 1 - <del>The default constructor for <tt>slice</tt> creates a <tt>slice</tt>
21809 which specifies no elements.</del> <ins>The default constructor is equivalent to
21810 <tt>slice(0, 0, 0)</tt>.</ins> A default constructor is provided only to permit
21811 the declaration of arrays of slices. The constructor with arguments for a slice
21812 takes a start, length, and stride parameter.
21813 </p></blockquote>
21814
21815 <p>
21816 Change 26.5.6.1 [gslice.cons]:
21817 </p>
21818
21819 <blockquote><p>
21820 1 - <del>The default constructor creates a <tt>gslice</tt> which specifies no
21821 elements.</del> <ins>The default constructor is equivalent to <tt>gslice(0,
21822 valarray&lt;size_t&gt;(), valarray&lt;size_t&gt;())</tt>.</ins> The constructor
21823 with arguments builds a <tt>gslice</tt> based on a specification of start,
21824 lengths, and strides, as explained in the previous section.
21825 </p></blockquote>
21826
21827
21828
21829
21830
21831
21832 <hr>
21833 <h3><a name="545"></a>545. When is a deleter deleted?</h3>
21834 <p><b>Section:</b> 20.7.12.2.11 [util.smartptr.getdeleter], TR1 2.2.3.2 [tr.util.smartptr.shared.dest] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21835  <b>Submitter:</b> Matt Austern <b>Date:</b> 2006-01-10</p>
21836 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.getdeleter">issues</a> in [util.smartptr.getdeleter].</p>
21837 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21838 <p><b>Discussion:</b></p>
21839 <p>
21840 The description of ~shared_ptr doesn't say when the shared_ptr's deleter, if
21841 any, is destroyed. In principle there are two possibilities: it is destroyed
21842 unconditionally whenever ~shared_ptr is executed (which, from an implementation
21843 standpoint, means that the deleter is copied whenever the shared_ptr is copied),
21844 or it is destroyed immediately after the owned pointer is destroyed (which, from
21845 an implementation standpoint, means that the deleter object is shared between
21846 instances). We should say which it is.
21847 </p>
21848
21849
21850 <p><b>Proposed resolution:</b></p>
21851 <p>
21852 Add after the first sentence of 20.7.12.2.11 [util.smartptr.getdeleter]/1:
21853 </p>
21854 <blockquote>
21855 <p>
21856 The returned pointer remains valid as long as there exists a <tt>shared_ptr</tt> instance
21857 that owns <tt><i>d</i></tt>.
21858 </p>
21859 <p>
21860 [<i>Note:</i> it is unspecified whether the pointer remains valid longer than that.
21861 This can happen if the implementation doesn't destroy the deleter until all
21862 <tt>weak_ptr</tt> instances in the ownership group are destroyed. <i>-- end note</i>]
21863 </p>
21864 </blockquote>
21865
21866
21867
21868
21869
21870 <hr>
21871 <h3><a name="550"></a>550. What should the return type of pow(float,int) be?</h3>
21872 <p><b>Section:</b> 26.7 [c.math] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
21873  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2006-01-12</p>
21874 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#c.math">issues</a> in [c.math].</p>
21875 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
21876 <p><b>Discussion:</b></p>
21877 <p>
21878 Assuming we adopt the
21879 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">C
21880 compatibility package from C99</a>  what should be the return type of the
21881 following signature be:
21882 </p>
21883 <blockquote><pre>?  pow(float, int);
21884 </pre></blockquote>
21885 <p>
21886 C++03 says that the return type should be <tt>float</tt>. 
21887 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">
21888 TR1</a> and C90/99 say the return type should be <tt>double</tt>.  This can put
21889 clients into a situation where C++03 provides answers that are not as high
21890 quality as C90/C99/TR1.  For example:
21891 </p>
21892 <blockquote><pre>#include &lt;math.h&gt;
21893
21894 int main()
21895 {
21896     float x = 2080703.375F;
21897     double y = pow(x, 2);
21898 }
21899 </pre></blockquote>
21900 <p>
21901 Assuming an IEEE 32 bit float and IEEE 64 bit double, C90/C99/TR1 all suggest:
21902 </p>
21903
21904 <blockquote><pre>y = 4329326534736.390625
21905 </pre></blockquote>
21906
21907 <p>
21908 which is exactly right.  While C++98/C++03 demands:
21909 </p>
21910
21911 <blockquote><pre>y = 4329326510080.
21912 </pre></blockquote>
21913
21914 <p>
21915 which is only approximately right.
21916 </p>
21917
21918 <p>
21919 I recommend that C++0X adopt the mixed mode arithmetic already adopted by
21920 Fortran, C and TR1 and make the return type of <tt>pow(float,int)</tt> be
21921 <tt>double</tt>.
21922 </p>
21923
21924 <p><i>[
21925 Kona (2007): Other functions that are affected by this issue include
21926 <tt>ldexp</tt>, <tt>scalbln</tt>, and <tt>scalbn</tt>. We also believe that there is a typo in
21927 26.7/10: <tt>float nexttoward(float, long double);</tt> [sic] should be <tt>float
21928 nexttoward(float, float);</tt> Proposed Disposition: Review (the proposed
21929 resolution appears above, rather than below, the heading "Proposed
21930 resolution")
21931 ]</i></p>
21932
21933
21934 <p><i>[
21935 <p>
21936 Howard, post Kona:
21937 </p>
21938 <blockquote>
21939 <p>
21940 Unfortunately I strongly disagree with a part of the resolution
21941 from Kona.  I am moving from New to Open instead of to Review because I do not believe
21942 we have consensus on the intent of the resolution.
21943 </p>
21944 <p>
21945 This issue does not include <tt>ldexp</tt>, <tt>scalbln</tt>, and <tt>scalbn</tt> because
21946 the second integral parameter in each of these signatures (from C99) is <b>not</b> a
21947 <i>generic parameter</i> according to C99 7.22p2.  The corresponding C++ overloads are
21948 intended (as far as I know) to correspond directly to C99's definition of <i>generic parameter</i>.
21949 </p>
21950 <p>
21951 For similar reasons, I do not believe that the second <tt>long double</tt> parameter of
21952 <tt>nexttoward</tt>, nor the return type of this function, is in error.  I believe the
21953 correct signature is:
21954 </p>
21955 <blockquote>
21956 <pre>float nexttoward(float, long double);
21957 </pre>
21958 </blockquote>
21959 <p>
21960 which is what both the C++0X working paper and C99 state (as far as I currently understand).
21961 </p>
21962 <p>
21963 This is really <b>only</b> about <tt>pow(float, int)</tt>.  And this is because C++98 took one
21964 route (with <tt>pow</tt> only) and C99 took another (with many math functions in <tt>&lt;tgmath.h&gt;</tt>.
21965 The proposed resolution basically says: C++98 got it wrong and C99 got it right; let's go with C99.
21966 </p>
21967 </blockquote>
21968 ]</i></p>
21969
21970
21971 <p><i>[
21972 Bellevue:
21973 ]</i></p>
21974
21975
21976 <blockquote>
21977 This signature was not picked up from C99. Instead, if one types
21978 pow(2.0f,2), the promotion rules will invoke "double pow(double,
21979 double)", which generally gives special treatment for integral
21980 exponents, preserving full accuracy of the result.  New proposed
21981 wording provided.
21982 </blockquote>
21983
21984
21985 <p><b>Proposed resolution:</b></p>
21986 <p>
21987 Change 26.7 [c.math] p10:
21988 </p>
21989
21990 <blockquote>
21991 <p>
21992 The added signatures are:
21993 </p>
21994 <blockquote><pre>...
21995 <del>float pow(float, int);</del>
21996 ...
21997 <del>double pow(double, int);</del>
21998 ...
21999 <del>long double pow(long double, int);</del>
22000 </pre></blockquote>
22001 </blockquote>
22002
22003
22004
22005
22006
22007
22008 <hr>
22009 <h3><a name="551"></a>551. &lt;ccomplex&gt;</h3>
22010 <p><b>Section:</b> 26.3.11 [cmplxh], TR1 8.3 [tr.c99.cmplxh] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22011  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2006-01-23</p>
22012 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22013 <p><b>Discussion:</b></p>
22014 <p>
22015 Previously xxx.h was parsable by C++.  But in the case of C99's &lt;complex.h&gt;
22016 it isn't.  Otherwise we could model it just like &lt;string.h&gt;, &lt;cstring&gt;, &lt;string&gt;:
22017 </p>
22018
22019 <ul>
22020 <li>&lt;string&gt;   : C++ API in namespace std</li>
22021 <li>&lt;cstring&gt;  : C API in namespace std</li>
22022 <li>&lt;string.h&gt; : C API in global namespace</li>
22023 </ul>
22024
22025 <p>
22026 In the case of C's complex, the C API won't compile in C++.  So we have:
22027 </p>
22028
22029 <ul>
22030 <li>&lt;complex&gt;   : C++ API in namespace std</li>
22031 <li>&lt;ccomplex&gt;  : ?</li>
22032 <li>&lt;complex.h&gt; : ?</li>
22033 </ul>
22034
22035 <p>
22036 The ? can't refer to the C API.  TR1 currently says:
22037 </p>
22038
22039 <ul>
22040 <li>&lt;complex&gt;   : C++ API in namespace std</li>
22041 <li>&lt;ccomplex&gt;  : C++ API in namespace std</li>
22042 <li>&lt;complex.h&gt; : C++ API in global namespace</li>
22043 </ul>
22044
22045
22046
22047 <p><b>Proposed resolution:</b></p>
22048 <p>
22049 Change 26.3.11 [cmplxh]:
22050 </p>
22051
22052 <blockquote>
22053 <p>
22054 The header behaves as if it includes the header
22055 <tt>&lt;ccomplex&gt;</tt><ins>.</ins><del>, and provides sufficient using
22056 declarations to declare in the global namespace all function and type names
22057 declared or defined in the neader <tt>&lt;complex&gt;</tt>.</del>
22058 <ins>[<i>Note:</i> <tt>&lt;complex.h&gt;</tt> does not promote any interface
22059 into the global namespace as there is no C interface to promote. <i>--end
22060 note</i>]</ins>
22061 </p>
22062 </blockquote>
22063
22064
22065
22066
22067
22068
22069 <hr>
22070 <h3><a name="552"></a>552. random_shuffle and its generator</h3>
22071 <p><b>Section:</b> 25.2.12 [alg.random.shuffle] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22072  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-01-25</p>
22073 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22074 <p><b>Discussion:</b></p>
22075 <p>
22076 ...is specified to shuffle its range by calling swap but not how
22077 (or even that) it's supposed to use the RandomNumberGenerator
22078 argument passed to it.
22079 </p>
22080 <p>
22081 Shouldn't we require that the generator object actually be used
22082 by the algorithm to obtain a series of random numbers and specify
22083 how many times its operator() should be invoked by the algorithm?
22084 </p>
22085
22086 <p>
22087 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
22088 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
22089 for some further discussion.
22090 </p>
22091
22092
22093
22094 <p><b>Proposed resolution:</b></p>
22095 <p>
22096 Adopt the proposed resolution in
22097 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
22098 </p>
22099
22100
22101 <p><i>[
22102 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
22103 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
22104 ]</i></p>
22105
22106
22107
22108
22109
22110 <hr>
22111 <h3><a name="559"></a>559. numeric_limits&lt;const T&gt;</h3>
22112 <p><b>Section:</b> 18.2.1 [limits] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22113  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-02-19</p>
22114 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#limits">issues</a> in [limits].</p>
22115 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22116 <p><b>Discussion:</b></p>
22117         <p>
22118
22119 18.2.1 [limits], p2 requires implementations  to provide specializations of the
22120 <code>numeric_limits</code> template for  each scalar type. While this
22121 could be interepreted to include cv-qualified forms of such types such
22122 an  interepretation   is  not  reflected   in  the  synopsis   of  the
22123 <code>&lt;limits&gt;</code> header.
22124
22125         </p>
22126         <p>
22127
22128 The absence  of specializations of the template  on cv-qualified forms
22129 of  fundamental types  makes <code>numeric_limits</code>  difficult to
22130 use in generic  code where the constness (or volatility)  of a type is
22131 not  always  immediately  apparent.  In  such  contexts,  the  primary
22132 template  ends   up  being   instantiated  instead  of   the  provided
22133 specialization, typically yielding unexpected behavior.
22134
22135         </p>
22136         <p>
22137
22138 Require   that  specializations   of   <code>numeric_limits</code>  on
22139 cv-qualified fundamental types have the same semantics as those on the
22140 unqualifed forms of the same types.
22141
22142         </p>
22143
22144
22145 <p><b>Proposed resolution:</b></p>
22146         <p>
22147
22148 Add  to  the   synopsis  of  the  <code>&lt;limits&gt;</code>  header,
22149 immediately  below  the  declaration  of  the  primary  template,  the
22150 following:
22151 </p>
22152
22153 <pre>
22154 template &lt;class T&gt; class numeric_limits&lt;const T&gt;;
22155 template &lt;class T&gt; class numeric_limits&lt;volatile T&gt;;
22156 template &lt;class T&gt; class numeric_limits&lt;const volatile T&gt;;
22157
22158 </pre>
22159
22160         <p>
22161
22162 Add  a new paragraph  to the  end of  18.2.1.1 [numeric.limits], with  the following
22163 text:
22164
22165         </p>
22166         <p>
22167
22168 -new-para- The  value of each member  of a <code>numeric_limits</code>
22169 specialization on a  cv-qualified T is equal to the  value of the same
22170 member of <code>numeric_limits&lt;T&gt;</code>.
22171
22172         </p>
22173
22174 <p><i>[
22175 Portland: Martin will clarify that user-defined types get cv-specializations
22176 automatically.
22177 ]</i></p>
22178
22179
22180
22181
22182
22183
22184
22185 <hr>
22186 <h3><a name="561"></a>561. inserter overly generic</h3>
22187 <p><b>Section:</b> 24.4.2.6.5 [inserter] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22188  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2006-02-21</p>
22189 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22190 <p><b>Discussion:</b></p>
22191 <p>
22192 The declaration of <tt>std::inserter</tt> is:
22193 </p>
22194
22195 <blockquote><pre>template &lt;class Container, class Iterator&gt;
22196 insert_iterator&lt;Container&gt;
22197 inserter(Container&amp; x, Iterator i);
22198 </pre></blockquote>
22199
22200 <p>
22201 The template parameter <tt>Iterator</tt> in this function is completely unrelated
22202 to the template parameter <tt>Container</tt> when it doesn't need to be.  This
22203 causes the code to be overly generic.  That is, any type at all can be deduced
22204 as <tt>Iterator</tt>, whether or not it makes sense.  Now the same is true of
22205 <tt>Container</tt>.  However, for every free (unconstrained) template parameter
22206 one has in a signature, the opportunity for a mistaken binding grows geometrically.
22207 </p>
22208
22209 <p>
22210 It would be much better if <tt>inserter</tt> had the following signature instead:
22211 </p>
22212
22213 <blockquote><pre>template &lt;class Container&gt;
22214 insert_iterator&lt;Container&gt;
22215 inserter(Container&amp; x, typename Container::iterator i);
22216 </pre></blockquote>
22217
22218 <p>
22219 Now there is only one free template parameter.  And the second argument to
22220 <tt>inserter</tt> must be implicitly convertible to the container's iterator,
22221 else the call will not be a viable overload (allowing other functions in the
22222 overload set to take precedence).  Furthermore, the first parameter must have a
22223 nested type named <tt>iterator</tt>, or again the binding to <tt>std::inserter</tt>
22224 is not viable.  Contrast this with the current situation
22225 where any type can bind to <tt>Container</tt> or <tt>Iterator</tt> and those
22226 types need not be anything closely related to containers or iterators.
22227 </p>
22228
22229 <p>
22230 This can adversely impact well written code.  Consider:
22231 </p>
22232
22233 <blockquote><pre>#include &lt;iterator&gt;
22234 #include &lt;string&gt;
22235
22236 namespace my
22237 {
22238
22239 template &lt;class String&gt;
22240 struct my_type {};
22241
22242 struct my_container
22243 {
22244 template &lt;class String&gt;
22245 void push_back(const my_type&lt;String&gt;&amp;);
22246 };
22247
22248 template &lt;class String&gt;
22249 void inserter(const my_type&lt;String&gt;&amp; m, my_container&amp; c) {c.push_back(m);}
22250
22251 }  // my
22252
22253 int main()
22254 {
22255     my::my_container c;
22256     my::my_type&lt;std::string&gt; m;
22257     inserter(m, c);
22258 }
22259 </pre></blockquote>
22260
22261 <p>
22262 Today this code fails because the call to <tt>inserter</tt> binds to
22263 <tt>std::inserter</tt> instead of to <tt>my::inserter</tt>.  However with the
22264 proposed change <tt>std::inserter</tt> will no longer be a viable function which
22265 leaves only <tt>my::inserter</tt> in the overload resolution set.  Everything
22266 works as the client intends.
22267 </p>
22268
22269 <p>
22270 To make matters a little more insidious, the above example works today if you
22271 simply change the first argument to an rvalue:
22272 </p>
22273
22274 <blockquote><pre>    inserter(my::my_type(), c);
22275 </pre></blockquote>
22276
22277 <p>
22278 It will also work if instantiated with some string type other than
22279 <tt>std::string</tt> (or any other <tt>std</tt> type).  It will also work if
22280 <tt>&lt;iterator&gt;</tt> happens to not get included.
22281 </p>
22282
22283 <p>
22284 And it will fail again for such inocuous reaons as <tt>my_type</tt> or
22285 <tt>my_container</tt> privately deriving from any <tt>std</tt> type.
22286 </p>
22287
22288 <p>
22289 It seems unfortunate that such simple changes in the client's code can result
22290 in such radically differing behavior.
22291 </p>
22292
22293
22294
22295 <p><b>Proposed resolution:</b></p>
22296 <p>
22297 Change 24.2:
22298 </p>
22299
22300 <blockquote><p>
22301 <b>24.2 Header</b> <tt>&lt;iterator&gt;</tt> <b>synopsis</b>
22302 </p>
22303 <blockquote><pre>...
22304 template &lt;class Container<del>, class Iterator</del>&gt;
22305    insert_iterator&lt;Container&gt; inserter(Container&amp; x, <del>Iterator</del> <ins>typename Container::iterator</ins> i);
22306 ...
22307 </pre></blockquote>
22308 </blockquote>
22309
22310 <p>
22311 Change 24.4.2.5:
22312 </p>
22313
22314 <blockquote><p>
22315 <b>24.4.2.5 Class template</b> <tt>insert_iterator</tt></p>
22316 <blockquote><pre>...
22317 template &lt;class Container<del>, class Iterator</del>&gt;
22318    insert_iterator&lt;Container&gt; inserter(Container&amp; x, <del>Iterator</del> <ins>typename Container::iterator</ins> i);
22319 ...
22320 </pre></blockquote>
22321 </blockquote>
22322
22323 <p>
22324 Change 24.4.2.6.5:
22325 </p>
22326
22327 <blockquote>
22328 <p>
22329 <b>24.4.2.6.5</b> <tt>inserter</tt>
22330 </p>
22331 <pre>template &lt;class Container<del>, class Inserter</del>&gt;
22332    insert_iterator&lt;Container&gt; inserter(Container&amp; x, <del>Inserter</del> <ins>typename Container::iterator</ins> i);
22333 </pre>
22334 <blockquote><p>
22335 -1- <i>Returns:</i> <tt>insert_iterator&lt;Container&gt;(x,<del>typename Container::iterator(</del>i<del>)</del>)</tt>.
22336 </p></blockquote>
22337 </blockquote>
22338
22339
22340
22341 <p><i>[
22342 Kona (2007): This issue will probably be addressed as a part of the
22343 concepts overhaul of the library anyway, but the proposed resolution is
22344 correct in the absence of concepts. Proposed Disposition: Ready
22345 ]</i></p>
22346
22347
22348
22349
22350
22351 <hr>
22352 <h3><a name="562"></a>562. stringbuf ctor inefficient</h3>
22353 <p><b>Section:</b> 27.7 [string.streams] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22354  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-02-23</p>
22355 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.streams">issues</a> in [string.streams].</p>
22356 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22357 <p><b>Discussion:</b></p>
22358         <p>
22359
22360 For  better efficiency,  the requirement  on the  stringbuf  ctor that
22361 takes  a  string  argument  should  be  loosened  up  to  let  it  set
22362 <code>epptr()</code>  beyond  just   one  past  the  last  initialized
22363 character  just like  <code>overflow()</code> has  been changed  to be
22364 allowed  to  do   (see  issue  432).  That  way   the  first  call  to
22365 <code>sputc()</code> on  an object won't  necessarily cause a  call to
22366 <code>overflow</code>. The corresponding change  should be made to the
22367 string overload of the <code>str()</code> member function.
22368
22369         </p>
22370
22371
22372 <p><b>Proposed resolution:</b></p>
22373         <p>
22374
22375 Change 27.7.1.1, p3 of the Working Draft, N1804, as follows:
22376
22377         </p>
22378
22379 <blockquote><pre>explicit basic_stringbuf(const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>s<del>tr</del></i>,
22380                ios_base::openmode <i>which</i> = ios_base::in | ios_base::out);
22381 </pre>
22382
22383 <p>
22384 -3- <i>Effects:</i>  Constructs an object of class <tt>basic_stringbuf</tt>,
22385 initializing the base class with <tt>basic_streambuf()</tt>
22386 (27.5.2.1), and initializing <tt><i>mode</i></tt> with <tt><i>which</i></tt>.
22387 Then <ins>calls <tt>str(<i>s</i>)</tt>.</ins> <del>copies the content of
22388 <i>str</i> into the <tt>basic_stringbuf</tt> underlying character
22389 sequence. If <tt><i>which</i> &amp; ios_base::out</tt> is true, initializes the
22390 output sequence such that <tt>pbase()</tt> points to the first underlying
22391 character, <tt>epptr()</tt> points one past the last underlying character, and
22392 <tt>pptr()</tt> is equal to <tt>epptr()</tt> if <tt><i>which</i> &amp; ios_base::ate</tt>
22393 is true, otherwise <tt>pptr()</tt> is equal to <tt>pbase()</tt>. If
22394 <tt>which &amp; ios_base::in</tt> is true, initializes the input sequence such
22395 that <tt>eback()</tt> and <tt>gptr()</tt> point to the first underlying 
22396 character and <tt>egptr()</tt> points one past the last underlying character.</del>
22397 </p>
22398 </blockquote>
22399
22400         <p>
22401
22402 Change the Effects clause of the <code>str()</code> in 27.7.1.2, p2 to
22403 read:
22404
22405         </p>
22406 <blockquote>
22407 <p>
22408 -2- <i>Effects:</i> Copies the content<ins>s</ins> of <tt><i>s</i></tt> into the
22409 <tt>basic_stringbuf</tt> underlying character sequence <ins>and
22410 initializes the input and output sequences according to <tt><i>mode</i></tt></ins>.
22411 <del>If
22412 <tt><i>mode</i> &amp; ios_base::out</tt> is true, initializes the output
22413 sequence such that <tt>pbase()</tt> points to the first underlying character, 
22414 <tt>epptr()</tt> points one past the last underlying character, and <tt>pptr()</tt>
22415 is equal to <tt>epptr()</tt> if <tt><i>mode</i> &amp; ios_base::in</tt>
22416 is true, otherwise <tt>pptr()</tt> is equal to <tt>pbase()</tt>. If
22417 <tt>mode &amp; ios_base::in</tt> is true, initializes the input sequence 
22418 such that <tt>eback()</tt> and <tt>gptr()</tt> point to the first underlying
22419 character and <tt>egptr()</tt> points one past the last underlying character.</del>
22420 </p>
22421
22422         <p>
22423
22424 <ins>-3- <i>Postconditions:</i>  If  <code>mode  &amp; ios_base::out</code>  is  true,
22425 <code>pbase()</code>  points  to the  first  underlying character  and
22426 <code>(epptr() &gt;= pbase() + s.size())</code> holds; in addition, if
22427 <code>mode &amp; ios_base::in</code> is true, <code>(pptr() == pbase()
22428 + s.data())</code>  holds, otherwise <code>(pptr()  == pbase())</code>
22429 is   true.    If  <code>mode   &amp;   ios_base::in</code>  is   true,
22430 <code>eback()</code>  points to  the first  underlying  character, and
22431 <code>(gptr()  ==  eback())</code>  and  <code>(egptr() ==  eback()  +
22432 s.size())</code> hold.</ins>
22433
22434         </p>
22435 </blockquote>
22436
22437
22438 <p><i>[
22439 Kona (2007) Moved to Ready.
22440 ]</i></p>
22441
22442
22443
22444
22445
22446 <hr>
22447 <h3><a name="563"></a>563. stringbuf seeking from end</h3>
22448 <p><b>Section:</b> 27.7.1.4 [stringbuf.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22449  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-02-23</p>
22450 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#stringbuf.virtuals">issues</a> in [stringbuf.virtuals].</p>
22451 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22452 <p><b>Discussion:</b></p>
22453 <p>
22454 According to  Table 92  (unchanged by issue  432), when  <code>(way ==
22455 end)</code> the  <code>newoff</code> value in out mode  is computed as
22456 the difference between <code>epptr()</code> and <code>pbase()</code>.
22457 </p>
22458         <p>
22459
22460 This value  isn't meaningful unless the  value of <code>epptr()</code>
22461 can be  precisely controlled by a  program.  That used  to be possible
22462 until  we accepted the  resolution of  issue 432,  but since  then the
22463 requirements on <code>overflow()</code> have  been relaxed to allow it
22464 to  make  more than  1  write  position  available (i.e.,  by  setting
22465 <code>epptr()</code>     to     some     unspecified    value     past
22466 <code>pptr()</code>).      So    after     the    first     call    to
22467 <code>overflow()</code>  positioning the  output sequence  relative to
22468 end will have unspecified results.
22469
22470         </p>
22471         <p>
22472
22473 In  addition,  in <code>in|out</code>  mode,  since <code>(egptr()  ==
22474 epptr())</code> need not hold, there are two different possible values
22475 for   <code>newoff</code>:    <code>epptr()   -   pbase()</code>   and
22476 <code>egptr() - eback()</code>.
22477
22478         </p>
22479
22480
22481 <p><b>Proposed resolution:</b></p>
22482         <p>
22483
22484 Change the <code>newoff</code>  column in the last row  of Table 94 to
22485 read:
22486
22487         </p>
22488 <blockquote><p>
22489
22490 the <del>end</del> <ins>high mark</ins> pointer minus the beginning 
22491 pointer (<code><del>xend</del> <ins>high_mark</ins> - xbeg</code>).
22492
22493 </p></blockquote>
22494
22495
22496 <p><i>[
22497 Kona (2007) Moved to Ready.
22498 ]</i></p>
22499
22500
22501
22502
22503
22504 <hr>
22505 <h3><a name="566"></a>566. array forms of unformatted input function undefined for zero-element arrays</h3>
22506 <p><b>Section:</b> 27.6.1.3 [istream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22507  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-02-23</p>
22508 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.unformatted">issues</a> in [istream.unformatted].</p>
22509 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22510 <p><b>Discussion:</b></p>
22511         <p>
22512
22513 The array forms of unformatted input functions don't have well-defined
22514 semantics for zero-element  arrays in a couple of  cases. The affected
22515 ones (<tt>istream::get()</tt> and  <tt>getline()</tt>) are supposed to
22516 terminate when <tt>(n - 1)</tt> characters are stored, which obviously
22517 can never be true when <tt>(n == 0)</tt> to start with.
22518
22519         </p>
22520
22521
22522 <p><b>Proposed resolution:</b></p>
22523         <p>
22524
22525 I  propose  the following  changes  (references  are  relative to  the
22526 Working Draft (document N1804).
22527
22528         </p>
22529         <p>
22530
22531 Change 27.6.1.3, p8 (<tt>istream::get()</tt>), bullet 1 as follows:
22532
22533         </p>
22534         <blockquote>
22535             <p>
22536
22537 <ins>if  <tt>(n  &lt; 1)</tt>  is  true  or  </ins> <tt>(n  -  1)</tt>
22538 characters are stored;
22539
22540             </p>
22541         </blockquote>
22542         <p>
22543
22544 Similarly, change  27.6.1.3, p18 (<tt>istream::getline()</tt>), bullet
22545 3 as follows:
22546
22547         </p>
22548         <blockquote>
22549             <p>
22550
22551 <ins><tt>(n &lt; 1)</tt> is  true or </ins><tt>(n - 1)</tt> characters
22552 are     stored     (in    which     case     the    function     calls
22553 <tt>setstate(failbit)</tt>).
22554
22555             </p>
22556         </blockquote>
22557         <p>
22558
22559 Finally, change p21 as follows:
22560
22561         </p>
22562         <blockquote>
22563             <p>
22564
22565 In any  case, <ins>provided  <tt>(n &gt; 0)</tt>  is true,  </ins>it then
22566 stores  a null  character  (using charT())  into  the next  successive
22567 location of the array.
22568
22569             </p>
22570         </blockquote>
22571
22572
22573
22574
22575
22576 <hr>
22577 <h3><a name="567"></a>567. streambuf inserter and extractor should be unformatted</h3>
22578 <p><b>Section:</b> 27.6 [iostream.format] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22579  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-02-25</p>
22580 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostream.format">issues</a> in [iostream.format].</p>
22581 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22582 <p><b>Discussion:</b></p>
22583         <p>
22584
22585 Issue  60 explicitly made  the extractor  and inserter  operators that
22586 take a  <tt>basic_streambuf*</tt> argument formatted  input and output
22587 functions,  respectively.  I  believe that's  wrong, certainly  in the
22588 case of  the extractor, since formatted functions  begin by extracting
22589 and  discarding  whitespace.  The  extractor  should  not discard  any
22590 characters.
22591
22592         </p>
22593
22594
22595 <p><b>Proposed resolution:</b></p>
22596         <p>
22597
22598 I propose to  change each operator to behave  as unformatted input and
22599 output function,  respectively. The changes below are  relative to the
22600 working draft document number N1804.
22601
22602         </p>
22603         <p>
22604
22605 Specifically, change 27.6.1.2.3, p14 as follows:
22606
22607         </p>
22608
22609             <blockquote>
22610         <p>
22611
22612 <i>Effects</i>:  Behaves as  a<ins>n un</ins>formatted  input function
22613 (as   described   in   <del>27.6.1.2.1</del><ins>27.6.1.3,   paragraph
22614 1</ins>).
22615
22616         </p>
22617             </blockquote>
22618         <p>
22619
22620 And change 27.6.2.5.3, p7 as follows:
22621
22622         </p>
22623
22624             <blockquote>
22625         <p>
22626
22627 <i>Effects</i>: Behaves  as a<ins>n un</ins>formatted  output function
22628 (as   described   in   <del>27.6.2.5.1</del><ins>27.6.2.6,   paragraph
22629 1</ins>).
22630
22631         </p>
22632             </blockquote>
22633
22634
22635 <p><i>[
22636 Kona (2007): Proposed Disposition: Ready
22637 ]</i></p>
22638
22639
22640
22641
22642
22643 <hr>
22644 <h3><a name="574"></a>574. DR 369 Contradicts Text</h3>
22645 <p><b>Section:</b> 27.3 [iostream.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22646  <b>Submitter:</b> Pete Becker <b>Date:</b> 2006-04-18</p>
22647 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#iostream.objects">issues</a> in [iostream.objects].</p>
22648 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22649 <p><b>Discussion:</b></p>
22650 <p>
22651 lib.iostream.objects requires that the standard stream objects are never
22652 destroyed, and it requires that they be destroyed.
22653 </p>
22654 <p>
22655 DR 369 adds words to say that we really mean for ios_base::Init objects to force
22656 construction of standard stream objects. It ends, though, with the phrase "these
22657 stream objects shall be destroyed after the destruction of dynamically ...".
22658 However, the rule for destruction is stated in the standard: "The objects are
22659 not destroyed during program execution."
22660 </p>
22661
22662
22663 <p><b>Proposed resolution:</b></p>
22664 <p>
22665 Change 27.3 [iostream.objects]/1:
22666 </p>
22667
22668 <blockquote>
22669 <p>
22670 -2- The objects are constructed and the associations are established at
22671 some time prior to or during the first time an object of class
22672 <tt>ios_base::Init</tt> is constructed, and in any case before the body of main
22673 begins execution.<sup>290)</sup> The objects are not destroyed during program
22674 execution.<sup>291)</sup> If a translation unit includes <tt>&lt;iostream&amp;t;</tt> or explicitly
22675 constructs an <tt>ios_base::Init</tt> object, these stream objects shall be
22676 constructed before dynamic initialization of non-local objects defined
22677 later in that translation unit<del>, and these stream objects shall be
22678 destroyed after the destruction of dynamically initialized non-local
22679 objects defined later in that translation unit</del>.
22680 </p>
22681 </blockquote>
22682
22683
22684 <p><i>[
22685 Kona (2007): From 27.3 [iostream.objects]/2, strike the words "...and these stream objects
22686 shall be destroyed after the destruction of dynamically initialized
22687 non-local objects defined later in that translation unit." Proposed
22688 Disposition: Review
22689 ]</i></p>
22690
22691
22692
22693
22694
22695 <hr>
22696 <h3><a name="575"></a>575. the specification of ~shared_ptr is MT-unfriendly, makes implementation assumptions</h3>
22697 <p><b>Section:</b> 20.7.12.2.2 [util.smartptr.shared.dest], TR1 2.2.3.2 [tr.util.smartptr.shared.dest] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22698  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2006-04-23</p>
22699 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22700 <p><b>Discussion:</b></p>
22701 <p>
22702 [tr.util.smartptr.shared.dest] says in its second bullet:
22703 </p>
22704
22705 <p>
22706 "If *this shares ownership with another shared_ptr instance (use_count() &gt; 1),
22707 decrements that instance's use count."
22708 </p>
22709
22710 <p>
22711 The problem with this formulation is that it presupposes the existence of an
22712 "use count" variable that can be decremented and that is part of the state of a
22713 shared_ptr instance (because of the "that instance's use count".)
22714 </p>
22715
22716 <p>
22717 This is contrary to the spirit of the rest of the specification that carefully
22718 avoids to require an use count variable. Instead, use_count() is specified to
22719 return a value, a number of instances.
22720 </p>
22721
22722 <p>
22723 In multithreaded code, the usual implicit assumption is that a shared variable
22724 should not be accessed by more than one thread without explicit synchronization,
22725 and by introducing the concept of an "use count" variable, the current wording
22726 implies that two shared_ptr instances that share ownership cannot be destroyed
22727 simultaneously.
22728 </p>
22729
22730 <p>
22731 In addition, if we allow the interpretation that an use count variable is part
22732 of shared_ptr's state, this would lead to other undesirable consequences WRT
22733 multiple threads. For example,
22734 </p>
22735
22736 <blockquote><pre>p1 = p2;
22737 </pre></blockquote>
22738
22739 <p>
22740 would now visibly modify the state of p2, a "write" operation, requiring a lock.
22741 </p>
22742
22743
22744 <p><b>Proposed resolution:</b></p>
22745 <p>
22746 Change the first two bullets of [lib.util.smartptr.shared.dest]/1 to:
22747 </p>
22748
22749 <blockquote>
22750 <ul>
22751 <li>If <tt>*this</tt> is <i>empty</i> <ins>or shares ownership with another
22752 <tt>shared_ptr</tt> instance (<tt>use_count() &gt; 1</tt>)</ins>, there are no side effects.</li>
22753 <li><del>If <tt>*this</tt> <i>shares ownership</i> with another <tt>shared_ptr</tt> instance
22754 (<tt>use_count() &gt; 1</tt>), decrements that instance's use count.</del></li>
22755 </ul>
22756 </blockquote>
22757
22758 <p>
22759 Add the following paragraph after [lib.util.smartptr.shared.dest]/1:
22760 </p>
22761
22762 <blockquote><p>
22763 [<i>Note:</i> since the destruction of <tt>*this</tt> decreases the number of instances in
22764 <tt>*this</tt>'s ownership group by one, all <tt>shared_ptr</tt> instances that share ownership
22765 with <tt>*this</tt> will report an <tt>use_count()</tt> that is one lower than its previous value
22766 after <tt>*this</tt> is destroyed. <i>--end note</i>]
22767 </p></blockquote>
22768
22769
22770
22771
22772
22773 <hr>
22774 <h3><a name="576"></a>576. find_first_of is overconstrained</h3>
22775 <p><b>Section:</b> 25.1.7 [alg.find.first.of] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22776  <b>Submitter:</b> Doug Gregor <b>Date:</b> 2006-04-25</p>
22777 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.find.first.of">issues</a> in [alg.find.first.of].</p>
22778 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22779 <p><b>Discussion:</b></p>
22780 <p>
22781 In 25.1.4 Find First [lib.alg.find.first], the two iterator type parameters to
22782 find_first_of are specified to require Forward Iterators, as follows:
22783 </p>
22784
22785 <blockquote><pre>template&lt;class ForwardIterator1, class ForwardIterator2&gt;
22786   ForwardIterator1
22787   find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
22788                         ForwardIterator2 first2, ForwardIterator2 last2);
22789 template&lt;class ForwardIterator1, class ForwardIterator2,
22790                   class BinaryPredicate&gt;
22791 ForwardIterator1
22792   find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
22793                          ForwardIterator2 first2, ForwardIterator2 last2,
22794                         BinaryPredicate pred);
22795 </pre></blockquote>
22796
22797 <p>
22798 However, ForwardIterator1 need not actually be a Forward Iterator; an Input
22799 Iterator suffices, because we do not need the multi-pass property of the Forward
22800 Iterator or a true reference.
22801 </p>
22802
22803
22804 <p><b>Proposed resolution:</b></p>
22805 <p>
22806 Change the declarations of <tt>find_first_of</tt> to:
22807 </p>
22808
22809 <blockquote><pre>template&lt;class <del>ForwardIterator1</del><ins>InputIterator1</ins>, class ForwardIterator2&gt;
22810   <del>ForwardIterator1</del><ins>InputIterator1</ins>
22811   find_first_of(<del>ForwardIterator1</del><ins>InputIterator1</ins> first1, <del>ForwardIterator1</del><ins>InputIterator1</ins> last1,
22812                         ForwardIterator2 first2, ForwardIterator2 last2);
22813 template&lt;class <del>ForwardIterator1</del><ins>InputIterator1</ins>, class ForwardIterator2,
22814                   class BinaryPredicate&gt;
22815 <del>ForwardIterator1</del><ins>InputIterator1</ins>
22816   find_first_of(<del>ForwardIterator1</del><ins>InputIterator1</ins> first1, <del>ForwardIterator1</del><ins>InputIterator1</ins> last1,
22817                          ForwardIterator2 first2, ForwardIterator2 last2,
22818                         BinaryPredicate pred);
22819 </pre></blockquote>
22820
22821
22822
22823
22824
22825
22826 <hr>
22827 <h3><a name="577"></a>577. upper_bound(first, last, ...) cannot return last</h3>
22828 <p><b>Section:</b> 25.3.3.2 [upper.bound] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22829  <b>Submitter:</b> Seungbeom Kim <b>Date:</b> 2006-05-03</p>
22830 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22831 <p><b>Discussion:</b></p>
22832 <p>
22833 ISO/IEC 14882:2003 says:
22834 </p>
22835
22836 <blockquote>
22837 <p>
22838 25.3.3.2 upper_bound
22839 </p>
22840 <p>
22841 <i>Returns:</i> The furthermost iterator <tt>i</tt> in the range
22842 <tt>[<i>first</i>, <i>last</i>)</tt> such that
22843 for any iterator <tt>j</tt> in the range <tt>[<i>first</i>, i)</tt> the following corresponding
22844 conditions hold: <tt>!(value &lt; *j)</tt> or <tt><i>comp</i>(<i>value</i>, *j) == false</tt>.
22845 </p>
22846 </blockquote>
22847
22848 <p>
22849 From the description above, upper_bound cannot return last, since it's
22850 not in the interval [first, last). This seems to be a typo, because if
22851 value is greater than or equal to any other values in the range, or if
22852 the range is empty, returning last seems to be the intended behaviour.
22853 The corresponding interval for lower_bound is also [first, last].
22854 </p>
22855
22856
22857 <p><b>Proposed resolution:</b></p>
22858 <p>
22859 Change [lib.upper.bound]:
22860 </p>
22861
22862 <blockquote>
22863 <p>
22864 <i>Returns:</i> The furthermost iterator <tt>i</tt> in the range
22865 <tt>[<i>first</i>, <i>last</i><del>)</del><ins>]</ins></tt> such that
22866 for any iterator <tt>j</tt> in the range <tt>[<i>first</i>, i)</tt> the following corresponding
22867 conditions hold: <tt>!(value &lt; *j)</tt> or <tt><i>comp</i>(<i>value</i>, *j) == false</tt>.
22868 </p>
22869 </blockquote>
22870
22871
22872
22873
22874
22875
22876 <hr>
22877 <h3><a name="578"></a>578. purpose of hint to allocator::allocate()</h3>
22878 <p><b>Section:</b> 20.7.5.1 [allocator.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22879  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-05-17</p>
22880 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.members">issues</a> in [allocator.members].</p>
22881 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22882 <p><b>Discussion:</b></p>
22883         <p>
22884
22885 The     description    of     the     allocator    member     function
22886 <code>allocate()</code>  requires  that  the <i>hint</i>  argument  be
22887 either 0 or a  value previously returned from <code>allocate()</code>.
22888 Footnote 227 further suggests that  containers may pass the address of
22889 an adjacent element as this argument.
22890
22891         </p>
22892         <p>
22893
22894 I  believe  that  either  the  footnote  is  wrong  or  the  normative
22895 requirement that  the argument be  a value previously returned  from a
22896 call to  <code>allocate()</code> is wrong. The latter  is supported by
22897 the resolution  to issue 20-004 proposed in  c++std-lib-3736 by Nathan
22898 Myers. In addition,  the <i>hint</i> is an ordinary  void* and not the
22899 <code>pointer</code>  type returned  by  <code>allocate()</code>, with
22900 the  two  types potentially  being  incompatible  and the  requirement
22901 impossible to satisfy.
22902
22903         </p>
22904         <p>
22905
22906 See also c++std-lib-14323 for some  more context on where this came up
22907 (again).
22908
22909         </p>
22910     
22911
22912     <p><b>Proposed resolution:</b></p>
22913         <p>
22914
22915 Remove  the requirement  in  20.6.1.1, p4  that  the hint  be a  value
22916 previously returned from <code>allocate()</code>. Specifically, change
22917 the paragraph as follows:
22918
22919         </p>
22920 <p>
22921 <del><i>Requires</i>: <i>hint</i> either 0 or previously obtained  from  member
22922 <code>allocate</code>  and  not  yet passed  to member  <code>deallocate</code>.
22923 The value hint may be used by an implementation to help improve performance
22924 <sup>223)</sup>.</del> <ins>[<i>Note:</i> The value <i>hint</i> may be used by an
22925 implementation to help improve performance. -- <i>end note</i>]</ins>
22926 </p>
22927 <blockquote><p>
22928 <del>[Footnote: <sup>223)</sup>In a container member function, the address of an
22929 adjacent element is often a good choice to pass for this argument.</del>
22930 </p></blockquote>
22931     
22932
22933
22934
22935 <hr>
22936 <h3><a name="581"></a>581. <code>flush()</code> not unformatted function</h3>
22937 <p><b>Section:</b> 27.6.2.7 [ostream.unformatted] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
22938  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-06-14</p>
22939 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.unformatted">issues</a> in [ostream.unformatted].</p>
22940 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
22941 <p><b>Discussion:</b></p>
22942         <p>
22943
22944 The resolution of issue 60 changed <code>basic_ostream::flush()</code>
22945 so as not  to require it to behave as  an unformatted output function.
22946 That has at least two in my opinion problematic consequences:
22947
22948         </p>
22949         <p>
22950
22951 First, <code>flush()</code>  now calls <code>rdbuf()-&gt;pubsync()</code>
22952 unconditionally, without  regard to the  state of the stream.  I can't
22953 think of any reason why <code>flush()</code> should behave differently
22954 from the vast majority of stream functions in this respect.
22955
22956         </p>
22957         <p>
22958
22959 Second, <code>flush()</code> is not  required to catch exceptions from
22960 <code>pubsync()</code> or set  <code>badbit</code> in response to such
22961 events. That doesn't seem right either, as most other stream functions
22962 do so.
22963
22964         </p>
22965     
22966
22967     <p><b>Proposed resolution:</b></p>
22968         <p>
22969
22970 I  propose  to revert  the  resolution of  issue  60  with respect  to
22971 <code>flush()</code>. Specifically,  I propose to  change 27.6.2.6, p7
22972 as follows:
22973
22974         </p>
22975
22976 <p>
22977 Effects: <ins>Behaves as an  unformatted output function (as described
22978 in 27.6.2.6, paragraph 1). </ins>If <code>rdbuf()</code> is not a null
22979 pointer,  <ins>constructs a  sentry  object.  If  this object  returns
22980 <code>true</code> when converted to a  value of type bool the function
22981 </ins>calls <code>rdbuf()-&gt;pubsync()</code>.  If that function returns
22982 -1    calls    <code>setstate(badbit)</code>    (which    may    throw
22983 <code>ios_base::failure</code>  (27.4.4.3)).   <ins>Otherwise, if  the
22984 sentry object returns <code>false</code>, does nothing.</ins><del>Does
22985 not  behave  as  an  unformatted  output  function  (as  described  in
22986 27.6.2.6, paragraph 1).</del>
22987 </p>
22988
22989     
22990
22991 <p><i>[
22992 Kona (2007): Proposed Disposition: Ready
22993 ]</i></p>
22994
22995
22996
22997
22998
22999 <hr>
23000 <h3><a name="586"></a>586. string inserter not a formatted function</h3>
23001 <p><b>Section:</b> 21.3.8.9 [string.io] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
23002  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-06-22</p>
23003 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#string.io">issues</a> in [string.io].</p>
23004 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
23005 <p><b>Discussion:</b></p>
23006         <p>
23007
23008 Section  and paragraph  numbers  in  this paper  are  relative to  the
23009 working draft document number N2009 from 4/21/2006.
23010
23011         </p>
23012
23013         <p>
23014
23015 The  <code>basic_string</code> extractor  in 21.3.7.9,  p1  is clearly
23016 required  to  behave  as  a   formatted  input  function,  as  is  the
23017 <code>std::getline()</code> overload for string described in p7.
23018
23019         </p>
23020         <p>
23021
23022 However, the <code>basic_string</code> inserter described in p5 of the
23023 same section has no such requirement. This has implications on how the
23024 operator  responds  to  exceptions thrown  from  <code>xsputn()</code>
23025 (formatted  output functions are  required to  set <code>badbit</code>
23026 and swallow  the exception unless  <code>badbit</code> is also  set in
23027 <code>exceptions()</code>; the  string inserter doesn't  have any such
23028 requirement).
23029
23030         </p>
23031         <p>
23032
23033 I don't  see anything in the  spec for the string  inserter that would
23034 justify requiring  it to treat  exceptions differently from  all other
23035 similar operators. (If it did, I think it should be made this explicit
23036 by saying  that the  operator "does not  behave as a  formatted output
23037 function" as has been made customary by the adoption of the resolution
23038 of issue 60).
23039
23040         </p>
23041     
23042
23043     <p><b>Proposed resolution:</b></p>
23044         <p>
23045
23046 I propose to change the Effects clause in 21.3.7.9, p5, as follows:
23047
23048         </p>
23049             <blockquote>
23050         <p>
23051
23052 <i>Effects</i>: <del>Begins by constructing a  sentry object k as if k
23053 were    constructed    by    typename    <code>basic_ostream&lt;charT,
23054 traits&gt;::sentry   k   (os)</code>.    If  <code>bool(k)</code>   is
23055 <code>true</code>, </del><ins>Behaves  as a formatted  output function
23056 (27.6.2.5.1).   After constructing  a  <code>sentry</code> object,  if
23057 this  object returns <code>true</code>  when converted  to a  value of
23058 type   <code>bool</code>,   determines   padding   as   described   in
23059 22.2.2.2.2</ins>,  then inserts the  resulting sequence  of characters
23060 <code><i>seq</i></code> as if by calling <code>os.rdbuf()-&gt;sputn(seq ,
23061 n)</code>,    where   <code><i>n</i></code>    is   the    larger   of
23062 <code>os.width()</code>   and   <code>str.size()</code>;  then   calls
23063 <code>os.width(0)</code>.  <del>If  the  call  to sputn  fails,  calls
23064 <code>os.setstate(ios_base::failbit)</code>.</del>
23065
23066         </p>
23067             </blockquote>
23068         <p>
23069
23070 This proposed  resilution assumes the  resolution of issue  394 (i.e.,
23071 that   all   formatted   output   functions  are   required   to   set
23072 <code>ios_base::badbit</code>  in response  to any  kind  of streambuf
23073 failure),   and   implicitly   assumes   that  a   return   value   of
23074 <code>sputn(seq,  <i>n</i>)</code>  other  than  <code><i>n</i></code>
23075 indicates a failure.
23076
23077         </p>
23078     
23079
23080
23081
23082 <hr>
23083 <h3><a name="589"></a>589. Requirements on iterators of member template functions of containers</h3>
23084 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
23085  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2006-08-02</p>
23086 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
23087 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
23088 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
23089 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#536">536</a></p>
23090 <p><b>Discussion:</b></p>
23091 <p>
23092 There appears to be no requirements on the InputIterators used in sequences in 23.1.1 in
23093 terms of their value_type, and the requirements in 23.1.2 appear to be overly strict
23094 (requires InputIterator::value_type be the same type as the container's value_type).
23095 </p>
23096
23097
23098 <p><b>Proposed resolution:</b></p>
23099 <p>
23100 Change 23.1.1 p3:
23101 </p>
23102
23103 <blockquote><p>
23104 In Tables 82 and 83, <tt>X</tt> denotes a sequence class, <tt>a</tt> denotes a
23105 value of <tt>X</tt>, <tt>i</tt> and <tt>j</tt> denote iterators satisfying input
23106 iterator requirements <ins>and refer to elements <ins>implicitly
23107 convertible to</ins> <tt>value_type</tt></ins>, <tt>[i, j)</tt> denotes a valid
23108 range, <tt>n</tt> denotes a value of <tt>X::size_type</tt>, <tt>p</tt> denotes a
23109 valid iterator to <tt>a</tt>, <tt>q</tt> denotes a valid dereferenceable
23110 iterator to <tt>a</tt>, <tt>[q1, q2)</tt> denotes a valid range in <tt>a</tt>,
23111 and <tt>t</tt> denotes a value of <tt>X::value_type</tt>.
23112 </p></blockquote>
23113
23114 <p>
23115 Change 23.1.2 p7:
23116 </p>
23117
23118 <blockquote><p>
23119 In Table 84, <tt>X</tt> is an associative container class, <tt>a</tt> is a value
23120 of <tt>X</tt>, <tt>a_uniq</tt> is a value of <tt>X</tt> when <tt>X</tt> supports
23121 unique keys, and <tt>a_eq</tt> is a value of <tt>X</tt> when <tt>X</tt> supports
23122 multiple keys, <tt>i</tt> and <tt>j</tt> satisfy input iterator requirements and
23123 refer to elements <del>of</del> <ins>implicitly convertible to</ins>
23124 <tt>value_type</tt>, <tt>[i, j)</tt> is a valid range, <tt>p</tt> is a valid
23125 iterator to <tt>a</tt>, <tt>q</tt> is a valid dereferenceable iterator to
23126 <tt>a</tt>, <tt>[q1, q2)</tt> is a valid range in <tt>a</tt>, <tt>t</tt> is a
23127 value of <tt>X::value_type</tt>, <tt>k</tt> is a value of <tt>X::key_type</tt>
23128 and <tt>c</tt> is a value of type <tt>X::key_compare</tt>.
23129 </p></blockquote>
23130
23131
23132
23133 <p><b>Rationale:</b></p>
23134 <p>
23135 Concepts will probably come in and rewrite this section anyway.  But just in case it is
23136 easy to fix this up as a safety net and as a clear statement of intent.
23137 </p>
23138
23139
23140
23141
23142
23143 <hr>
23144 <h3><a name="593"></a>593. __STDC_CONSTANT_MACROS</h3>
23145 <p><b>Section:</b> 18.3 [cstdint], TR1 8.22 [tr.c99.cstdint] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
23146  <b>Submitter:</b> Walter Brown <b>Date:</b> 2006-08-28</p>
23147 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#cstdint">issues</a> in [cstdint].</p>
23148 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
23149 <p><b>Discussion:</b></p>
23150 <p>
23151 Clause 18.3 of the current Working Paper (N2009) deals with the new C++ headers
23152 &lt;cstdint&gt; and &lt;stdint.h&gt;.  These are of course based on the C99 header
23153 &lt;stdint.h&gt;, and were part of TR1.
23154 </p>
23155
23156 <p>
23157 Per 18.3.1/1, these headers define a number of macros and function macros. 
23158 While the WP does not mention __STDC_CONSTANT_MACROS in this context, C99
23159 footnotes do mention __STDC_CONSTANT_MACROS.  Further, 18.3.1/2 states that "The
23160 header defines all ... macros the same as C99 subclause 7.18."
23161 </p>
23162
23163 <p>
23164 Therefore, if I wish to have the above-referenced macros and function macros
23165 defined, must I #define __STDC_CONSTANT_MACROS before I #include &lt;cstdint&gt;, or
23166 does the C++ header define these macros/function macros unconditionally?
23167 </p>
23168
23169
23170 <p><b>Proposed resolution:</b></p>
23171 <p>
23172 To put this issue to rest for C++0X, I propose the following addition to 
23173 18.3.1/2 of the Working Paper N2009:
23174 </p>
23175
23176 <blockquote><p>
23177 [Note: The macros defined by &lt;cstdint&gt; are provided unconditionally: in
23178 particular, the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
23179 (mentioned in C99 footnotes 219, 220, and 222) play no role in C++. --end note]
23180 </p></blockquote>
23181
23182
23183
23184
23185
23186 <hr>
23187 <h3><a name="595"></a>595. TR1/C++0x: fabs(complex&lt;T&gt;) redundant / wrongly specified</h3>
23188 <p><b>Section:</b> 26.3.7 [complex.value.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
23189  <b>Submitter:</b> Stefan Große Pawig <b>Date:</b> 2006-09-24</p>
23190 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#complex.value.ops">issues</a> in [complex.value.ops].</p>
23191 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
23192 <p><b>Discussion:</b></p>
23193 <p>
23194 TR1 introduced, in the C compatibility chapter, the function
23195 fabs(complex&lt;T&gt;):
23196 </p>
23197 <blockquote><pre>----- SNIP -----
23198 8.1.1 Synopsis                                [tr.c99.cmplx.syn]
23199
23200   namespace std {
23201   namespace tr1 {
23202 [...]
23203   template&lt;class T&gt; complex&lt;T&gt; fabs(const complex&lt;T&gt;&amp; x);
23204   } // namespace tr1
23205   } // namespace std
23206
23207 [...]
23208
23209 8.1.8 Function fabs                          [tr.c99.cmplx.fabs]
23210
23211 1 Effects: Behaves the same as C99 function cabs, defined in
23212   subclause 7.3.8.1.
23213 ----- SNIP -----
23214 </pre></blockquote>
23215
23216 <p>
23217 The current C++0X draft document (n2009.pdf) adopted this
23218 definition in chapter 26.3.1 (under the comment // 26.3.7 values)
23219 and 26.3.7/7.
23220 </p>
23221 <p>
23222 But in C99 (ISO/IEC 9899:1999 as well as the 9899:TC2 draft document
23223 n1124), the referenced subclause reads
23224 </p>
23225
23226 <blockquote><pre>----- SNIP -----
23227 7.3.8.1 The cabs functions
23228
23229   Synopsis
23230
23231 1 #include &lt;complex.h&gt;
23232   double cabs(double complex z);
23233   float cabsf(float complex z);
23234   long double cabsl(long double z);
23235
23236   Description
23237
23238 2 The cabs functions compute the complex absolute value (also called
23239   norm, modulus, or magnitude) of z.
23240
23241   Returns
23242
23243 3 The cabs functions return the complex absolute value.
23244 ----- SNIP -----
23245 </pre></blockquote>
23246
23247 <p>
23248 Note that the return type of the cabs*() functions is not a complex
23249 type.  Thus, they are equivalent to the already well established
23250   template&lt;class T&gt; T abs(const complex&lt;T&gt;&amp; x);
23251 (26.2.7/2 in ISO/IEC 14882:1998, 26.3.7/2 in the current draft
23252 document n2009.pdf).
23253 </p>
23254 <p>
23255 So either the return value of fabs() is specified wrongly, or fabs()
23256 does not behave the same as C99's cabs*().
23257 </p>
23258
23259 <b>Possible Resolutions</b>
23260
23261 <p>
23262 This depends on the intention behind the introduction of fabs().
23263 </p>
23264 <p>
23265 If the intention was to provide a /complex/ valued function that
23266 calculates the magnitude of its argument, this should be
23267 explicitly specified.  In TR1, the categorization under "C
23268 compatibility" is definitely wrong, since C99 does not provide
23269 such a complex valued function.
23270 </p>
23271 <p>
23272 Also, it remains questionable if such a complex valued function
23273 is really needed, since complex&lt;T&gt; supports construction and
23274 assignment from real valued arguments.  There is no difference
23275 in observable behaviour between
23276 </p>
23277 <blockquote><pre>  complex&lt;double&gt; x, y;
23278   y = fabs(x);
23279   complex&lt;double&gt; z(fabs(x));
23280 </pre></blockquote>
23281 <p>
23282 and
23283 </p>
23284 <blockquote><pre>  complex&lt;double&gt; x, y;
23285   y = abs(x);
23286   complex&lt;double&gt; z(abs(x));
23287 </pre></blockquote>
23288 <p>
23289 If on the other hand the intention was to provide the intended
23290 functionality of C99, fabs() should be either declared deprecated
23291 or (for C++0X) removed from the standard, since the functionality
23292 is already provided by the corresponding overloads of abs().
23293 </p>
23294
23295 <p><i>[
23296 Bellevue:
23297 ]</i></p>
23298
23299
23300 <blockquote>
23301 Bill believes that abs() is a suitable overload. We should remove fabs().
23302 </blockquote>
23303
23304
23305 <p><b>Proposed resolution:</b></p>
23306
23307 <p>
23308 Change the synopsis in 26.3.1 [complex.synopsis]:
23309 </p>
23310
23311 <blockquote><pre><del>template&lt;class T&gt; complex&lt;T&gt; fabs(const complex&lt;T&gt;&amp;);</del>
23312 </pre></blockquote>
23313
23314 <p>
23315 Remove 26.3.7 [complex.value.ops], p7:
23316 </p>
23317
23318 <blockquote>
23319 <pre><del>template&lt;class T&gt; complex&lt;T&gt; fabs(const complex&lt;T&gt;&amp; <i>x</i>);</del>
23320 </pre>
23321 <blockquote>
23322 <p>
23323 <del>-7- <i>Effects:</i> Behaves the same as C99 function <tt>cabs</tt>, defined in subclause 7.3.8.1.</del>
23324 </p>
23325 </blockquote>
23326 </blockquote>
23327
23328
23329
23330 <p><i>[
23331 Kona (2007): Change the return type of <tt>fabs(complex)</tt> to <tt>T</tt>. 
23332 Proposed Disposition: Ready
23333 ]</i></p>
23334
23335
23336
23337
23338
23339 <hr>
23340 <h3><a name="596"></a>596. 27.8.1.3 Table 112 omits "a+" and "a+b" modes</h3>
23341 <p><b>Section:</b> 27.8.1.4 [filebuf.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
23342  <b>Submitter:</b> Thomas Plum <b>Date:</b> 2006-09-26</p>
23343 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#filebuf.members">issues</a> in [filebuf.members].</p>
23344 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
23345 <p><b>Discussion:</b></p>
23346 <p>
23347 In testing 27.8.1.4 [filebuf.members], Table 112 (in the latest N2009 draft), we invoke  
23348 </p>
23349 <blockquote><pre>   ostr.open("somename", ios_base::out | ios_base::in | ios_base::app)
23350 </pre></blockquote>
23351 <p>
23352 and we expect the open to fail, because out|in|app is not listed in
23353 Table 92, and just before the table we see very specific words:
23354 </p>
23355 <blockquote><p>
23356   If mode is not some combination of flags shown in the table 
23357   then the open fails.
23358 </p></blockquote>
23359 <p>
23360 But the corresponding table in the C standard, 7.19.5.3, provides two
23361 modes "a+" and "a+b", to which the C++ modes out|in|app and
23362 out|in|app|binary would presumably apply.
23363 </p>
23364 <p>
23365 We would like to argue that the intent of Table 112 was to match the
23366 semantics of 7.19.5.3 and that the omission of "a+" and "a+b" was
23367 unintentional.  (Otherwise there would be valid and useful behaviors
23368 available in C file I/O which are unavailable using C++, for no
23369 valid functional reason.)
23370 </p>
23371 <p>
23372 We further request that the missing modes be explicitly restored to
23373 the WP, for inclusion in C++0x.
23374 </p>
23375
23376 <p><i>[
23377 Martin adds:
23378 ]</i></p>
23379
23380
23381 <p>
23382 ...besides "a+" and "a+b" the C++ table is also missing a row
23383 for a lone app bit which in at least two current implementation
23384 as well as in Classic Iostreams corresponds to the C stdio "a"
23385 mode and has been traditionally documented as implying ios::out.
23386 Which means the table should also have a row for in|app meaning
23387 the same thing as "a+" already proposed in the issue.
23388 </p>
23389
23390
23391 <p><b>Proposed resolution:</b></p>
23392 <p>
23393 Add to the table "File open modes" in 27.8.1.4 [filebuf.members]:
23394 </p>
23395
23396 <blockquote>
23397 <table border="1">
23398 <caption> File open modes</caption>
23399 <tbody><tr>
23400 <th colspan="5"><tt>ios_base</tt> Flag combination</th>
23401 <th><tt>stdio</tt> equivalent</th>
23402 </tr>
23403 <tr>
23404 <th><tt>binary</tt></th><th><tt>in</tt></th><th><tt>out</tt></th><th><tt>trunc</tt></th><th><tt>app</tt></th><th><tt>&nbsp;</tt></th>
23405 </tr>
23406
23407 <tr>
23408 <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>+</tt></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>"w"</tt></td>
23409 </tr>
23410 <tr>
23411 <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>+</tt></td> <td><tt>"a"</tt></td>
23412 </tr>
23413 <tr>
23414 <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>"a"</tt></ins></td>
23415 </tr>
23416 <tr>
23417 <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>"w"</tt></td>
23418 </tr>
23419 <tr>
23420 <td>&nbsp;</td> <td><tt>+</tt></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>"r"</tt></td>
23421 </tr>
23422 <tr>
23423 <td>&nbsp;</td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>"r+"</tt></td>
23424 </tr>
23425 <tr>
23426 <td>&nbsp;</td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>"w+"</tt></td>
23427 </tr>
23428 <tr>
23429 <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>+</tt></ins></td> <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>"a+"</tt></ins></td>
23430 </tr>
23431 <tr>
23432 <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>"a+"</tt></ins></td>
23433 </tr>
23434
23435 <tr>
23436 <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>+</tt></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>"wb"</tt></td>
23437 </tr>
23438 <tr>
23439 <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>+</tt></td> <td><tt>"ab"</tt></td>
23440 </tr>
23441 <tr>
23442 <td><ins><tt>+</tt></ins></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>"ab"</tt></ins></td>
23443 </tr>
23444 <tr>
23445 <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>"wb"</tt></td>
23446 </tr>
23447 <tr>
23448 <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>"rb"</tt></td>
23449 </tr>
23450 <tr>
23451 <td><tt>+</tt></td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><tt>"r+b"</tt></td>
23452 </tr>
23453 <tr>
23454 <td><tt>+</tt></td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td><tt>+</tt></td> <td>&nbsp;</td> <td><tt>"w+b"</tt></td>
23455 </tr><tr>
23456 <td><ins><tt>+</tt></ins></td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>+</tt></ins></td> <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>"a+b"</tt></ins></td>
23457 </tr>
23458 <tr>
23459 <td><ins><tt>+</tt></ins></td> <td><ins><tt>+</tt></ins></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><ins><tt>+</tt></ins></td> <td><ins><tt>"a+b"</tt></ins></td>
23460 </tr>
23461
23462
23463 </tbody></table>
23464 </blockquote>
23465
23466
23467
23468 <p><i>[
23469 Kona (2007) Added proposed wording and moved to Review.
23470 ]</i></p>
23471
23472
23473
23474
23475
23476 <hr>
23477 <h3><a name="598"></a>598. Decimal: Conversion to integral should truncate, not round.</h3>
23478 <p><b>Section:</b> TRDecimal 3.2 [trdec.types.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23479  <b>Submitter:</b> Daniel Krugler <b>Date:</b> 2006-05-28</p>
23480 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#trdec.types.types">active issues</a> in [trdec.types.types].</p>
23481 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#trdec.types.types">issues</a> in [trdec.types.types].</p>
23482 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23483 <p><b>Discussion:</b></p>
23484
23485 <p>
23486 In a private email, Daniel writes:
23487 </p>
23488 <blockquote>
23489 <p>
23490 I would like to 
23491 ask, what where the reason for the decision to 
23492 define the semantics of the integral conversion of the decimal types, namely
23493 </p>
23494 <pre>"operator long long() const;
23495
23496      Returns: Returns the result of the 
23497 conversion of *this to the type long long, as if 
23498 performed by the expression llrounddXX(*this)."
23499 </pre>
23500 <p>
23501 where XX stands for either 32, 64, or 128, 
23502 corresponding to the proper decimal type. The 
23503 exact meaning of llrounddXX is not given in that 
23504 paper, so I compared it to the corresponding 
23505 definition given in C99, 2nd edition (ISO 9899), which says in 7.12.9.7 p. 2:
23506 </p>
23507 <p>
23508 "The lround and llround functions round their 
23509 argument to the nearest integer value,
23510 rounding halfway cases away from zero, regardless 
23511 of the current rounding direction. [..]"
23512 </p>
23513 <p>
23514 Now considering the fact that integral conversion 
23515 of the usual floating-point types ("4.9 
23516 Floating-integral conversions") has truncation 
23517 semantic I wonder why this conversion behaviour 
23518 has not been transferred for the decimal types. 
23519 </p>
23520 </blockquote>
23521 <p>
23522 Robert comments:
23523 </p>
23524 <p>
23525 Also, there is a further error in the <b>Returns:</b> clause for converting <code>decimal::decimal128</code> to <code>long long</code>.  It currently calls <code>llroundd64</code>, not <code>llroundd128</code>.
23526 </p>
23527
23528
23529
23530 <p><b>Proposed resolution:</b></p>
23531 <p>
23532 Change the <b>Returns:</b> clause in 3.2.2.4 to:
23533 </p>
23534 <blockquote><p>
23535 <b>Returns:</b> Returns the result of the conversion of <code>*this</code> to the type <code>long long</code>, as if performed by the expression <code>llroundd32(*this)</code> <ins>while the decimal rounding direction mode [3.5.2] <code>FE_DEC_TOWARD_ZERO</code> is in effect</ins>.
23536 </p></blockquote>
23537 <p>
23538 Change the <b>Returns:</b> clause in 3.2.3.4 to:
23539 </p>
23540 <blockquote><p>
23541 <b>Returns:</b> Returns the result of the conversion of <code>*this</code> to the type <code>long long</code>, as if performed by the expression <code>llroundd64(*this)</code> <ins>while the decimal rounding direction mode [3.5.2] <code>FE_DEC_TOWARD_ZERO</code> is in effect</ins>.
23542 </p></blockquote>
23543 <p>
23544 Change the <b>Returns:</b> clause in 3.2.4.4 to:
23545 </p>
23546 <blockquote><p>
23547 <b>Returns:</b> Returns the result of the conversion of <code>*this</code> to the type <code>long long</code>, as if performed by the expression <del><code>llroundd64(*this)</code></del> <ins><code>llroundd128(*this)</code> while the decimal rounding direction mode [3.5.2] <code>FE_DEC_TOWARD_ZERO</code> is in effect</ins>.
23548 </p></blockquote>
23549
23550
23551
23552
23553
23554
23555 <hr>
23556 <h3><a name="599"></a>599. Decimal: Say "octets" instead of "bytes."</h3>
23557 <p><b>Section:</b> TRDecimal 3.1 [trdec.types.encodings] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23558  <b>Submitter:</b> Daniel Krugler <b>Date:</b> 2006-05-28</p>
23559 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23560 <p><b>Discussion:</b></p>
23561 <p>
23562 Daniel writes in a private email:
23563 </p>
23564
23565 <blockquote>
23566 <p>
23567 - 3.1 'Decimal type encodings' says in its note:
23568 </p>
23569 <pre>"this implies that 
23570 sizeof(std::decimal::decimal32) == 4, 
23571 sizeof(std::decimal::decimal64) == 8, and 
23572 sizeof(std::decimal::decimal128) == 16."
23573 </pre>
23574 <p>
23575 This is a wrong assertion, because the definition 
23576 of 'byte' in 1.7 'The C+ + memory model' of ISO 
23577 14882 (2nd edition) does not specify that a byte 
23578 must be necessarily 8 bits large, which would be 
23579 necessary to compare with the specified bit sizes 
23580 of the types decimal32, decimal64, and decimal128.
23581 </p>
23582 </blockquote>
23583
23584
23585 <p><b>Proposed resolution:</b></p>
23586 <p>
23587 Change 3.1 as follows:
23588 </p>
23589 <blockquote>
23590 <p>
23591 The three decimal encoding formats defined in IEEE-754R correspond to the three decimal floating types as follows:
23592 </p>
23593 <ul>
23594 <li>
23595 decimal32 is a <em>decimal32</em> number, which is encoded in four consecutive <del>bytes</del> <ins>octets</ins> (32 bits)
23596 </li>
23597 <li>
23598 decimal64 is a <em>decimal64</em> number, which is encoded in eight consecutive <del>bytes</del> <ins>octets</ins> (64 bits)
23599
23600 </li>
23601 <li>
23602 decimal128 is a <em>decimal128</em> number, which is encoded in 16 consecutive <del>bytes</del> <ins>octets</ins> (128 bits)
23603 </li>
23604 </ul>
23605 <p>
23606 <del>[<i>Note:</i> this implies that <code>sizeof(std::decimal::decimal32) == 4</code>, <code>sizeof(std::decimal::decimal64) == 8</code>, and <code>sizeof(std::decimal::decimal128) == 16</code>.  <i>--end note</i>]</del>
23607 </p>
23608 </blockquote>
23609
23610
23611
23612
23613 <hr>
23614 <h3><a name="600"></a>600. Decimal: Wrong parameters for wcstod* functions</h3>
23615 <p><b>Section:</b> TRDecimal 3.9 [trdec.types.cwchar] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23616  <b>Submitter:</b> Daniel Krugler <b>Date:</b> 2006-05-28</p>
23617 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23618 <p><b>Discussion:</b></p>
23619 <p>
23620 Daniel writes:
23621 </p>
23622 <blockquote><p>
23623 - 3.9.1 'Additions to &lt;cwchar&gt;' provides wrong 
23624 signatures to the wcstod32, wcstod64, and 
23625 wcstod128 functions ([the parameters have type pointer-to-] char instead of wchar_t).
23626 </p></blockquote>
23627
23628
23629 <p><b>Proposed resolution:</b></p>
23630 <p>
23631 Change "3.9.1 Additions to <code>&lt;cwchar&gt;</code> synopsis" to:
23632 </p>
23633 <pre>       namespace std {
23634        namespace decimal {
23635          // 3.9.2 wcstod functions:
23636          decimal32  wcstod32  (const <del>char</del> <ins>wchar_t</ins> * nptr, <del>char</del> <ins>wchar_t</ins> ** endptr);
23637          decimal64  wcstod64  (const <del>char</del> <ins>wchar_t</ins> * nptr, <del>char</del> <ins>wchar_t</ins> ** endptr);
23638          decimal128 wcstod128 (const <del>char</del> <ins>wchar_t</ins> * nptr, <del>char</del> <ins>wchar_t</ins> ** endptr);
23639        }
23640        }
23641 </pre>
23642
23643
23644
23645
23646 <hr>
23647 <h3><a name="601"></a>601. Decimal: numeric_limits typos</h3>
23648 <p><b>Section:</b> TRDecimal 3.3 [trdec.types.limits] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23649  <b>Submitter:</b> Daniel Krugler <b>Date:</b> 2006-05-28</p>
23650 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23651 <p><b>Discussion:</b></p>
23652 <p>
23653 Daniel writes in a private email:
23654 </p>
23655
23656 <blockquote>
23657 <p>
23658 - 3.3 'Additions to header &lt;limits&gt;' contains two 
23659 errors in the specialisation of numeric_limits&lt;decimal::decimal128&gt;:
23660 </p>
23661 <ol>
23662 <li>The static member max() returns DEC128_MIN, this should be DEC128_MAX.</li>
23663 <li>The static member digits is assigned to 384,
23664 this should be 34 (Probably mixed up with the
23665 max. exponent for decimal::decimal64).</li>
23666 </ol>
23667 </blockquote>
23668
23669
23670 <p><b>Proposed resolution:</b></p>
23671 <p>
23672 In "3.3 Additions to header <code>&lt;limits&gt;</code>" change numeric_limits&lt;decimal::decimal128&gt; as follows:
23673 </p>
23674 <pre>        template&lt;&gt; class numeric_limits&lt;decimal::decimal128&gt; {
23675           public:
23676             static const bool is_specialized = true;
23677
23678             static decimal::decimal128 min() throw() { return DEC128_MIN; }
23679             static decimal::decimal128 max() throw() { return <del>DEC128_MIN;</del> <ins>DEC128_MAX;</ins> }
23680
23681             static const int digits       = <del>384</del> <ins>34</ins>;
23682             /* ... */
23683 </pre>
23684
23685
23686
23687
23688 <hr>
23689 <h3><a name="602"></a>602. Decimal: "generic floating type" not defined.</h3>
23690 <p><b>Section:</b> TRDecimal 3 [trdec.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23691  <b>Submitter:</b> Daniel Krugler <b>Date:</b> 2006-05-28</p>
23692 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#trdec.types">issues</a> in [trdec.types].</p>
23693 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23694 <p><b>Discussion:</b></p>
23695 <p>
23696 The document uses the term "generic floating types," but defines it nowhere.
23697 </p>
23698
23699
23700 <p><b>Proposed resolution:</b></p>
23701 <p>
23702 Change the first paragraph of "3 Decimal floating-point types" as follows:
23703 </p>
23704 <blockquote><p>
23705 This Technical Report introduces three decimal floating-point types, named
23706 decimal32, decimal64, and decimal128. The set of values of type decimal32 is a
23707 subset of the set of values of type decimal64; the set of values of the type
23708 decimal64 is a subset of the set of values of the type decimal128. Support for
23709 decimal128 is optional.  <ins>These types supplement the Standard C++ types
23710 <code>float</code>, <code>double</code>, and <code>long double</code>, which are
23711 collectively described as the <i>basic floating types</i></ins>.
23712 </p></blockquote>
23713
23714
23715
23716
23717 <hr>
23718 <h3><a name="603"></a>603. Decimal: Trivially simplifying decimal classes.</h3>
23719 <p><b>Section:</b> TRDecimal 3 [trdec.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23720  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-05-28</p>
23721 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#trdec.types">issues</a> in [trdec.types].</p>
23722 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23723 <p><b>Discussion:</b></p>
23724 <p>In c++std-lib-17198, Martin writes:</p>
23725
23726 <blockquote><p>
23727 Each of the three classes proposed in the paper (decimal32, decimal64,
23728 and decimal128) explicitly declares and specifies the semantics of its
23729 copy constructor, copy assignment operator, and destructor. Since the
23730 semantics of all three functions are identical to the trivial versions
23731 implicitly generated by the compiler in the absence of any declarations
23732 it is safe to drop them from the spec. This change would make the
23733 proposed classes consistent with other similar classes already in the
23734 standard (e.g., std::complex).
23735 </p></blockquote>
23736
23737
23738 <p><b>Proposed resolution:</b></p>
23739 <p>
23740 Change "3.2.2 Class <code>decimal32</code>" as follows:
23741 </p>
23742 <pre>      namespace std {
23743       namespace decimal {
23744         class decimal32 {
23745           public:
23746             // 3.2.2.1 construct/copy/destroy:
23747             decimal32();
23748             <del>decimal32(const decimal32 &amp; d32);</del>
23749             <del>decimal32 &amp; operator=(const decimal32 &amp; d32);</del>
23750             <del>~decimal32();</del>
23751             /* ... */
23752 </pre>
23753 <p>
23754 Change "3.2.2.1 construct/copy/destroy" as follows:
23755 </p>
23756 <pre>        decimal32();
23757
23758     Effects: Constructs an object of type decimal32 with the value 0;
23759
23760         <del>decimal32(const decimal32 &amp; d32);</del>
23761         <del>decimal32 &amp; operator=(const decimal32 &amp; d32);</del>
23762
23763     <del>Effects: Copies an object of type decimal32.</del>
23764
23765         <del>~decimal32();</del>
23766
23767     <del>Effects: Destroys an object of type decimal32.</del>
23768
23769 </pre>
23770 <p>
23771 Change "3.2.3 Class <code>decimal64</code>" as follows:
23772 </p>
23773 <pre>      namespace std {
23774       namespace decimal {
23775         class decimal64 {
23776           public:
23777             // 3.2.3.1 construct/copy/destroy:
23778             decimal64();
23779             <del>decimal64(const decimal64 &amp; d64);</del>
23780             <del>decimal64 &amp; operator=(const decimal64 &amp; d64);</del>
23781             <del>~decimal64();</del>
23782             /* ... */
23783 </pre>
23784 <p>
23785 Change "3.2.3.1 construct/copy/destroy" as follows:
23786 </p>
23787 <pre>        decimal64();
23788
23789     Effects: Constructs an object of type decimal64 with the value 0;
23790
23791         <del>decimal64(const decimal64 &amp; d64);</del>
23792         <del>decimal64 &amp; operator=(const decimal64 &amp; d64);</del>
23793
23794     <del>Effects: Copies an object of type decimal64.</del>
23795
23796         <del>~decimal64();</del>
23797
23798     <del>Effects: Destroys an object of type decimal64.</del>
23799
23800 </pre>
23801 <p>
23802 Change "3.2.4 Class <code>decimal128</code>" as follows:
23803 </p>
23804 <pre>      namespace std {
23805       namespace decimal {
23806         class decimal128 {
23807           public:
23808             // 3.2.4.1 construct/copy/destroy:
23809             decimal128();
23810             <del>decimal128(const decimal128 &amp; d128);</del>
23811             <del>decimal128 &amp; operator=(const decimal128 &amp; d128);</del>
23812             <del>~decimal128();</del>
23813             /* ... */
23814 </pre>
23815 <p>
23816 Change "3.2.4.1 construct/copy/destroy" as follows:
23817 </p>
23818 <pre>        decimal128();
23819
23820     Effects: Constructs an object of type decimal128 with the value 0;
23821
23822         <del>decimal128(const decimal128 &amp; d128);</del>
23823         <del>decimal128 &amp; operator=(const decimal128 &amp; d128);</del>
23824
23825     <del>Effects: Copies an object of type decimal128.</del>
23826
23827         <del>~decimal128();</del>
23828
23829     <del>Effects: Destroys an object of type decimal128.</del>
23830
23831 </pre>
23832
23833
23834
23835
23836 <hr>
23837 <h3><a name="604"></a>604. Decimal: Storing a reference to a facet unsafe.</h3>
23838 <p><b>Section:</b> TRDecimal 3 [trdec.types] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23839  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2006-05-28</p>
23840 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#trdec.types">issues</a> in [trdec.types].</p>
23841 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23842 <p><b>Discussion:</b></p>
23843 <p>
23844 In c++std-lib-17197, Martin writes:
23845 </p>
23846 <blockquote><p>
23847 The extended_num_get and extended_num_put facets are designed
23848 to store a reference to a num_get or num_put facet which the
23849 extended facets delegate the parsing and formatting of types
23850 other than decimal. One form of the extended facet's ctor (the
23851 default ctor and the size_t overload) obtains the reference
23852 from the global C++ locale while the other form takes this
23853 reference as an argument.
23854 </p></blockquote>
23855 <blockquote><p>
23856 The problem with storing a reference to a facet in another
23857 object (as opposed to storing the locale object in which the
23858 facet is installed) is that doing so bypasses the reference
23859 counting mechanism designed to prevent a facet that is still
23860 being referenced (i.e., one that is still installed in some
23861 locale) from being destroyed when another locale that contains
23862 it is destroyed. Separating a facet reference from the locale
23863 it comes from van make it cumbersome (and in some cases might
23864 even make it impossible) for programs to prevent invalidating
23865 the reference. (The danger of this design is highlighted in
23866 the paper.)
23867 </p></blockquote>
23868 <blockquote><p>
23869 This problem could be easily avoided by having the extended
23870 facets store a copy of the locale from which they would extract
23871 the base facet either at construction time or when needed. To
23872 make it possible, the forms of ctors of the extended facets that
23873 take a reference to the base facet would need to be changed to
23874 take a locale argument instead.
23875 </p></blockquote>
23876
23877
23878 <p><b>Proposed resolution:</b></p>
23879 <p>
23880 1. Change the <code>extended_num_get</code> synopsis in 3.10.2 as follows:
23881 </p>
23882 <pre>            extended_num_get(const <del>std::num_get&lt;charT, InputIterator&gt;</del> <ins>std::locale</ins> &amp; <i>b</i>, size_t <i>refs</i> = 0);
23883
23884             /* ... */
23885
23886             <del>// <i>const std::num_get&lt;charT, InputIterator&gt; &amp; <b>base</b></i>;        <i><b>exposition only</b></i></del>
23887             <ins>// <i>std::locale <b>baseloc</b></i>;                                    <i><b>exposition only</b></i></ins>
23888 </pre>
23889 <p>
23890 2. Change the description of the above constructor in 3.10.2.1:
23891 </p>
23892 <pre>            extended_num_get(const <del>std::num_get&lt;charT, InputIterator&gt;</del> <ins>std::locale</ins> &amp; <i>b</i>, size_t <i>refs</i> = 0);
23893
23894 </pre>
23895 <blockquote>
23896 <p>
23897 <b>Effects:</b> Constructs an <code>extended_num_get</code> facet as if by:
23898 </p>
23899 <pre>       extended_num_get(const <del>std::num_get&lt;charT, InputIterator&gt;</del> <ins>std::locale</ins> &amp; <i>b</i>, size_t <i>refs</i> = 0)
23900                 : facet(<i>refs</i>), <i>base<ins>loc</ins></i>(<i>b</i>)
23901                 { /* ... */ }
23902
23903 </pre>
23904 <p>
23905 <del><b>Notes:</b> Care must be taken by the implementation to ensure that the lifetime of the facet referenced by <i>base</i> exceeds that of the resulting <code>extended_num_get</code> facet.</del>
23906 </p>
23907 </blockquote>
23908 <p>
23909 3. Change the <b>Returns:</b> clause for <code>do_get(iter_type, iter_type, ios_base &amp;, ios_base::iostate &amp;, bool &amp;) const</code>, <i>et al</i> to
23910 </p>
23911 <blockquote><p>
23912 <b>Returns:</b> <code><del><i>base</i></del> <ins>std::use_facet&lt;std::num_get&lt;charT, InputIterator&gt; &gt;(<i>baseloc</i>)</ins>.get(<i>in</i>, <i>end</i>, <i>str</i>, <i>err</i>, <i>val</i>)</code>. 
23913 </p></blockquote>
23914 <p>
23915 4. Change the <code>extended_num_put</code> synopsis in 3.10.3 as follows:
23916 </p>
23917 <pre>            extended_num_put(const <del>std::num_put&lt;charT, OutputIterator&gt;</del> <ins>std::locale</ins> &amp; <i>b</i>, size_t <i>refs</i> = 0);
23918
23919             /* ... */
23920
23921             <del>// <i>const std::num_put&lt;charT, OutputIterator&gt; &amp; <b>base</b></i>;       <i><b>exposition only</b></i></del>
23922             <ins>// <i>std::locale <b>baseloc</b></i>;                                    <i><b>exposition only</b></i></ins>
23923 </pre>
23924 <p>
23925 5. Change the description of the above constructor in 3.10.3.1:
23926 </p>
23927 <pre>            extended_num_put(const <del>std::num_put&lt;charT, OutputIterator&gt;</del> <ins>std::locale</ins> &amp; <i>b</i>, size_t <i>refs</i> = 0);
23928 </pre>
23929 <blockquote>
23930 <p>
23931 <b>Effects:</b> Constructs an <code>extended_num_put</code> facet as if by:
23932 </p>
23933 <pre>       extended_num_put(const <del>std::num_put&lt;charT, OutputIterator&gt;</del> <ins>std::locale</ins> &amp; <i>b</i>, size_t <i>refs</i> = 0)
23934                 : facet(<i>refs</i>), <i>base<ins>loc</ins></i>(<i>b</i>)
23935                 { /* ... */ }
23936
23937 </pre>
23938 <p>
23939 <del><b>Notes:</b> Care must be taken by the implementation to ensure that the lifetime of the facet referenced by <i>base</i> exceeds that of the resulting <code>extended_num_put</code> facet.</del>
23940 </p>
23941 </blockquote>
23942 <p>
23943 6. Change the <b>Returns:</b> clause for <code>do_put(iter_type, ios_base &amp;, char_type, bool &amp;) const</code>, <i>et al</i> to
23944 </p>
23945 <blockquote><p>
23946 <b>Returns:</b> <code><del><i>base</i></del> <ins>std::use_facet&lt;std::num_put&lt;charT, OutputIterator&gt; &gt;(<i>baseloc</i>)</ins>.put(<i>s</i>, <i>f</i>, <i>fill</i>, <i>val</i>)</code>. 
23947 </p></blockquote>
23948
23949 <p><i>[
23950 Redmond:  We would prefer to rename "extended" to "decimal".
23951 ]</i></p>
23952
23953
23954
23955
23956
23957
23958 <hr>
23959 <h3><a name="605"></a>605. Decimal: &lt;decfloat.h&gt; doesn't live here anymore.</h3>
23960 <p><b>Section:</b> TRDecimal 3.4 [trdec.types.cdecfloat] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#TRDec">TRDec</a>
23961  <b>Submitter:</b> Robert Klarer <b>Date:</b> 2006-10-17</p>
23962 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#TRDec">TRDec</a> status.</p>
23963 <p><b>Discussion:</b></p>
23964 <p>
23965 In Berlin, WG14 decided to drop the &lt;decfloat.h&gt; header. The
23966 contents of that header have been moved into &lt;float.h&gt;. For the
23967 sake of C compatibility, we should make corresponding changes.
23968 </p>
23969
23970
23971 <p><b>Proposed resolution:</b></p>
23972 <p>
23973 1. Change the heading of subclause 3.4, "Headers <code>&lt;cdecfloat&gt;</code> and <code>&lt;decfloat.h&gt;</code>" to "Additions to headers <code>&lt;cfloat&gt;</code> and <code>&lt;float.h&gt;</code>."
23974 </p>
23975 <p>
23976 2. Change the text of subclause 3.4 as follows:
23977 </p>
23978 <blockquote>
23979 <p>
23980 <del>The standard C++ headers <code>&lt;cfloat&gt;</code> and <code>&lt;float.h&gt;</code> define characteristics of the floating-point types <code>float</code>, <code>double</code>, and <code>long double</code>.  Their contents remain unchanged by this Technical Report.</del>
23981 </p>
23982 <p>
23983 <del>Headers <code>&lt;cdecfloat&gt;</code> and <code>&lt;decfloat.h&gt;</code> define characteristics of the decimal floating-point types <code>decimal32</code>, <code>decimal64</code>, and <code>decimal128</code>.  As well, <code>&lt;decfloat.h&gt;</code> defines the convenience typedefs <code>_Decimal32</code>, <code>_Decimal64</code>, and <code>_Decimal128</code>, for compatibilty with the C programming language.</del>
23984 </p>
23985 <p>
23986 <ins>The header <code>&lt;cfloat&gt;</code> is described in [tr.c99.cfloat].  The header <code>&lt;float.h&gt;</code>
23987 is described in [tr.c99.floath]. These headers are extended by this
23988 Technical Report to define characteristics of the decimal
23989 floating-point types <code>decimal32</code>, <code>decimal64</code>, and <code>decimal128</code>.  As well, <code>&lt;float.h&gt;</code> is extended to define the convenience typedefs <code>_Decimal32</code>, <code>_Decimal64</code>, and <code>_Decimal128</code> for compatibility with the C programming language.</ins>
23990 </p>
23991 </blockquote>
23992 <p>
23993 3. Change the heading of subclause 3.4.1, "Header <code>&lt;cdecfloat&gt;</code> synopsis"  to "Additions to header <code>&lt;cfloat&gt;</code> synopsis."
23994 </p>
23995 <p>
23996 4. Change the heading of subclause 3.4.2, "Header <code>&lt;decfloat.h&gt;</code> synopsis" to "Additions to header <code>&lt;float.h&gt;</code> synopsis."
23997 </p>
23998 <p>
23999 5. Change the contents of 3.4.2 as follows:
24000 </p>
24001 <pre>      <del>#include &lt;cdecfloat&gt;</del>
24002
24003       // <i>C-compatibility convenience typedefs:</i>
24004
24005       typedef std::decimal::decimal32  _Decimal32;
24006       typedef std::decimal::decimal64  _Decimal64;
24007       typedef std::decimal::decimal128 _Decimal128;
24008 </pre>
24009
24010
24011
24012
24013
24014 <hr>
24015 <h3><a name="607"></a>607. Concern about short seed vectors</h3>
24016 <p><b>Section:</b> 26.4.7.1 [rand.util.seedseq] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24017  <b>Submitter:</b> Charles Karney <b>Date:</b> 2006-10-26</p>
24018 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#rand.util.seedseq">active issues</a> in [rand.util.seedseq].</p>
24019 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.util.seedseq">issues</a> in [rand.util.seedseq].</p>
24020 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24021 <p><b>Discussion:</b></p>
24022 <p>
24023 Short seed vectors of 32-bit quantities all result in different states. However
24024 this is not true of seed vectors of 16-bit (or smaller) quantities.  For example
24025 these two seeds
24026 </p>
24027
24028 <blockquote><pre>unsigned short seed = {1, 2, 3};
24029 unsigned short seed = {1, 2, 3, 0};
24030 </pre></blockquote>
24031
24032 <p>
24033 both pack to
24034 </p>
24035
24036 <blockquote><pre>unsigned seed = {0x20001, 0x3};
24037 </pre></blockquote>
24038
24039 <p>
24040 yielding the same state.
24041 </p>
24042
24043 <p>
24044 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
24045 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
24046 for some further discussion.
24047 </p>
24048
24049
24050 <p><b>Proposed resolution:</b></p>
24051 <p>
24052 Adopt the proposed resolution in
24053 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
24054 </p>
24055
24056
24057 <p><i>[
24058 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
24059 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
24060 ]</i></p>
24061
24062
24063
24064
24065
24066 <hr>
24067 <h3><a name="608"></a>608. Unclear seed_seq construction details</h3>
24068 <p><b>Section:</b> 26.4.7.1 [rand.util.seedseq] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24069  <b>Submitter:</b> Charles Karney <b>Date:</b> 2006-10-26</p>
24070 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#rand.util.seedseq">active issues</a> in [rand.util.seedseq].</p>
24071 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.util.seedseq">issues</a> in [rand.util.seedseq].</p>
24072 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24073 <p><b>Discussion:</b></p>
24074 <p>
24075 In 26.4.7.1 [rand.util.seedseq] /6, the order of packing the inputs into b and the
24076 treatment of signed quantities is unclear. Better to spell it out.
24077 </p>
24078
24079 <p>
24080 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
24081 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
24082 for some further discussion.
24083 </p>
24084
24085
24086 <p><b>Proposed resolution:</b></p>
24087 <p>
24088 Adopt the proposed resolution in
24089 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
24090 </p>
24091
24092
24093 <p><i>[
24094 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
24095 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
24096 ]</i></p>
24097
24098
24099
24100
24101
24102 <hr>
24103 <h3><a name="609"></a>609. missing static const</h3>
24104 <p><b>Section:</b> 26.4.4.2 [rand.adapt.ibits], TR1 5.1 [tr.rand] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24105  <b>Submitter:</b> Walter E. Brown <b>Date:</b> 2006-11-02</p>
24106 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24107 <p><b>Discussion:</b></p>
24108 <p>
24109 In preparing N2111, an error on my part resulted in the omission of the
24110 following line from the template synopsis in the cited section:
24111 </p>
24112
24113 <blockquote><pre>static const size_t word_size = w;
24114 </pre></blockquote>
24115
24116 <p>
24117 (This same constant is found, for example, in 26.4.3.3 [rand.eng.sub].)
24118 </p>
24119
24120
24121 <p><b>Proposed resolution:</b></p>
24122 <p>
24123 Add the above declaration as the first line after the comment in [rand.adapt.ibits] p4:
24124 </p>
24125
24126 <blockquote><pre>// engine characteristics
24127 <ins>static const size_t word_size = w;</ins>
24128 </pre></blockquote>
24129
24130 <p>
24131 and accept my apologies for the oversight.
24132 </p>
24133
24134
24135
24136
24137
24138 <hr>
24139 <h3><a name="610"></a>610. Suggested non-normative note for C++0x</h3>
24140 <p><b>Section:</b> 20.6.15.2.1 [func.wrap.func.con], TR1 3.7.2.1 [tr.func.wrap.func.con] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24141  <b>Submitter:</b> Scott Meyers <b>Date:</b> 2006-11-02</p>
24142 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24143 <p><b>Discussion:</b></p>
24144 <p>
24145 My suggestion is that implementers of both tr1::function and its 
24146 official C++0x successor be explicitly encouraged (but not required) to 
24147 optimize for the cases mentioned above, i.e., function pointers and 
24148 small function objects.  They could do this by using a small internal 
24149 buffer akin to the buffer used by implementations of the small string 
24150 optimization.  (That would make this the small functor optimization -- 
24151 SFO :-})  The form of this encouragement could be a note in the standard 
24152 akin to footnote 214 of the current standard.
24153 </p>
24154
24155 <p>
24156 Dave Abrahams notes:
24157 </p>
24158
24159 <p>
24160 "shall not throw exceptions" should really be "nothing," both to be more
24161 grammatical and to be consistent with existing wording in the standard.
24162 </p>
24163
24164 <p>
24165 Doug Gregor comments: I think this is a good idea. Currently, implementations of
24166 tr1::function are required to have non-throwing constructors and assignment
24167 operators when the target function object is a function pointer or a
24168 reference_wrapper. The common case, however, is for a tr1::function to store
24169 either an empty function object or a member pointer + an object pointer.
24170 </p>
24171 <p>
24172 The function implementation in the upcoming Boost 1.34.0 uses the
24173 "SFO", so that the function objects for typical bind expressions like
24174 </p>
24175 <blockquote><pre>bind(&amp;X::f, this, _1, _2, _3)
24176 </pre></blockquote>
24177
24178 <p>
24179 do not require heap allocation when stored in a boost::function. I
24180 believe Dinkumware's implementation also performs this optimization.
24181 </p>
24182
24183
24184
24185 <p><b>Proposed resolution:</b></p>
24186 <p>
24187 Revise 20.5.14.2.1 p6 [func.wrap.func.con] to add a note as follows:
24188 </p>
24189
24190 <blockquote>
24191 <p>
24192 <i>Throws:</i> shall not throw exceptions if <tt>f</tt>'s target is a function
24193 pointer or a function object passed via <tt>reference_wrapper</tt>. Otherwise,
24194 may throw <tt>bad_alloc</tt> or any exception thrown by the copy constructor of
24195 the stored function object.
24196 </p>
24197 <p>
24198 <ins><i>Note:</i> Implementations are encouraged to avoid the use of dynamically
24199 allocated memory for "small" function objects, e.g., where <tt>f</tt>'s target
24200 is an object holding only a pointer or reference to an object and a member
24201 function pointer (a "bound member function").</ins>
24202 </p>
24203 </blockquote>
24204
24205
24206
24207
24208
24209 <hr>
24210 <h3><a name="611"></a>611. Standard library templates and incomplete types</h3>
24211 <p><b>Section:</b> 17.4.3.7 [res.on.functions] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24212  <b>Submitter:</b> Nicola Musatti <b>Date:</b> 2006-11-13</p>
24213 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24214 <p><b>Discussion:</b></p>
24215 <p>
24216 In the latest available draft standard 
24217 (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2134.pdf">N2134</a>)
24218 § 17.4.3.6 [res.on.functions] states:
24219 </p>
24220
24221 <blockquote>
24222 <p>
24223 -1- In certain cases (replacement functions, handler functions, operations on
24224 types used to instantiate standard library template components), the C++
24225 Standard Library depends on components supplied by a C++ program. If these
24226 components do not meet their requirements, the Standard places no requirements
24227 on the implementation.
24228 </p>
24229
24230 <p>
24231 -2- In particular, the effects are undefined in the following cases:
24232 </p>
24233 <p>
24234 [...]
24235 </p>
24236 <ul>
24237 <li>if an incomplete type (3.9) is used as a template argument when
24238 instantiating a template component. </li>
24239 </ul>
24240 </blockquote>
24241
24242 <p>
24243 This is contradicted by § 20.6.6.2/2 [util.smartptr.shared] which
24244 states:
24245 </p>
24246
24247 <blockquote>
24248 <p>
24249 [...]
24250 </p>
24251
24252 <p>
24253 The template parameter <tt>T</tt> of <tt>shared_ptr</tt> may be an incomplete type.
24254 </p>
24255 </blockquote>
24256
24257
24258 <p><b>Proposed resolution:</b></p>
24259 <p>
24260 Modify the last bullet of § 17.4.3.6/2 [res.on.functions] to allow for
24261 exceptions:
24262 </p>
24263
24264 <blockquote>
24265 <ul>
24266 <li>if an incomplete type (3.9) is used as a template argument when
24267 instantiating a template component<ins>, unless specifically allowed for the
24268 component</ins>. </li>
24269 </ul>
24270 </blockquote>
24271
24272
24273
24274
24275
24276
24277 <hr>
24278 <h3><a name="612"></a>612. numeric_limits::is_modulo insufficiently defined</h3>
24279 <p><b>Section:</b> 18.2.1.2 [numeric.limits.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24280  <b>Submitter:</b> Chris Jefferson <b>Date:</b> 2006-11-10</p>
24281 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#numeric.limits.members">issues</a> in [numeric.limits.members].</p>
24282 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24283 <p><b>Discussion:</b></p>
24284 <p>
24285 18.2.1.2 55 states that "A type is modulo if it is possible to add two
24286 positive numbers together and have a result that wraps around to a
24287 third number that is less".
24288 This seems insufficient for the following reasons:
24289 </p>
24290
24291 <ol>
24292 <li>Doesn't define what that value received is.</li>
24293 <li>Doesn't state the result is repeatable</li>
24294 <li> Doesn't require that doing addition, subtraction and other
24295 operations on all values is defined behaviour.</li>
24296 </ol>
24297
24298 <p><i>[
24299 Batavia: Related to
24300 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2144.pdf">N2144</a>.
24301 Pete: is there an ISO definition of modulo?  Underflow on signed behavior is undefined.
24302 ]</i></p>
24303
24304
24305 <p><i>[
24306 Bellevue:  accept resolution, move to ready status.
24307 Does this mandate that is_modulo be true on platforms for which int
24308 happens to b modulo? A: the standard already seems to require that.
24309 ]</i></p>
24310
24311
24312
24313 <p><b>Proposed resolution:</b></p>
24314 <p>
24315 Suggest 18.2.1.2 [numeric.limits.members], paragraph 57 is amended to:
24316 </p>
24317
24318 <blockquote><p>
24319 A type is modulo if<ins>,</ins> <del>it is possible to add two positive numbers
24320 and have a result that wraps around to a third number that is less.</del>
24321 <ins>given any operation involving +,- or * on values of that type whose value
24322 would fall outside the range <tt>[min(), max()]</tt>, then the value returned
24323 differs from the true value by an integer multiple of <tt>(max() - min() +
24324 1)</tt>.</ins>
24325 </p></blockquote>
24326
24327
24328
24329
24330
24331
24332 <hr>
24333 <h3><a name="613"></a>613. max_digits10 missing from numeric_limits</h3>
24334 <p><b>Section:</b> 18.2.1.5 [numeric.special] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24335  <b>Submitter:</b> Bo Persson <b>Date:</b> 2006-11-20</p>
24336 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#numeric.special">issues</a> in [numeric.special].</p>
24337 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24338 <p><b>Discussion:</b></p>
24339 <p>
24340 Section 18.2.1.5 [numeric.special] starts out by saying that "All members shall be provided 
24341 for all specializations."
24342 </p>
24343 <p>
24344 Then it goes on to show specializations for float and bool, where one member 
24345 is missing (max_digits10).
24346 </p>
24347
24348 <p>
24349 Maarten Kronenburg adds:
24350 </p>
24351
24352 <p>
24353 I agree, just adding the comment that the exact number of decimal digits
24354 is digits * ln(radix) / ln(10), where probably this real number is
24355 rounded downward for digits10, and rounded upward for max_digits10
24356 (when radix=10, then digits10=max_digits10).
24357 Why not add this exact definition also to the standard, so the user
24358 knows what these numbers exactly mean.
24359 </p>
24360
24361 <p>
24362 Howard adds:
24363 </p>
24364
24365 <p>
24366 For reference, here are the correct formulas from
24367 <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf">N1822</a>:
24368 </p>
24369
24370 <blockquote><pre>digits10 = floor((digits-1) * log10(2))
24371 max_digits10 = ceil((1 + digits) * log10(2))
24372 </pre></blockquote>
24373
24374 <p>
24375 We are also missing a statement regarding for what specializations this member has meaning.
24376 </p>
24377
24378
24379
24380 <p><b>Proposed resolution:</b></p>
24381 <p>
24382 Change and add after 18.2.1.2 [numeric.limits.members], p11:
24383 </p>
24384
24385 <blockquote>
24386 <pre>static const int max_digits10;</pre>
24387 <blockquote>
24388 <p>
24389 -11- Number of base 10 digits required to ensure that values which
24390 differ <del>by only one epsilon</del> are always differentiated.
24391 </p>
24392 <p><ins>
24393 -12- Meaningful for all floating point types.
24394 </ins></p>
24395 </blockquote>
24396 </blockquote>
24397
24398 <p>
24399 Change 18.2.1.5 [numeric.special], p2:
24400 </p>
24401
24402 <blockquote><pre>template&lt;&gt; class numeric_limits&lt;float&gt; { 
24403 public: 
24404   static const bool is_specialized = true; 
24405   ...
24406   static const int digits10 = 6;
24407   <ins>static const int max_digits10 = 9</ins>;
24408   ...
24409 </pre></blockquote>
24410
24411 <p>
24412 Change 18.2.1.5 [numeric.special], p3:
24413 </p>
24414
24415 <blockquote><pre>template&lt;&gt; class numeric_limits&lt;bool&gt; { 
24416 public: 
24417   static const bool is_specialized = true; 
24418   ...
24419   static const int digits10 = 0;
24420   <ins>static const int max_digits10 = 0</ins>;
24421   ...
24422 </pre></blockquote>
24423
24424
24425
24426
24427
24428
24429
24430 <hr>
24431 <h3><a name="616"></a>616. missing 'typename' in ctype_byname</h3>
24432 <p><b>Section:</b> 22.2.1.2 [locale.ctype.byname] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24433  <b>Submitter:</b> Bo Persson <b>Date:</b> 2006-12-16</p>
24434 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.ctype.byname">issues</a> in [locale.ctype.byname].</p>
24435 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24436 <p><b>Discussion:</b></p>
24437 <p>
24438 Section 22.2.1.2 defines the ctype_byname class template. It contains the 
24439 line
24440 </p>
24441
24442 <blockquote><pre>typedef ctype&lt;charT&gt;::mask   mask;
24443 </pre></blockquote>
24444
24445
24446
24447 <p><b>Proposed resolution:</b></p>
24448 <p>
24449 as this is a dependent type, it should obviously be
24450 </p>
24451
24452 <blockquote><pre>typedef <ins>typename</ins> ctype&lt;charT&gt;::mask   mask;
24453 </pre></blockquote>
24454
24455
24456
24457
24458
24459 <hr>
24460 <h3><a name="618"></a>618. valarray::cshift() effects on empty array</h3>
24461 <p><b>Section:</b> 26.5.2.7 [valarray.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24462  <b>Submitter:</b> Gabriel Dos Reis <b>Date:</b> 2007-01-10</p>
24463 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24464 <p><b>Discussion:</b></p>
24465 <p>
24466 I would respectfully request an issue be opened with the intention to
24467 clarify the wording for <tt>size() == 0</tt> for <tt>cshift</tt>.
24468 </p>
24469
24470
24471 <p><b>Proposed resolution:</b></p>
24472 <p>
24473 Change 26.5.2.7 [valarray.members], paragraph 10:
24474 </p>
24475
24476 <blockquote>
24477
24478 <pre>valarray&lt;T&gt; cshift(int <i>n</i>) const;
24479 </pre>
24480
24481 <blockquote>
24482 <p>
24483 This function returns an object of class <tt>valarray&lt;T&gt;</tt>, of
24484 length <tt>size()</tt>, <del>each of whose elements <tt>I</tt> is
24485 <tt>(*this)[(I + n ) % size()]</tt>. Thus, if element zero is taken as
24486 the leftmost element, a positive value of <i>n</i> shifts the elements
24487 circularly left <i>n</i> places.</del> <ins>that is a circular shift of <tt>*this</tt>. If
24488 element zero is taken as the leftmost element, a non-negative value of
24489 <i>n</i> shifts the elements circularly left <i>n</i> places and a
24490 negative value of <i>n</i> shifts the elements circularly right
24491 -<i>n</i> places.</ins>
24492 </p>
24493 </blockquote>
24494 </blockquote>
24495
24496
24497
24498 <p><b>Rationale:</b></p>
24499 <p>
24500 We do not believe that there is any real ambiguity about what happens
24501 when <tt>size() == 0</tt>, but we do believe that spelling this out as a C++
24502 expression causes more trouble that it solves. The expression is
24503 certainly wrong when <tt>n &lt; 0</tt>, since the sign of % with negative arguments
24504 is implementation defined.
24505 </p>
24506
24507
24508 <p><i>[
24509 Kona (2007) Changed proposed wording, added rationale and set to Review.
24510 ]</i></p>
24511
24512
24513
24514
24515
24516 <hr>
24517 <h3><a name="619"></a>619. Longjmp wording problem</h3>
24518 <p><b>Section:</b> 18.9 [support.runtime] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24519  <b>Submitter:</b> Lawrence Crowl <b>Date:</b> 2007-01-12</p>
24520 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24521 <p><b>Discussion:</b></p>
24522 <p>
24523 The wording for <tt>longjmp</tt> is confusing.
24524 </p>
24525 <p>
24526 18.9 [support.runtime] -4- Other runtime support
24527 </p>
24528 <blockquote><p>
24529 The function signature <tt>longjmp(jmp_buf jbuf, int val)</tt> has more restricted
24530 behavior in this International Standard.  If any automatic objects would
24531 be destroyed by a thrown exception transferring control to another
24532 (destination) point in the program, then a call to <tt>longjmp(jbuf, val)</tt> that
24533 the throw point that transfers control to the same (destination) point has
24534 undefined behavior.
24535 </p></blockquote>
24536 <p>
24537 Someone at Google thinks that should say "then a call to <tt>longjmp(jbuf, val)</tt>
24538 *at* the throw point that transfers control".
24539 </p>
24540 <p>
24541 Bill Gibbons thinks it should say something like "If any automatic objects
24542 would be destroyed by an exception thrown at the point of the longjmp and
24543 caught only at the point of the setjmp, the behavior is undefined."
24544 </p>
24545
24546
24547 <p><b>Proposed resolution:</b></p>
24548 <p>
24549 In general, accept Bill Gibbons' recommendation,
24550 but add "call" to indicate that the undefined behavior
24551 comes from the dynamic call, not from its presence in the code.
24552 In 18.9 [support.runtime] paragraph 4, change
24553 </p>
24554
24555 <blockquote><p>
24556 The function signature <tt>longjmp(jmp_buf jbuf, int val)</tt> has more
24557 restricted behavior in this International Standard.  <del>If any automatic
24558 objects would be destroyed by a thrown exception transferring control to another
24559 (destination) point in the program, then a call to <tt>longjmp(jbuf, val)</tt>
24560 that the throw point that transfers control to the same (destination) point has
24561 undefined behavior.</del> <ins>A <tt>setjmp</tt>/<tt>longjmp</tt> call pair has
24562 undefined behavior if replacing the <tt>setjmp</tt> and <tt>longjmp</tt> by
24563 <tt>catch</tt> and <tt>throw</tt> would destroy any automatic objects.</ins>
24564 </p></blockquote>
24565
24566
24567
24568
24569
24570 <hr>
24571 <h3><a name="620"></a>620. valid uses of empty valarrays</h3>
24572 <p><b>Section:</b> 26.5.2.1 [valarray.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24573  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-01-20</p>
24574 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#valarray.cons">active issues</a> in [valarray.cons].</p>
24575 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#valarray.cons">issues</a> in [valarray.cons].</p>
24576 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24577 <p><b>Discussion:</b></p>
24578         <p>
24579
24580 The <i>Effects</i>  clause for the  default <code>valarray</code> ctor
24581 suggests  that  it  is possible  to  increase  the  size of  an  empty
24582 <code>valarray</code>  object   by  calling  other   non-const  member
24583 functions of the class besides <code>resize()</code>. However, such an
24584 interpretation would  be contradicted by  the requirement on  the copy
24585 assignment  operator  (and  apparently   also  that  on  the  computed
24586 assignments)  that the  assigned arrays  be  the same  size.  See  the
24587 reflector discussion starting with c++std-lib-17871.
24588
24589         </p>
24590         <p>
24591
24592 In  addition,  <i>Footnote</i> 280  uses  some questionable  normative
24593 language.
24594
24595         </p>
24596
24597
24598 <p><b>Proposed resolution:</b></p>
24599         <p>
24600
24601 Reword the <i>Effects</i> clause and <i>Footnote 280</i> as follows (26.5.2.1 [valarray.cons]):
24602
24603         </p>
24604         <blockquote>
24605             <p>
24606
24607 <code>valarray();</code>
24608
24609             </p>
24610             <p>
24611
24612 <i>Effects</i>:      Constructs      an      object      of      class
24613 <code>valarray&lt;T&gt;</code>,<sup>279)</sup>    which    has    zero
24614 length<del> until it is passed into a library function as a modifiable
24615 lvalue or through a non-constant this pointer</del>.<sup>280)</sup>
24616
24617             </p>
24618             <p>
24619
24620 <ins><i>Postcondition</i>: <code>size() == 0</code>.</ins>
24621
24622             </p>
24623             <p>
24624
24625 <i>Footnote  280</i>:  This default  constructor  is essential,  since
24626 arrays  of  <code>valarray</code>  <del>are  likely to  prove  useful.
24627 There  shall also  be  a way  to change  the  size of  an array  after
24628 initialization;  this  is  supplied  by the  semantics</del>  <ins>may be
24629 useful.   The  length  of  an  empty  array  can  be  increased  after
24630 initialization  by  means</ins>  of the  <code>resize()</code>  member
24631 function.
24632
24633             </p>
24634         </blockquote>
24635
24636
24637
24638
24639
24640 <hr>
24641 <h3><a name="621"></a>621. non-const copy assignment operators of helper arrays</h3>
24642 <p><b>Section:</b> 26.5 [numarray] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24643  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-01-20</p>
24644 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#numarray">issues</a> in [numarray].</p>
24645 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24646 <p><b>Discussion:</b></p>
24647         <p>
24648
24649 The computed and  "fill" assignment operators of <code>valarray</code>
24650 helper     array     class    templates     (<code>slice_array</code>,
24651 <code>gslice_array</code>,         <code>mask_array</code>,        and
24652 <code>indirect_array</code>) are const  member functions of each class
24653 template     (the     latter    by     the     resolution    of  <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#123">123</a>
24654 since  they have reference  semantics and thus do  not affect
24655 the state of  the object on which they are  called.  However, the copy
24656 assignment  operators  of  these  class  templates,  which  also  have
24657 reference semantics,  are non-const.   The absence of  constness opens
24658 the door to speculation about whether they really are intended to have
24659 reference semantics (existing implementations vary widely).
24660
24661         </p>
24662
24663 <p>
24664 Pre-Kona, Martin adds:
24665 </p>
24666
24667 <p>
24668 I realized that adding the const qualifier to the
24669 functions as I suggested would break the const correctness of the
24670 classes. A few possible solutions come to mind:
24671 </p>
24672
24673 <ol>
24674 <li>Add the const qualifier to the return types of these functions.</li>
24675 <li>Change the return type of all the functions to void to match
24676 the signatures of all the other assignment operators these classes
24677 define.</li>
24678 <li>Prohibit the copy assignment of these classes by declaring the
24679 copy assignment operators private (as is done and documented by
24680 some implementations).</li>
24681 </ol>
24682
24683
24684
24685 <p><b>Proposed resolution:</b></p>
24686         <p>
24687
24688 Declare  the  copy  assignment  operators  of all  four  helper  array
24689 class templates const.
24690
24691         </p>
24692         <p>
24693
24694 Specifically,  make the following edits:
24695
24696         </p>
24697         <p>
24698
24699 Change     the    signature     in     26.5.5 [template.slice.array]    and
24700 26.5.5.1 [slice.arr.assign] as follows:
24701
24702         </p>
24703         <blockquote><pre>
24704 <code><ins>const</ins> slice_array&amp; operator= (const slice_array&amp;)<ins> const</ins>;</code>
24705
24706         </pre></blockquote>
24707         <p>
24708
24709 Change     the     signature     in    26.5.7 [template.gslice.array]     and
24710 26.5.7.1 [gslice.array.assign] as follows:
24711
24712         </p>
24713         <blockquote><pre>
24714 <code><ins>const</ins> gslice_array&amp; operator= (const gslice_array&amp;)<ins> const</ins>;</code>
24715
24716         </pre></blockquote>
24717         <p>
24718
24719 Change the  signature in 26.5.8 [template.mask.array]  and 26.5.8.1 [mask.array.assign] as
24720 follows:
24721
24722         </p>
24723         <blockquote><pre>
24724 <code><ins>const</ins> mask_array&amp; operator= (const mask_array&amp;)<ins> const</ins>;</code>
24725
24726         </pre></blockquote>
24727         <p>
24728
24729 Change     the     signature     in    26.5.9 [template.indirect.array] and
24730 26.5.9.1 [indirect.array.assign] as follows:
24731
24732         </p>
24733         <blockquote><pre>
24734 <code><ins>const</ins> indirect_array&amp; operator= (const indirect_array&amp;)<ins> const</ins>;</code>
24735
24736         </pre></blockquote>
24737
24738
24739 <p><i>[
24740 Kona (2007) Added const qualification to the return types and set to Ready.
24741 ]</i></p>
24742
24743
24744
24745
24746
24747 <hr>
24748 <h3><a name="622"></a>622. behavior of <code>filebuf</code> dtor and <code>close</code> on error</h3>
24749 <p><b>Section:</b> 27.8.1.17 [fstream.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24750  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-01-20</p>
24751 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24752 <p><b>Discussion:</b></p>
24753         <p>
24754
24755 <code>basic_filebuf</code>  dtor is  specified to  have  the following
24756 straightforward effects:
24757
24758         </p>
24759         <blockquote><p>
24760
24761 <i>Effects</i>:       Destroys      an      object       of      class
24762 <code>basic_filebuf</code>. Calls <code>close()</code>.
24763
24764         </p></blockquote>
24765         <p>
24766
24767 <code>close()</code> does a lot of potentially complicated processing,
24768 including calling <code>overflow()</code> to write out the termination
24769 sequence  (to   bring  the  output  sequence  to   its  initial  shift
24770 state). Since  any of the  functions called during the  processing can
24771 throw an exception, what should the  effects of an exception be on the
24772 dtor? Should the  dtor catch and swallow it or  should it propagate it
24773 to the caller?  The text doesn't  seem to provide any guidance in this
24774 regard  other  than  the  general  restriction on  throwing  (but  not
24775 propagating)  exceptions  from   destructors  of  library  classes  in
24776 17.4.4.9 [res.on.exception.handling].
24777
24778         </p>
24779         <p>
24780
24781 Further,  the last thing  <code>close()</code> is  specified to  do is
24782 call <code>fclose()</code> to close the <code>FILE</code> pointer. The
24783 last sentence of the <i>Effects</i> clause reads:
24784
24785         </p>
24786         <blockquote><p>
24787
24788 ...   If    any   of    the   calls   to    <code>overflow</code>   or
24789 <code>std::fclose</code> fails then <code>close</code> fails.
24790
24791         </p></blockquote>
24792         <p>
24793
24794 This  suggests that  <code>close()</code>  might be  required to  call
24795 <code>fclose()</code>   if  and  only   if  none   of  the   calls  to
24796 <code>overflow()</code> fails, and avoid closing the <code>FILE</code>
24797 otherwise. This  way, if  <code>overflow()</code> failed to  flush out
24798 the data, the caller  would have  the opportunity to  try to  flush it
24799 again (perhaps  after trying  to deal with  whatever problem  may have
24800 caused the failure), rather than losing it outright.
24801
24802         </p>
24803         <p>
24804
24805 On the other hand,  the function's <i>Postcondition</i> specifies that
24806 <code>is_open() ==  false</code>, which  suggests that it  should call
24807 <code>fclose()</code>       unconditionally.       However,      since
24808 <i>Postcondition</i> clauses  are specified for many  functions in the
24809 standard,  including constructors  where they  obviously  cannot apply
24810 after an  exception, it's not clear  whether this <i>Postcondition</i>
24811 clause is intended to apply even after an exception.
24812
24813         </p>
24814         <p>
24815
24816 It  might  be worth  noting  that  the  traditional behavior  (Classic
24817 Iostreams  <code>fstream::close()</code> and  C <code>fclose()</code>)
24818 is  to  close  the  <code>FILE</code> unconditionally,  regardless  of
24819 errors.
24820
24821         </p>
24822
24823 <p><i>[
24824 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#397">397</a> and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#418">418</a> for related issues.
24825 ]</i></p>
24826
24827
24828
24829
24830 <p><b>Proposed resolution:</b></p>
24831         <p>
24832
24833 After discussing this  on the reflector (see the  thread starting with
24834 c++std-lib-17650) we propose that <code>close()</code> be clarified to
24835 match the traditional behavior, that is to close the <code>FILE</code>
24836 unconditionally,  even after  errors or  exceptions.  In  addition, we
24837 propose the dtor description be amended so as to explicitly require it
24838 to catch and swallow any exceptions thrown by <code>close()</code>.
24839
24840         </p>
24841         <p>
24842
24843 Specifically,   we   propose   to   make  the   following   edits   in
24844 27.8.1.4 [filebuf.members]:
24845
24846         </p>
24847         <blockquote>
24848             <pre>
24849 <code>basic_filebuf&lt;charT,traits&gt;* close();</code>
24850
24851             </pre>
24852             <p>
24853
24854 <i>Effects</i>:  If <code>is_open()  == false</code>,  returns  a null
24855 pointer.        If      a       put      area       exists,      calls
24856 <code>overflow(traits::eof())</code> to flush  characters. If the last
24857 virtual   member  function   called  on   <code>*this</code>  (between
24858 <code>underflow</code>,  <code>overflow</code>,  <code>seekoff</code>,
24859 and   <code>seekpos</code>)  was   <code>overflow</code>   then  calls
24860 <code>a_codecvt.unshift</code> (possibly several times) to determine a
24861 termination   sequence,    inserts   those   characters    and   calls
24862 <code>overflow(traits::eof())</code>  again.  Finally<ins>, regardless
24863 of whether  any of the preceding  calls fails or  throws an exception,
24864 the  function</ins> <del>it</del>  closes   the  file   ("as   if"  by   calling
24865 <code>std::fclose(file)</code>).<sup>334)</sup>  If any  of  the calls
24866 <ins>made    by   the    function</ins><del>to   <code>overflow</code>
24867 or</del><ins>,  including  </ins><code>std::fclose</code><ins>, </ins>
24868 fails then <code>close</code> fails<ins>  by returning a null pointer.
24869 If one of these calls throws an exception, the exception is caught and
24870 rethrown after closing the file.</ins>
24871
24872             </p>
24873         </blockquote>
24874         <p>
24875
24876 And to make the following edits in 27.8.1.2 [filebuf.cons].
24877
24878         </p>
24879         <blockquote>
24880             <pre>
24881 <code>virtual ~basic_filebuf();</code>
24882
24883             </pre>
24884             <p>
24885
24886 <i>Effects</i>:       Destroys      an      object       of      class
24887 <code>basic_filebuf&lt;charT,traits&gt;</code>.                   Calls
24888 <code>close()</code>.    <ins>If  an   exception  occurs   during  the
24889 destruction of the object, including the call to <code>close()</code>,
24890 the     exception    is     caught    but     not     rethrown    (see
24891 17.4.4.9 [res.on.exception.handling]).</ins>
24892
24893             </p>
24894         </blockquote>
24895
24896
24897
24898
24899
24900 <hr>
24901 <h3><a name="623"></a>623. <code>pubimbue</code> forbidden to call <code>imbue</code></h3>
24902 <p><b>Section:</b> 27.1.1 [iostream.limits.imbue] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24903  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-01-20</p>
24904 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24905 <p><b>Discussion:</b></p>
24906         <p>
24907
24908 27.1.1 [iostream.limits.imbue]  specifies  that  "no  function  described  in
24909 clause 27 except  for <code>ios_base::imbue</code> causes any instance
24910 of                   <code>basic_ios::imbue</code>                  or
24911 <code>basic_streambuf::imbue</code> to be called."
24912
24913         </p>
24914         <p>
24915
24916 That      contradicts      the      <i>Effects</i>     clause      for
24917 <code>basic_streambuf::pubimbue()</code>  which requires  the function
24918 to do just that: call <code>basic_streambuf::imbue()</code>.
24919
24920         </p>
24921
24922
24923 <p><b>Proposed resolution:</b></p>
24924         <p>
24925
24926 To    fix   this,    rephrase    the   sentence    above   to    allow
24927 <code>pubimbue</code> to do what  it was designed to do. Specifically.
24928 change 27.1.1 [iostream.limits.imbue], p1 to read:
24929
24930         </p>
24931         <blockquote><p>
24932
24933 No     function    described     in    clause     27     except    for
24934 <code>ios_base::imbue</code>  <ins>and <code>basic_filebuf::pubimbue</code></ins>
24935 causes    any    instance    of    <code>basic_ios::imbue</code>    or
24936 <code>basic_streambuf::imbue</code> to be called. ...
24937
24938         </p></blockquote>
24939
24940
24941
24942
24943
24944 <hr>
24945 <h3><a name="624"></a>624. <code>valarray</code> assignment and arrays of unequal length</h3>
24946 <p><b>Section:</b> 26.5.2.2 [valarray.assign] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
24947  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-01-20</p>
24948 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
24949 <p><b>Discussion:</b></p>
24950         <p>
24951
24952 The behavior of the  <code>valarray</code> copy assignment operator is
24953 defined only when both sides have  the same number of elements and the
24954 spec is explicit about assignments of arrays of unequal lengths having
24955 undefined behavior.
24956
24957         </p>
24958         <p>
24959
24960 However, the generalized  subscripting assignment operators overloaded
24961 on <code>slice_array</code>  et al (26.5.2.2 [valarray.assign])  don't have any
24962 such restriction, leading  the reader to believe that  the behavior of
24963 these  overloads is  well defined  regardless  of the  lengths of  the
24964 arguments.
24965
24966         </p>
24967         <p>
24968
24969 For example,  based on  the reading  of the spec  the behavior  of the
24970 snippet below can be expected to be well-defined:
24971
24972         </p>
24973         <pre>    const std::slice from_0_to_3 (0, 3, 1);   // refers to elements 0, 1, 2
24974     const std::valarray&lt;int&gt; a (1, 3);        // a = { 1, 1, 1 }
24975     std::valarray&lt;int&gt;       b (2, 4);        // b = { 2, 2, 2, 2 }
24976
24977     b = a [from_0_to_3];
24978         </pre>
24979         <p>
24980
24981 In practice, <code>b</code> may end up being <code>{ 1, 1, 1 }</code>,
24982 <code>{  1,  1, 1,  2  }</code>,  or  anything else,  indicating  that
24983 existing implementations vary.
24984
24985         </p>
24986
24987 <p>
24988 Quoting from Section 3.4, Assignment operators, of Al Vermeulen's
24989 Proposal for Standard C++ Array Classes (see c++std-lib-704;
24990 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/1993/N0308.asc">N0308</a>):
24991 </p>
24992 <blockquote><p>
24993   ...if the size of the array on the right hand side of the equal
24994   sign differs from the size of the array on the left, a run time
24995   error occurs. How this error is handled is implementation
24996   dependent; for compilers which support it, throwing an exception
24997   would be reasonable.
24998 </p></blockquote>
24999
25000 <p>
25001 And see more history in
25002 <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/1993/N0280.pdf">N0280</a>.
25003 </p>
25004
25005         <p>
25006
25007 It has  been argued in  discussions on the committee's  reflector that
25008 the semantics of all <code>valarray</code> assignment operators should
25009 be permitted to be undefined unless  the  length  of the arrays  being
25010 assigned is the same as the length of the one being assigned from. See
25011 the thread starting at c++std-lib-17786.
25012
25013         </p>
25014         <p>
25015
25016 In order  to reflect  such views, the  standard must specify  that the
25017 size of the  array referred to by the argument  of the assignment must
25018 match the size of the array  under assignment, for example by adding a
25019 <i>Requires</i> clause to 26.5.2.2 [valarray.assign] as follows:
25020
25021         </p>
25022         <blockquote><p>
25023
25024 <i>Requires</i>: The length of the  array to which the argument refers
25025 equals <code>size()</code>.
25026
25027         </p></blockquote>
25028
25029         <p>
25030
25031 Note that it's  far from clear that such leeway  is necessary in order
25032 to implement <code>valarray</code> efficiently.
25033
25034         </p>
25035
25036
25037 <p><b>Proposed resolution:</b></p>
25038 <p>
25039 Insert new paragraph into 26.5.2.2 [valarray.assign]:
25040 </p>
25041
25042 <blockquote>
25043 <pre>valarray&lt;T&gt;&amp; operator=(const slice_array&lt;T&gt;&amp;); 
25044 valarray&lt;T&gt;&amp; operator=(const gslice_array&lt;T&gt;&amp;); 
25045 valarray&lt;T&gt;&amp; operator=(const mask_array&lt;T&gt;&amp;); 
25046 valarray&lt;T&gt;&amp; operator=(const indirect_array&lt;T&gt;&amp;);
25047 </pre>
25048 <blockquote>
25049 <p><ins>
25050 <i>Requires</i>: The length of the  array to which the argument refers
25051 equals <code>size()</code>.
25052 </ins></p>
25053 <p>
25054 These operators allow the results of a generalized subscripting operation to be assigned directly to a <tt>valarray</tt>.
25055 </p>
25056 </blockquote>
25057 </blockquote>
25058
25059
25060
25061
25062
25063 <hr>
25064 <h3><a name="628"></a>628. Inconsistent definition of basic_regex constructor</h3>
25065 <p><b>Section:</b> 28.8 [re.regex] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25066  <b>Submitter:</b> Bo Persson <b>Date:</b> 2007-01-23</p>
25067 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#re.regex">issues</a> in [re.regex].</p>
25068 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25069 <p><b>Discussion:</b></p>
25070 <p>
25071 Section 28.8 [re.regex] lists a constructor
25072 </p>
25073
25074 <blockquote><pre>template&lt;class InputIterator&gt;
25075 basic_regex(InputIterator first, InputIterator last,
25076                        flag_type f = regex_constants::ECMAScript);
25077 </pre></blockquote>
25078
25079 <p>
25080 However, in section 28.8.2 [re.regex.construct], this constructor takes a 
25081 pair of <tt>ForwardIterator</tt>.
25082 </p>
25083
25084
25085 <p><b>Proposed resolution:</b></p>
25086 <p>
25087 Change 28.8.2 [re.regex.construct]:
25088 </p>
25089
25090 <blockquote><pre>template &lt;class <del>ForwardIterator</del> <ins>InputIterator</ins>&gt;
25091   basic_regex(<del>ForwardIterator</del> <ins>InputIterator</ins> first, <del>ForwardIterator</del> <ins>InputIterator</ins> last, 
25092               flag_type f = regex_constants::ECMAScript);
25093 </pre></blockquote>
25094
25095
25096
25097
25098
25099
25100 <hr>
25101 <h3><a name="634"></a>634. <tt>allocator.address()</tt> doesn't work for types overloading <tt>operator&amp;</tt></h3>
25102 <p><b>Section:</b> 20.7.5.1 [allocator.members] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25103  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2007-02-07</p>
25104 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#allocator.members">issues</a> in [allocator.members].</p>
25105 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25106 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#350">350</a></p>
25107 <p><b>Discussion:</b></p>
25108
25109 <p>
25110 20.7.5.1 [allocator.members] says:
25111 </p>
25112 <blockquote>
25113 <pre>pointer address(reference <i>x</i>) const;</pre>
25114 <blockquote>
25115 <p>
25116 -1- <i>Returns:</i> <tt>&amp;<i>x</i></tt>.
25117 </p>
25118 </blockquote>
25119 </blockquote>
25120
25121 <p>
25122 20.7.5.1 [allocator.members] defines <tt>CopyConstructible</tt> which currently not
25123 only defines the semantics of copy construction, but also restricts what an overloaded
25124 <tt>operator&amp;</tt> may do.  I believe proposals are in the works (such as concepts
25125 and rvalue reference) to decouple these two requirements.  Indeed it is not evident
25126 that we should disallow overloading <tt>operator&amp;</tt> to return something other
25127 than the address of <tt>*this</tt>.
25128 </p>
25129
25130 <p>
25131 An example of when you want to overload <tt>operator&amp;</tt> to return something
25132 other than the object's address is proxy references such as <tt>vector&lt;bool&gt;</tt>
25133 (or its replacement, currently code-named <tt>bit_vector</tt>).  Taking the address of
25134 such a proxy reference should logically yield a proxy pointer, which when dereferenced,
25135 yields a copy of the original proxy reference again.
25136 </p>
25137
25138 <p>
25139 On the other hand, some code truly needs the address of an object, and not a proxy
25140 (typically for determining the identity of an object compared to a reference object).
25141 <a href="http://www.boost.org/">boost</a> has long recognized this dilemma and solved it with 
25142 <a href="http://www.boost.org/libs/utility/utility.htm#addressof"><tt>boost::addressof</tt></a>.
25143 It appears to me that this would be useful functionality for the default allocator.  Adopting
25144 this definition for <tt>allocator::address</tt> would free the standard of requiring
25145 anything special from types which overload <tt>operator&amp;</tt>.  Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#580">580</a>
25146 is expected to make use of <tt>allocator::address</tt> mandatory for containers.
25147 </p>
25148
25149
25150
25151 <p><b>Proposed resolution:</b></p>
25152 <p>
25153 Change 20.7.5.1 [allocator.members]:
25154 </p>
25155
25156 <blockquote>
25157 <pre>pointer address(reference <i>x</i>) const;</pre>
25158 <blockquote>
25159 <p>
25160 -1- <i>Returns:</i> <del><tt>&amp;<i>x</i></tt>.</del> <ins>The actual address of object referenced by <i>x</i>,
25161 even in the presence of an overloaded <tt>operator&amp;</tt>.</ins>
25162 </p>
25163 </blockquote>
25164
25165 <pre>const_pointer address(address(const_reference <i>x</i>) const;</pre>
25166 <blockquote>
25167 <p>
25168 -2- <i>Returns:</i> <del><tt>&amp;<i>x</i></tt>.</del> <ins>The actual address of object referenced by <i>x</i>,
25169 even in the presence of an overloaded <tt>operator&amp;</tt>.</ins>
25170 </p>
25171 </blockquote>
25172 </blockquote>
25173
25174 <p><i>[
25175 post Oxford:  This would be rendered NAD Editorial by acceptance of
25176 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2257.html">N2257</a>.
25177 ]</i></p>
25178
25179
25180 <p><i>[
25181 Kona (2007): The LWG adopted the proposed resolution of N2387 for this issue which
25182 was subsequently split out into a separate paper N2436 for the purposes of voting.
25183 The resolution in N2436 addresses this issue.  The LWG voted to accelerate this
25184 issue to Ready status to be voted into the WP at Kona.
25185 ]</i></p>
25186
25187
25188
25189
25190
25191
25192
25193 <hr>
25194 <h3><a name="638"></a>638. deque end invalidation during erase</h3>
25195 <p><b>Section:</b> 23.2.2.3 [deque.modifiers] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25196  <b>Submitter:</b> Steve LoBasso <b>Date:</b> 2007-02-17</p>
25197 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25198 <p><b>Discussion:</b></p>
25199 <p>
25200 The standard states at 23.2.2.3 [deque.modifiers]/4:
25201 </p>
25202 <blockquote><pre>deque erase(...)
25203 </pre>
25204  <p>
25205 <i>Effects:</i> ... An erase at either end of the deque invalidates only
25206 the iterators and the references to the erased elements.
25207 </p>
25208 </blockquote>
25209 <p>
25210 This does not state that iterators to end will be invalidated.
25211 It needs to be amended in such a way as to account for end invalidation.
25212 </p>
25213 <p>
25214 Something like:
25215 </p>
25216 <blockquote><p>
25217 Any time the last element is erased, iterators to end are invalidated.
25218 </p></blockquote>
25219
25220 <p>
25221 This would handle situations like:
25222 </p>
25223 <blockquote><pre>erase(begin(), end())
25224 erase(end() - 1)
25225 pop_back()
25226 resize(n, ...) where n &lt; size()
25227 pop_front() with size() == 1
25228
25229 </pre></blockquote>
25230
25231 <p><i>[
25232 Post Kona, Steve LoBasso notes:
25233 ]</i></p>
25234
25235
25236 <blockquote>
25237 My only issue with the proposed resolution is that it might not be clear
25238 that <tt>pop_front()</tt> [where <tt>size() == 1</tt>] can invalidate past-the-end
25239 iterators.
25240 </blockquote>
25241
25242
25243
25244 <p><b>Proposed resolution:</b></p>
25245 <p>
25246 Change 23.2.2.3 [deque.modifiers], p4:
25247 </p>
25248
25249 <blockquote>
25250 <pre>iterator erase(const_iterator position); 
25251 iterator erase(const_iterator first, const_iterator last);
25252 </pre>
25253
25254 <blockquote>
25255 <p>
25256 -4- <i>Effects:</i> An erase in the middle of the <tt>deque</tt>
25257 invalidates all the iterators and references to elements of the
25258 <tt>deque</tt> <ins>and the past-the-end iterator</ins>. An erase at
25259 either end of the <tt>deque</tt> invalidates only the iterators and the
25260 references to the erased elements<ins>, except that erasing at the end
25261 also invalidates the past-the-end iterator</ins>.
25262 </p>
25263 </blockquote>
25264 </blockquote>
25265
25266
25267
25268 <p><i>[
25269 Kona (2007): Proposed wording added and moved to Review.
25270 ]</i></p>
25271
25272
25273 <p><i>[
25274 Bellevue:
25275 ]</i></p>
25276
25277
25278 <blockquote>
25279 Note that there is existing code that relies on iterators not being
25280 invalidated, but there are also existing implementations that do
25281 invalidate iterators. Thus, such code is not portable in any case. There
25282 is a pop_front() note, which should possibly be a separate issue. Mike
25283 Spertus to evaluate and, if need be, file an issue.
25284 </blockquote>
25285
25286
25287
25288
25289 <hr>
25290 <h3><a name="640"></a>640. 27.6.2.5.2 does not handle (unsigned) long long</h3>
25291 <p><b>Section:</b> 27.6.2.6.2 [ostream.inserters.arithmetic] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25292  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-02-17</p>
25293 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#ostream.inserters.arithmetic">issues</a> in [ostream.inserters.arithmetic].</p>
25294 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25295 <p><b>Discussion:</b></p>
25296 <p>
25297 The arithmetic inserters are described in 27.6.2.6.2 [ostream.inserters.arithmetic].
25298 Although the section starts with a listing of the inserters including
25299 the new ones:
25300 </p>
25301
25302 <blockquote><pre>operator&lt;&lt;(long long val );
25303 operator&lt;&lt;(unsigned long long val );
25304 </pre></blockquote>
25305
25306 <p>
25307 the text in paragraph 1, which describes the corresponding effects
25308 of the inserters, depending on the actual type of val, does not
25309 handle the types <tt>long long</tt> and <tt>unsigned long long</tt>.
25310 </p>
25311
25312 <p><i>[
25313 Alisdair: In addition to the (unsigned) long long problem, that whole paragraph
25314 misses any reference to extended integral types supplied by the
25315 implementation - one of the additions by core a couple of working papers
25316 back.
25317 ]</i></p>
25318
25319
25320
25321
25322 <p><b>Proposed resolution:</b></p>
25323 <p>
25324 In 27.6.2.6.2 [ostream.inserters.arithmetic]/1 change the third sentence
25325 </p>
25326
25327 <blockquote>
25328 When val is of type <tt>bool</tt>, <tt>long</tt>, <tt>unsigned
25329 long</tt>, <ins>long long, unsigned long long,</ins> <tt>double</tt>,
25330 <tt>long double</tt>, or <tt>const void*</tt>, the formatting conversion
25331 occurs as if it performed the following code fragment:
25332 </blockquote>
25333
25334
25335
25336
25337
25338 <hr>
25339 <h3><a name="643"></a>643. Impossible "as if" clauses</h3>
25340 <p><b>Section:</b> 27.8.1.1 [filebuf], 22.2.2.2.2 [facet.num.put.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25341  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-02-20</p>
25342 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25343 <p><b>Discussion:</b></p>
25344 <p>
25345 The current standard 14882:2003(E) as well as N2134 have the
25346 following
25347 defects:
25348 </p>
25349
25350 <p>
25351 27.8.1.1 [filebuf]/5 says:
25352 </p>
25353
25354 <blockquote>
25355 <p>
25356 In order to support file I/O and multibyte/wide character conversion, conversions are performed using members of a 
25357 facet, referred to as <tt><i>a_codecvt</i></tt> in following sections, obtained "as if" by
25358 </p>
25359 <blockquote><pre>codecvt&lt;charT,char,typename traits::state_type&gt; <i>a_codecvt</i> =
25360   use_facet&lt;codecvt&lt;charT,char,typename traits::state_type&gt; &gt;(getloc());
25361 </pre></blockquote>
25362 </blockquote>
25363
25364 <p>
25365 <tt>use_facet</tt> returns a <tt>const facet</tt> reference and no facet is
25366 copyconstructible, so the codecvt construction should fail to compile.
25367 </p>
25368
25369 <p>
25370 A similar issue arises in 22.2.2.2.2 [facet.num.put.virtuals]/15 for <tt>num_punct</tt>.
25371 </p>
25372
25373
25374 <p><b>Proposed resolution:</b></p>
25375 <p>
25376 In 27.8.1.1 [filebuf]/5 change the "as if" code
25377 </p>
25378
25379 <blockquote><pre><ins>const </ins>codecvt&lt;charT,char,typename traits::state_type&gt;<ins>&amp;</ins> <i>a_codecvt</i> =
25380   use_facet&lt;codecvt&lt;charT,char,typename traits::state_type&gt; &gt;(getloc());
25381 </pre></blockquote>
25382
25383 <p>
25384 In 22.2.2.2.2 [facet.num.put.virtuals]/15 (This is para 5 in N2134) change
25385 </p>
25386
25387 <blockquote>
25388 <p>
25389 A local variable <tt><i>punct</i></tt> is initialized via
25390 </p>
25391 <blockquote><pre><ins>const </ins>numpunct&lt;charT&gt;<ins>&amp;</ins> <i>punct</i> = use_facet&lt; numpunct&lt;charT&gt; &gt;(<i>str</i>.getloc() )<ins>;</ins>
25392 </pre></blockquote>
25393 </blockquote>
25394
25395 <p>
25396 (Please note also the additional provided trailing semicolon)
25397 </p>
25398
25399
25400
25401
25402
25403
25404 <hr>
25405 <h3><a name="646"></a>646. const incorrect match_result members</h3>
25406 <p><b>Section:</b> 28.10.4 [re.results.form] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25407  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-02-26</p>
25408 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25409 <p><b>Discussion:</b></p>
25410 <p>
25411 28.10.4 [re.results.form] (root and para 3) in N2134 defines the two function template
25412 members format as non-const functions, although they are declared
25413 as const in 28.10 [re.results]/3.
25414 </p>
25415
25416
25417 <p><b>Proposed resolution:</b></p>
25418 <p>
25419 Add the missing <tt>const</tt> specifier to both <tt>format</tt> overloads described
25420 in section 28.10.4 [re.results.form].
25421 </p>
25422
25423
25424
25425
25426
25427 <hr>
25428 <h3><a name="650"></a>650. regex_token_iterator and const correctness</h3>
25429 <p><b>Section:</b> 28.12.2 [re.tokiter] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25430  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-03-05</p>
25431 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#re.tokiter">issues</a> in [re.tokiter].</p>
25432 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25433 <p><b>Discussion:</b></p>
25434 <p>
25435 Both the class definition of regex_token_iterator (28.12.2
25436 [re.tokiter]/6) and the latter member specifications (28.12.2.2
25437 [re.tokiter.comp]/1+2) declare both comparison operators as
25438 non-const functions. Furtheron, both dereference operators are
25439 unexpectedly also declared as non-const in 28.12.2 [re.tokiter]/6
25440 as well as in (28.12.2.3 [re.tokiter.deref]/1+2).
25441 </p>
25442
25443
25444 <p><b>Proposed resolution:</b></p>
25445 <p>
25446 1) In (28.12.2 [re.tokiter]/6) change the current declarations
25447 </p>
25448
25449 <blockquote><pre>bool operator==(const regex_token_iterator&amp;) <ins>const</ins>;
25450 bool operator!=(const regex_token_iterator&amp;) <ins>const</ins>;
25451 const value_type&amp; operator*() <ins>const</ins>;
25452 const value_type* operator-&gt;() <ins>const</ins>;
25453 </pre></blockquote>
25454
25455 <p>
25456 2) In 28.12.2.2 [re.tokiter.comp] change the following declarations
25457 </p>
25458
25459 <blockquote><pre>bool operator==(const regex_token_iterator&amp; right) <ins>const</ins>;
25460 bool operator!=(const regex_token_iterator&amp; right) <ins>const</ins>;
25461 </pre></blockquote>
25462
25463 <p>
25464 3) In 28.12.2.3 [re.tokiter.deref] change the following declarations
25465 </p>
25466
25467 <blockquote><pre>const value_type&amp; operator*() <ins>const</ins>;
25468 const value_type* operator-&gt;() <ins>const</ins>;
25469 </pre></blockquote>
25470
25471
25472 <p><i>[
25473 Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue (which
25474 is to adopt the proposed wording in this issue).
25475 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
25476 ]</i></p>
25477
25478
25479
25480
25481
25482 <hr>
25483 <h3><a name="651"></a>651. Missing preconditions for regex_token_iterator c'tors</h3>
25484 <p><b>Section:</b> 28.12.2.1 [re.tokiter.cnstr] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25485  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-03-05</p>
25486 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#re.tokiter.cnstr">issues</a> in [re.tokiter.cnstr].</p>
25487 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25488 <p><b>Discussion:</b></p>
25489 <p>
25490 The text provided in 28.12.2.1 [re.tokiter.cnstr]/2+3 describes
25491 the effects of the three non-default constructors of class
25492 template regex_token_iterator but is does not clarify which values
25493 are legal values for submatch/submatches. This becomes
25494 an issue, if one takes 28.12.2 [re.tokiter]/9 into account, which explains
25495 the notion of a "current match" by saying:
25496 </p>
25497
25498 <blockquote><p>
25499 The <i>current match</i> is <tt>(*position).prefix()</tt> if <tt>subs[N]
25500 == -1</tt>, or <tt>(*position)[subs[N]]</tt> for any other value of
25501 <tt>subs[N]</tt>.
25502 </p></blockquote>
25503
25504 <p>
25505 It's not clear to me, whether other negative values except -1
25506 are legal arguments or not - it seems they are not.
25507 </p>
25508
25509
25510 <p><b>Proposed resolution:</b></p>
25511 <p>
25512 Add the following precondition paragraph just before the current
25513 28.12.2.1 [re.tokiter.cnstr]/2:
25514 </p>
25515
25516 <blockquote><p>
25517 <i>Requires:</i> Each of the initialization values of <tt>subs</tt> must be <tt>&gt;= -1</tt>.
25518 </p></blockquote>
25519
25520
25521 <p><i>[
25522 Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue (which
25523 is to adopt the proposed wording in this issue).
25524 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
25525 ]</i></p>
25526
25527
25528
25529
25530
25531 <hr>
25532 <h3><a name="652"></a>652. regex_iterator and const correctness</h3>
25533 <p><b>Section:</b> 28.12.1 [re.regiter] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25534  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-03-05</p>
25535 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25536 <p><b>Discussion:</b></p>
25537 <p>Both the class definition of regex_iterator (28.12.1 [re.regiter]/1)
25538 and the latter member specification (28.12.1.2 [re.regiter.comp]/1+2)
25539 declare both comparison operators as
25540 non-const functions. Furtheron, both dereference operators are
25541 unexpectedly also declared as non-const in 28.12.1 [re.regiter]/1
25542 as well as in (28.12.1.3 [re.regiter.deref]/1+2).
25543 </p>
25544
25545
25546 <p><b>Proposed resolution:</b></p>
25547 <p>
25548 1) In (28.12.1 [re.regiter]/1) change the current declarations
25549 </p>
25550
25551 <blockquote><pre>bool operator==(const regex_iterator&amp;) <ins>const</ins>;
25552 bool operator!=(const regex_iterator&amp;) <ins>const</ins>;
25553 const value_type&amp; operator*() <ins>const</ins>;
25554 const value_type* operator-&gt;() <ins>const</ins>;
25555 </pre></blockquote>
25556
25557 <p>
25558 2) In 28.12.1.3 [re.regiter.deref] change the following declarations
25559 </p>
25560
25561 <blockquote><pre>const value_type&amp; operator*() <ins>const</ins>;
25562 const value_type* operator-&gt;() <ins>const</ins>;
25563 </pre></blockquote>
25564
25565 <p>
25566 3) In 28.12.1.2 [re.regiter.comp] change the following declarations
25567 </p>
25568
25569 <blockquote><pre>bool operator==(const regex_iterator&amp; right) <ins>const</ins>;
25570 bool operator!=(const regex_iterator&amp; right) <ins>const</ins>;
25571 </pre></blockquote>
25572
25573
25574 <p><i>[
25575 Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue (which
25576 is to adopt the proposed wording in this issue).
25577 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
25578 ]</i></p>
25579
25580
25581
25582
25583
25584 <hr>
25585 <h3><a name="654"></a>654. Missing IO roundtrip for random number engines</h3>
25586 <p><b>Section:</b> 26.4.1.3 [rand.req.eng] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25587  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-03-08</p>
25588 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.req.eng">issues</a> in [rand.req.eng].</p>
25589 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25590 <p><b>Discussion:</b></p>
25591 <p>
25592 Table 98 and para 5 in 26.4.1.3 [rand.req.eng] specify
25593 the IO insertion and extraction semantic of random
25594 number engines. It can be shown, v.i., that the specification
25595 of the extractor cannot guarantee to fulfill the requirement
25596 from para 5:
25597 </p>
25598
25599 <blockquote><p>
25600 If a textual representation written via os &lt;&lt; x was
25601 subsequently read via is &gt;&gt; v, then x == v provided that
25602 there have been no intervening invocations of x or of v.
25603 </p></blockquote>
25604
25605 <p>
25606 The problem is, that the extraction process described in
25607 table 98 misses to specify that it will initially set the
25608 if.fmtflags to ios_base::dec, see table 104:
25609 </p>
25610
25611 <blockquote><p>
25612 dec: converts integer input or generates integer output
25613 in decimal base
25614 </p></blockquote>
25615
25616 <p>
25617 Proof: The following small program demonstrates the violation
25618 of requirements (exception safety not fulfilled):
25619 </p>
25620
25621 <blockquote><pre>#include &lt;cassert&gt;
25622 #include &lt;ostream&gt;
25623 #include &lt;iostream&gt;
25624 #include &lt;iomanip&gt;
25625 #include &lt;sstream&gt;
25626
25627 class RanNumEngine {
25628   int state;
25629 public:
25630   RanNumEngine() : state(42) {}
25631
25632   bool operator==(RanNumEngine other) const {
25633           return state == other.state;
25634   }
25635
25636   template &lt;typename Ch, typename Tr&gt;
25637   friend std::basic_ostream&lt;Ch, Tr&gt;&amp; operator&lt;&lt;(std::basic_ostream&lt;Ch, Tr&gt;&amp; os, RanNumEngine engine) {
25638         Ch old = os.fill(os.widen(' ')); // Sets space character
25639         std::ios_base::fmtflags f = os.flags();
25640         os &lt;&lt; std::dec &lt;&lt; std::left &lt;&lt; engine.state; // Adds ios_base::dec|ios_base::left
25641         os.fill(old); // Undo
25642         os.flags(f);
25643         return os;
25644   }
25645
25646   template &lt;typename Ch, typename Tr&gt;
25647   friend std::basic_istream&lt;Ch, Tr&gt;&amp; operator&gt;&gt;(std::basic_istream&lt;Ch, Tr&gt;&amp; is, RanNumEngine&amp; engine) {
25648        // Uncomment only for the fix.
25649
25650         //std::ios_base::fmtflags f = is.flags();
25651         //is &gt;&gt; std::dec;
25652         is &gt;&gt; engine.state;
25653         //is.flags(f);
25654         return is;
25655   }
25656 };
25657
25658 int main() {
25659         std::stringstream s;
25660         s &lt;&lt; std::setfill('#'); // No problem
25661         s &lt;&lt; std::oct; // Yikes!
25662         // Here starts para 5 requirements:
25663         RanNumEngine x;
25664         s &lt;&lt; x;
25665         RanNumEngine v;
25666         s &gt;&gt; v;
25667         assert(x == v); // Fails: 42 == 34
25668 }
25669 </pre></blockquote>
25670
25671 <p>
25672 A second, minor issue seems to be, that the insertion
25673 description from table 98 unnecessarily requires the
25674 addition of ios_base::fixed (which only influences floating-point
25675 numbers). Its not entirely clear to me whether the proposed
25676 standard does require that the state of random number engines
25677 is stored in integral types or not, but I have the impression
25678 that this is the indent, see e.g. p. 3
25679 </p>
25680
25681 <blockquote><p>
25682 The specification of each random number engine defines the
25683 size of its state in multiples of the size of its result_type.
25684 </p></blockquote>
25685
25686 <p>
25687 If other types than integrals are supported, then I wonder why
25688 no requirements are specified for the precision of the stream.
25689 </p>
25690
25691 <p>
25692 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
25693 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
25694 for some further discussion.
25695 </p>
25696
25697
25698 <p><b>Proposed resolution:</b></p>
25699 <p>
25700 Adopt the proposed resolution in
25701 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
25702 </p>
25703
25704
25705 <p><i>[
25706 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
25707 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
25708 ]</i></p>
25709
25710
25711
25712
25713
25714 <hr>
25715 <h3><a name="655"></a>655. Signature of generate_canonical not useful</h3>
25716 <p><b>Section:</b> 26.4.7.2 [rand.util.canonical] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25717  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-03-08</p>
25718 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.util.canonical">issues</a> in [rand.util.canonical].</p>
25719 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25720 <p><b>Discussion:</b></p>
25721 <p>
25722 In 26.4.2 [rand.synopsis] we have the declaration
25723 </p>
25724
25725 <blockquote><pre>template&lt;class RealType, class UniformRandomNumberGenerator,
25726   size_t bits&gt;
25727 result_type generate_canonical(UniformRandomNumberGenerator&amp; g);
25728 </pre></blockquote>
25729
25730 <p>
25731 Besides the "result_type" issue (already recognized by Bo Persson
25732 at Sun, 11 Feb 2007 05:26:47 GMT in this group) it's clear, that
25733 the template parameter order is not reasonably choosen: Obviously
25734 one always needs to specify all three parameters, although usually
25735 only two are required, namely the result type RealType and the
25736 wanted bits, because UniformRandomNumberGenerator can usually
25737 be deduced.
25738 </p>
25739
25740 <p>
25741 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
25742 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
25743 for some further discussion.
25744 </p>
25745
25746
25747 <p><b>Proposed resolution:</b></p>
25748 <p>
25749 Adopt the proposed resolution in
25750 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
25751 </p>
25752
25753
25754 <p><i>[
25755 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
25756 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
25757 ]</i></p>
25758
25759
25760
25761
25762
25763 <hr>
25764 <h3><a name="660"></a>660. Missing Bitwise Operations</h3>
25765 <p><b>Section:</b> 20.6 [function.objects] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25766  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2007-04-02</p>
25767 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#function.objects">issues</a> in [function.objects].</p>
25768 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25769 <p><b>Discussion:</b></p>
25770 <p>Section 20.6 [function.objects] provides <span id="st" name="st" class="st">function</span>
25771 <span id="st" name="st" class="st">objects</span> for some unary and binary 
25772 operations, but others are missing. In a LWG reflector discussion, beginning 
25773 with c++std-lib-18078, pros and cons of adding some of the missing operations 
25774 were discussed. Bjarne Stroustrup commented "Why standardize what isn't used? 
25775 Yes, I see the chicken and egg problems here, but it would be nice to see a 
25776 couple of genuine uses before making additions."</p>
25777 <p>A number of libraries, including Rogue Wave, GNU, Adobe ASL, and Boost, have 
25778 already added these functions, either publicly or for internal use. For example, 
25779 Doug Gregor commented: "Boost will also add ... (|, &amp;, ^) in 1.35.0, because we 
25780 need those <span id="st" name="st" class="st">function</span>
25781 <span id="st" name="st" class="st">objects</span> to represent various parallel 
25782 collective operations (reductions, prefix reductions, etc.) in the new Message 
25783 Passing Interface (MPI) library."</p>
25784 <p>Because the bitwise operators have the strongest use cases, the proposed 
25785 resolution is limited to them.</p>
25786
25787
25788 <p><b>Proposed resolution:</b></p>
25789 <p>To 20.6 [function.objects], Function objects, paragraph 2, add to the header 
25790 &lt;functional&gt; synopsis:</p>
25791 <blockquote>
25792   <pre>template &lt;class T&gt; struct bit_and;
25793 template &lt;class T&gt; struct bit_or;
25794 template &lt;class T&gt; struct bit_xor;</pre>
25795 </blockquote>
25796 <p>At a location in clause 20 to be determined by the Project Editor, add:</p>
25797 <blockquote>
25798   <p>The library provides basic function object classes for all of the bitwise 
25799   operators in the language ([expr.bit.and], [expr.or], [exp.xor]).</p>
25800   <pre>template &lt;class T&gt; struct bit_and : binary_function&lt;T,T,T&gt; {
25801   T operator()(const T&amp; x , const T&amp; y ) const;
25802 };</pre>
25803   <blockquote>
25804     <p><code>operator()</code> returns<code> x &amp; y</code> .</p>
25805   </blockquote>
25806   <pre>template &lt;class T&gt; struct bit_or : binary_function&lt;T,T,T&gt; {
25807   T operator()(const T&amp; x , const T&amp; y ) const;
25808 };</pre>
25809   <blockquote>
25810     <p><code>operator()</code> returns <code>x | y</code> .</p>
25811   </blockquote>
25812   <pre>template &lt;class T&gt; struct bit_xor : binary_function&lt;T,T,T&gt; {
25813   T operator()(const T&amp; x , const T&amp; y ) const;
25814 };</pre>
25815   <blockquote>
25816     <p><code>operator()</code> returns <code>x ^ y</code> .</p>
25817   </blockquote>
25818 </blockquote>
25819
25820
25821
25822
25823
25824 <hr>
25825 <h3><a name="661"></a>661. New 27.6.1.2.2 changes make special extractions useless</h3>
25826 <p><b>Section:</b> 27.6.1.2.2 [istream.formatted.arithmetic] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25827  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-04-01</p>
25828 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#istream.formatted.arithmetic">issues</a> in [istream.formatted.arithmetic].</p>
25829 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25830 <p><b>Discussion:</b></p>
25831 <p>
25832 To the more drastic changes of 27.6.1.2.2 [istream.formatted.arithmetic] in the current draft N2134 belong
25833 the explicit description of the extraction of the types short and int in
25834 terms of as-if code fragments.
25835 </p>
25836
25837 <ol>
25838 <li>
25839 The corresponding as-if extractions in paragraph 2 and 3 will never
25840 result in a change of the operator&gt;&gt; argument val, because the
25841 contents of the local variable lval is in no case written into val.
25842 Furtheron both fragments need a currently missing parentheses in the
25843 beginning of the if-statement to be valid C++.
25844 </li>
25845 <li>I would like to ask whether the omission of a similar explicit
25846 extraction of unsigned short and unsigned int in terms of long -
25847 compared to their corresponding new insertions, as described in
25848 27.6.2.6.2 [ostream.inserters.arithmetic], is a deliberate decision or
25849 an
25850 oversight.
25851 </li>
25852 </ol>
25853
25854
25855 <p><b>Proposed resolution:</b></p>
25856 <ol>
25857 <li>
25858 <p>
25859 In 27.6.1.2.2 [istream.formatted.arithmetic]/2 change the current as-if code fragment
25860 </p>
25861 <blockquote><pre>typedef num_get&lt;charT,istreambuf_iterator&lt;charT,traits&gt; &gt; numget;
25862 iostate err = 0;
25863 long lval;
25864 use_facet&lt;numget&gt;(loc).get(*this, 0, *this, err, lval );
25865 if (err == 0) <ins>{</ins>
25866   <del>&amp;&amp;</del> <ins>if</ins> (lval &lt; numeric_limits&lt;short&gt;::min() || numeric_limits&lt;short&gt;::max() &lt; lval)<del>)</del>
25867       err = ios_base::failbit;
25868   <ins>else
25869     val = static_cast&lt;short&gt;(lval);
25870 }</ins>
25871 setstate(err);
25872 </pre></blockquote>
25873
25874 <p>
25875 Similarily in 27.6.1.2.2 [istream.formatted.arithmetic]/3 change the current as-if fragment
25876 </p>
25877
25878 <blockquote><pre>typedef num_get&lt;charT,istreambuf_iterator&lt;charT,traits&gt; &gt; numget;
25879 iostate err = 0;
25880 long lval;
25881 use_facet&lt;numget&gt;(loc).get(*this, 0, *this, err, lval );
25882 if (err == 0) <ins>{</ins>
25883   <del>&amp;&amp;</del> <ins>if</ins> (lval &lt; numeric_limits&lt;int&gt;::min() || numeric_limits&lt;int&gt;::max() &lt; lval)<del>)</del>
25884       err = ios_base::failbit;
25885   <ins>else
25886     val = static_cast&lt;int&gt;(lval);
25887 }</ins>
25888 setstate(err);
25889 </pre></blockquote>
25890 </li>
25891 <li>
25892 ---
25893 </li>
25894 </ol>
25895
25896
25897 <p><i>[
25898 Kona (2007): Note to the editor: the name lval in the call to <tt>use_facet</tt>
25899 is incorrectly italicized in the code fragments corresponding to
25900 <tt>operator&gt;&gt;(short &amp;)</tt> and <tt>operator &gt;&gt;(int &amp;)</tt>. Also, val -- which appears
25901 twice on the line with the <tt>static_cast</tt> in the proposed resolution --
25902 should be italicized. Also, in response to part two of the issue: this
25903 is deliberate.
25904 ]</i></p>
25905
25906
25907
25908
25909
25910 <hr>
25911 <h3><a name="664"></a>664. <tt>do_unshift</tt> for <tt>codecvt&lt;char, char, mbstate_t&gt;</tt></h3>
25912 <p><b>Section:</b> 22.2.1.4.2 [locale.codecvt.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25913  <b>Submitter:</b> Thomas Plum <b>Date:</b> 2007-04-16</p>
25914 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt.virtuals">issues</a> in [locale.codecvt.virtuals].</p>
25915 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25916 <p><b>Discussion:</b></p>
25917 <p>
25918 22.2.1.4.2 [locale.codecvt.virtuals], para 7 says (regarding <tt>do_unshift</tt>):
25919 </p>
25920
25921 <blockquote><p>
25922 <i>Effects:</i> Places characters starting at to that should be appended to
25923 terminate a sequence when the current <tt>stateT</tt> is given by
25924 <tt><i>state</i></tt>.<sup>237)</sup> Stores no more than <tt>(<i>to_limit</i> -
25925 <i>to</i>)</tt> destination elements, and leaves the <tt><i>to_next</i></tt>
25926 pointer pointing one beyond the last element successfully stored.
25927 <em><tt>codecvt&lt;char, char, mbstate_t&gt;</tt> stores no characters.</em>
25928 </p></blockquote>
25929
25930 <p>
25931 The following objection has been raised:
25932 </p>
25933
25934 <blockquote><p>
25935 Since the C++ Standard permits a nontrivial conversion for the required
25936 instantiations of <tt>codecvt</tt>, it is overly restrictive to say that
25937 <tt>do_unshift</tt> must store no characters and return <tt>noconv</tt>.
25938 </p></blockquote>
25939
25940 <p>
25941 [Plum ref _222152Y50]
25942 </p>
25943
25944
25945 <p><b>Proposed resolution:</b></p>
25946 <p>
25947 Change 22.2.1.4.2 [locale.codecvt.virtuals], p7:
25948 </p>
25949
25950 <blockquote>
25951 <p>
25952 <i>Effects:</i> Places characters starting at <i>to</i> that should be
25953 appended to terminate a sequence when the current <tt>stateT</tt> is
25954 given by state.<sup>237)</sup> Stores no more than (<i>to_limit -to</i>)
25955 destination elements, and leaves the <i>to_next</i> pointer pointing one
25956 beyond the last element successfully stored. <del><tt>codecvt&lt;char, char,
25957 mbstate_t&gt;</tt> stores no characters.</del>
25958 </p>
25959 </blockquote>
25960
25961
25962
25963
25964
25965 <hr>
25966 <h3><a name="665"></a>665. <tt>do_unshift</tt> return value</h3>
25967 <p><b>Section:</b> 22.2.1.4.2 [locale.codecvt.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
25968  <b>Submitter:</b> Thomas Plum <b>Date:</b> 2007-04-16</p>
25969 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.codecvt.virtuals">issues</a> in [locale.codecvt.virtuals].</p>
25970 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
25971 <p><b>Discussion:</b></p>
25972 <p>
25973 22.2.1.4.2 [locale.codecvt.virtuals], para 8 says:
25974 </p>
25975
25976 <blockquote><p>
25977 <tt>codecvt&lt;char,char,mbstate_t&gt;</tt>, returns <tt>noconv</tt>.
25978 </p></blockquote>
25979
25980 <p>
25981 The following objection has been raised:
25982 </p>
25983
25984 <blockquote><p>
25985 Despite what the C++ Standard 
25986 says, <tt>unshift</tt> can't always return <tt>noconv</tt> for the default facets, since 
25987 they can be nontrivial. At least one implementation does whatever the 
25988 C functions do.
25989 </p></blockquote>
25990
25991 <p>
25992 [Plum ref _222152Y62]
25993 </p>
25994
25995
25996 <p><b>Proposed resolution:</b></p>
25997 <p>
25998 Change 22.2.1.4.2 [locale.codecvt.virtuals], p8:
25999 </p>
26000
26001 <blockquote>
26002 <p><i>Returns:</i> An enumeration value, as summarized in Table 76:</p>
26003 <p>...</p>
26004 <p>
26005 <del><tt>codecvt&lt;char,char,mbstate_t&gt;</tt>, returns <tt>noconv</tt>.</del>
26006 </p>
26007 </blockquote>
26008
26009
26010
26011
26012
26013
26014 <hr>
26015 <h3><a name="666"></a>666. <tt>moneypunct::do_curr_symbol()</tt></h3>
26016 <p><b>Section:</b> 22.2.6.3.2 [locale.moneypunct.virtuals] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26017  <b>Submitter:</b> Thomas Plum <b>Date:</b> 2007-04-16</p>
26018 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#locale.moneypunct.virtuals">issues</a> in [locale.moneypunct.virtuals].</p>
26019 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26020 <p><b>Discussion:</b></p>
26021 <p>
26022 22.2.6.3.2 [locale.moneypunct.virtuals], para 4 footnote 257 says
26023 </p>
26024
26025 <blockquote><p>
26026 <sup>257)</sup> For international 
26027 specializations (second template parameter <tt>true</tt>) this is always four 
26028 characters long, usually three letters and a space.
26029 </p></blockquote>
26030
26031 <p>
26032 The following objection has been raised:
26033 </p>
26034
26035 <blockquote><p>
26036 The international currency 
26037 symbol is whatever the underlying locale says it is, not necessarily 
26038 four characters long.
26039 </p></blockquote>
26040
26041 <p>
26042 [Plum ref _222632Y41]
26043 </p>
26044
26045
26046 <p><b>Proposed resolution:</b></p>
26047 <p>
26048 Change footnote 253 in 22.2.6.3.2 [locale.moneypunct.virtuals]:
26049 </p>
26050
26051 <blockquote>
26052 <p>
26053 <sup>253)</sup> For international specializations (second template
26054 parameter <tt>true</tt>) this is <del>always</del> <ins>typically</ins>
26055 four characters long, usually three letters and a space.
26056 </p>
26057 </blockquote>
26058
26059
26060
26061
26062
26063 <hr>
26064 <h3><a name="672"></a>672. Swappable requirements need updating</h3>
26065 <p><b>Section:</b> 20.1.1 [utility.arg.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26066  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2007-05-04</p>
26067 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#utility.arg.requirements">active issues</a> in [utility.arg.requirements].</p>
26068 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#utility.arg.requirements">issues</a> in [utility.arg.requirements].</p>
26069 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26070 <p><b>Discussion:</b></p>
26071 <p>
26072 The current <tt>Swappable</tt> is:
26073 </p>
26074
26075 <blockquote>
26076 <table border="1">
26077 <caption>Table 37: <tt>Swappable</tt> requirements <b>[swappable]</b></caption>
26078 <tbody><tr><th>expression</th><th>return type</th><th>post-condition</th></tr>
26079 <tr><td><tt>swap(s,t)</tt></td><td><tt>void</tt></td><td><tt>t</tt> has the value originally held by <tt>u</tt>, and <tt>u</tt> has the value originally 
26080 held by <tt>t</tt></td></tr>
26081 <tr><td colspan="3">
26082 <p>
26083 The Swappable requirement is met by satisfying one or more of the following conditions:
26084 </p>
26085 <ul>
26086 <li>
26087 <tt>T</tt> is Swappable if <tt>T</tt> satisfies the <tt>CopyConstructible</tt> requirements (Table 34) 
26088 and the <tt>CopyAssignable</tt> requirements (Table 36);
26089 </li>
26090 <li>
26091 <tt>T</tt> is Swappable if a namespace scope function named <tt>swap</tt> exists in the same 
26092 namespace as the definition of <tt>T</tt>, such that the expression <tt>swap(t,u)</tt> is valid 
26093 and has the semantics described in this table.
26094 </li>
26095 </ul>
26096 </td></tr>
26097 </tbody></table>
26098 </blockquote>
26099
26100 <p>
26101 With the passage of rvalue reference into the language, <tt>Swappable</tt> needs to be updated to
26102 require only <tt>MoveConstructible</tt> and <tt>MoveAssignable</tt>.  This is a minimum.
26103 </p>
26104
26105 <p>
26106 Additionally we may want to support proxy references such that the following code is acceptable:
26107 </p>
26108
26109 <blockquote><pre>namespace Mine {
26110
26111 template &lt;class T&gt;
26112 struct proxy {...};
26113
26114 template &lt;class T&gt;
26115 struct proxied_iterator
26116 {
26117    typedef T value_type;
26118    typedef proxy&lt;T&gt; reference;
26119    reference operator*() const;
26120    ...
26121 };
26122
26123 struct A
26124 {
26125    // heavy type, has an optimized swap, maybe isn't even copyable or movable, just swappable
26126    void swap(A&amp;);
26127    ...
26128 };
26129
26130 void swap(A&amp;, A&amp;);
26131 void swap(proxy&lt;A&gt;, A&amp;);
26132 void swap(A&amp;, proxy&lt;A&gt;);
26133 void swap(proxy&lt;A&gt;, proxy&lt;A&gt;);
26134
26135 }  // Mine
26136
26137 ...
26138
26139 Mine::proxied_iterator&lt;Mine::A&gt; i(...)
26140 Mine::A a;
26141 swap(*i1, a);
26142 </pre></blockquote>
26143
26144 <p>
26145 I.e. here is a call to <tt>swap</tt> which the user enables swapping between a proxy to a class and the class
26146 itself.  We do not need to anything in terms of implementation except not block their way with overly
26147 constrained concepts.  That is, the <tt>Swappable</tt> concept should be expanded to allow swapping
26148 between two different types for the case that one is binding to a user-defined <tt>swap</tt>.
26149 </p>
26150
26151
26152
26153 <p><b>Proposed resolution:</b></p>
26154
26155 <p>
26156 Change 20.1.1 [utility.arg.requirements]:
26157 </p>
26158
26159 <blockquote>
26160
26161 <p>
26162 -1- The template definitions in the C++ Standard Library refer to various
26163 named requirements whose details are set out in tables 31-38. In these
26164 tables, <tt>T</tt> is a type to be supplied by a C++ program
26165 instantiating a template; <tt>a</tt>, <tt>b</tt>, and <tt>c</tt> are
26166 values of type <tt>const T</tt>; <tt>s</tt> and <tt>t</tt> are modifiable
26167 lvalues of type <tt>T</tt>; <tt>u</tt> is a value of type (possibly
26168 <tt>const</tt>) <tt>T</tt>; and <tt>rv</tt> is a non-<tt>const</tt>
26169 rvalue of type <tt>T</tt>.
26170 </p>
26171
26172 <table border="1">
26173 <caption>Table 37: <tt>Swappable</tt> requirements <b>[swappable]</b></caption>
26174 <tbody><tr><th>expression</th><th>return type</th><th>post-condition</th></tr>
26175 <tr><td><tt>swap(s,t)</tt></td><td><tt>void</tt></td>
26176 <td><tt>t</tt> has the value originally
26177 held by <tt>u</tt>, and
26178 <tt>u</tt> has the value originally held
26179 by <tt>t</tt></td></tr>
26180 <tr><td colspan="3">
26181 <p>
26182 The <tt>Swappable</tt> requirement is met by satisfying one or more of the following conditions:
26183 </p>
26184 <ul>
26185 <li>
26186 <tt>T</tt> is <tt>Swappable</tt> if <tt>T</tt> satisfies the
26187 <del><tt>CopyConstructible</tt></del> <ins>MoveConstructible</ins>
26188 requirements (Table <del>34</del> <ins>33</ins>) and the <del><tt>CopyAssignable</tt></del> <ins>MoveAssignable</ins>
26189 requirements (Table <del>36</del> <ins>35</ins>);
26190 </li>
26191 <li>
26192 <tt>T</tt> is <tt>Swappable</tt> if a namespace scope function named
26193 <tt>swap</tt> exists in the same namespace as the definition of
26194 <tt>T</tt>, such that the expression
26195 <tt>swap(t,u)</tt> is valid and has the
26196 semantics described in this table.
26197 </li>
26198 </ul>
26199 </td></tr>
26200 </tbody></table>
26201 </blockquote>
26202
26203
26204
26205 <p><i>[
26206 Kona (2007): We like the change to the <tt>Swappable</tt> requirements to use
26207 move semantics. The issue relating to the support of proxies is
26208 separable from the one relating to move semantics, and it's bigger than
26209 just swap. We'd like to address only the move semantics changes under
26210 this issue, and open a separated issue (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#742">742</a>) to handle proxies. Also, there
26211 may be a third issue, in that the current definition of <tt>Swappable</tt> does
26212 not permit rvalues to be operands to a swap operation, and Howard's
26213 proposed resolution would allow the right-most operand to be an rvalue,
26214 but it would not allow the left-most operand to be an rvalue (some swap
26215 functions in the library have been overloaded to permit left operands to
26216 swap to be rvalues).
26217 ]</i></p>
26218
26219
26220
26221
26222
26223 <hr>
26224 <h3><a name="673"></a>673. <tt>unique_ptr</tt> update</h3>
26225 <p><b>Section:</b> 20.7.11 [unique.ptr] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26226  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2007-05-04</p>
26227 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#unique.ptr">issues</a> in [unique.ptr].</p>
26228 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26229 <p><b>Discussion:</b></p>
26230 <p>
26231 Since the publication of
26232 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1856.html">N1856</a>
26233 there have been a few small but significant advances which should be included into
26234 <tt>unique_ptr</tt>.  There exists a
26235 <a href="http://home.twcny.rr.com/hinnant/cpp_extensions/unique_ptr.html">example implmenation</a>
26236 for all of these changes.
26237 </p>
26238
26239 <ul>
26240
26241 <li>
26242 <p>
26243 Even though <tt>unique_ptr&lt;void&gt;</tt> is not a valid use case (unlike for <tt>shared_ptr&lt;void&gt;</tt>),
26244 unexpected cases to crop up which require the instantiation of the interface of <tt>unique_ptr&lt;void&gt;</tt>
26245 even if it is never used.  For example see
26246 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#541">LWG 541</a> for how this accidently
26247 happened to <tt>auto_ptr</tt>.  I believe the most robust way to protect <tt>unique_ptr</tt> against this
26248 type of failure is to augment the return type of <tt>unique_ptr&lt;T&gt;:operator*()</tt> with
26249 <tt>add_lvalue_reference&lt;T&gt;::type</tt>.  This means that given an instantiated <tt>unique_ptr&lt;void&gt;</tt>
26250 the act of dereferencing it will simply return <tt>void</tt> instead of causing a compile time failure.
26251 This is simpler than creating a <tt>unique_ptr&lt;void&gt;</tt> specialization which isn't robust in the
26252 face of <tt><i>cv-</i></tt>qualified <tt>void</tt> types.
26253 </p>
26254
26255 <p>
26256 This resolution also supports instantiations such as <tt>unique_ptr&lt;void, free_deleter&gt;</tt>
26257 which could be very useful to the client.
26258 </p>
26259
26260 </li>
26261
26262 <li>
26263 <p>
26264 Efforts have been made to better support containers and smart pointers in shared
26265 memory contexts.  One of the key hurdles in such support is not assuming that a
26266 pointer type is actually a <tt>T*</tt>.  This can easily be accomplished
26267 for <tt>unique_ptr</tt> by having the deleter define the pointer type:
26268 <tt>D::pointer</tt>.  Furthermore this type can easily be defaulted to
26269 <tt>T*</tt> should the deleter <tt>D</tt> choose not to define a pointer
26270 type (example implementation
26271 <a href="http://home.twcny.rr.com/hinnant/cpp_extensions/unique_ptr.html">here</a>).
26272 This change has no run time overhead.  It has no interface overhead on
26273 authors of custom delter types.  It simply allows (but not requires)
26274 authors of custom deleter types to define a smart pointer for the
26275 storage type of <tt>unique_ptr</tt> if they find such functionality
26276 useful.  <tt>std::default_delete</tt> is an example of a deleter which
26277 defaults <tt>pointer</tt> to <tt>T*</tt> by simply ignoring this issue
26278 and not including a <tt>pointer typedef</tt>.
26279 </p>
26280 </li>
26281
26282 <li>
26283 <p>
26284 When the deleter type is a function pointer then it is unsafe to construct
26285 a <tt>unique_ptr</tt> without specifying the function pointer in the constructor.
26286 This case is easy to check for with a <tt>static_assert</tt> assuring that the
26287 deleter is not a pointer type in those constructors which do not accept deleters.
26288 </p>
26289
26290 <blockquote><pre>unique_ptr&lt;A, void(*)(void*)&gt; p(new A);  // error, no function given to delete the pointer!
26291 </pre></blockquote>
26292
26293 </li>
26294
26295 </ul>
26296
26297 <p><i>[
26298 Kona (2007): We don't like the solution given to the first bullet in
26299 light of concepts. The second bullet solves the problem of supporting
26300 fancy pointers for one library component only. The full LWG needs to
26301 decide whether to solve the problem of supporting fancy pointers
26302 piecemeal, or whether a paper addressing the whole library is needed. We
26303 think that the third bullet is correct.
26304 ]</i></p>
26305
26306
26307 <p><i>[
26308 Post Kona: Howard adds example user code related to the first bullet:
26309 ]</i></p>
26310
26311
26312 <blockquote>
26313 <pre>void legacy_code(void*, std::size_t);
26314
26315 void foo(std::size_t N)
26316 {
26317     std::unique_ptr&lt;void, void(*)(void*)&gt; ptr(std::malloc(N), std::free);
26318     legacy_code(ptr.get(), N);
26319 }   // unique_ptr used for exception safety purposes
26320 </pre>
26321 </blockquote>
26322
26323 <p>
26324 I.e. <tt>unique_ptr&lt;void&gt;</tt> <i>is</i> a useful tool that we don't want
26325 to disable with concepts.  The only part of <tt>unique_ptr&lt;void&gt;</tt> we
26326 want to disable (with concepts or by other means) are the two member functions:
26327 </p>
26328
26329 <blockquote><pre>T&amp; operator*() const;
26330 T* operator-&gt;() const;
26331 </pre></blockquote>
26332
26333
26334
26335 <p><b>Proposed resolution:</b></p>
26336
26337 <p><i>[
26338 I am grateful for the generous aid of Peter Dimov and Ion Gaztañaga in helping formulate and review
26339 the proposed resolutions below.
26340 ]</i></p>
26341
26342
26343 <ul>
26344 <li>
26345
26346 <p>
26347 Change 20.7.11.2 [unique.ptr.single]:
26348 </p>
26349
26350 <blockquote><pre>template &lt;class T, class D = default_delete&lt;T&gt;&gt; class unique_ptr {
26351    ...
26352    <del>T&amp;</del> <ins>typename add_lvalue_reference&lt;T&gt;::type</ins> operator*() const;
26353    ...
26354 };
26355 </pre></blockquote>
26356
26357 <p>
26358 Change 20.7.11.2.4 [unique.ptr.single.observers]:
26359 </p>
26360
26361 <blockquote><pre><del>T&amp;</del> <ins>typename add_lvalue_reference&lt;T&gt;::type</ins> operator*() const;
26362 </pre></blockquote>
26363
26364 </li>
26365
26366 <li>
26367 <p>
26368 Change 20.7.11.2 [unique.ptr.single]:
26369 </p>
26370
26371 <blockquote><pre>template &lt;class T, class D = default_delete&lt;T&gt;&gt; class unique_ptr {
26372 public:
26373   <ins>typedef <i>implementation (see description below)</i> pointer;</ins>
26374    ...
26375    explicit unique_ptr(<del>T*</del> <ins>pointer</ins> p);
26376    ...
26377    unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined (see description below)</i> d);
26378    unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined (see description below)</i> d);
26379    ...
26380    <del>T*</del> <ins>pointer</ins> operator-&gt;() const;
26381    <del>T*</del> <ins>pointer</ins> get() const;
26382    ...
26383    <del>T*</del> <ins>pointer</ins> release();
26384    void reset(<del>T*</del> <ins>pointer</ins> p = <del>0</del> <ins>pointer()</ins>);
26385 };
26386 </pre></blockquote>
26387
26388 <p>
26389 <ins>
26390 -3- If the type <tt>remove_reference&lt;D&gt;::type::pointer</tt>
26391 exists, then <tt>unique_ptr&lt;T, D&gt;::pointer</tt> is a typedef to
26392 <tt>remove_reference&lt;D&gt;::type::pointer</tt>.  Otherwise
26393 <tt>unique_ptr&lt;T, D&gt;::pointer</tt> is a typedef to <tt>T*</tt>.
26394 The type <tt>unique_ptr&lt;T, D&gt;::pointer</tt> shall be <tt>CopyConstructible</tt>
26395 and <tt>CopyAssignable</tt>.
26396 </ins>
26397 </p>
26398
26399 <p>
26400 Change 20.7.11.2.1 [unique.ptr.single.ctor]:
26401 </p>
26402
26403 <blockquote><pre>unique_ptr(<del>T*</del> <ins>pointer</ins> p);
26404 ...
26405 unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined</i> d); 
26406 unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined</i> d); 
26407 ...
26408 unique_ptr(<del>T*</del> <ins>pointer</ins> p, const A&amp; d);
26409 unique_ptr(<del>T*</del> <ins>pointer</ins> p, A&amp;&amp; d);
26410 ...
26411 unique_ptr(<del>T*</del> <ins>pointer</ins> p, A&amp; d); 
26412 unique_ptr(<del>T*</del> <ins>pointer</ins> p, A&amp;&amp; d);
26413 ...
26414 unique_ptr(<del>T*</del> <ins>pointer</ins> p, const A&amp; d); 
26415 unique_ptr(<del>T*</del> <ins>pointer</ins> p, const A&amp;&amp; d);
26416 ...
26417 </pre></blockquote>
26418
26419 <p>
26420 -23- <i>Requires:</i> If <tt>D</tt> is not a reference type,
26421 construction of the deleter <tt>D</tt> from an rvalue of type <tt>E</tt>
26422 <del>must</del> <ins>shall</ins> be well formed and not throw an exception. If <tt>D</tt> is a
26423 reference type, then <tt>E</tt> <del>must</del> <ins>shall</ins> be the same type as <tt>D</tt>
26424 (diagnostic required). <del><tt>U*</tt></del> <ins><tt>unique_ptr&lt;U,E&gt;::pointer</tt></ins>
26425 <del>must</del> <ins>shall</ins> be implicitly convertible to <del><tt>T*</tt></del>
26426 <ins>pointer</ins>.
26427 </p>
26428
26429 <p>
26430 -25- <i>Postconditions:</i> <tt>get() == value u.get()</tt> had before
26431 the construction, modulo any required offset adjustments resulting from
26432 the cast from <del><tt>U*</tt></del>
26433 <ins><tt>unique_ptr&lt;U,E&gt;::pointer</tt></ins> to <del><tt>T*</tt></del>
26434 <ins>pointer</ins>. <tt>get_deleter()</tt> returns a reference to the
26435 internally stored deleter which was constructed from
26436 <tt>u.get_deleter()</tt>.
26437 </p>
26438
26439 <p>
26440 Change 20.7.11.2.3 [unique.ptr.single.asgn]:
26441 </p>
26442
26443 <blockquote>
26444 <p>
26445 -8- <i>Requires:</i> Assignment of the deleter <tt>D</tt> from an rvalue
26446 <tt>D</tt> <del>must</del> <ins>shall</ins> not throw an exception. <del><tt>U*</tt></del>
26447 <ins><tt>unique_ptr&lt;U,E&gt;::pointer</tt></ins> <del>must</del> <ins>shall</ins> be implicitly
26448 convertible to <del><tt>T*</tt></del> <ins>pointer</ins>.
26449 </p>
26450 </blockquote>
26451
26452 <p>
26453 Change 20.7.11.2.4 [unique.ptr.single.observers]:
26454 </p>
26455
26456 <blockquote>
26457 <pre><del>T*</del> <ins>pointer</ins> operator-&gt;() const;</pre>
26458 ...
26459 <pre><del>T*</del> <ins>pointer</ins> get() const;</pre>
26460 </blockquote>
26461
26462 <p>
26463 Change 20.7.11.2.5 [unique.ptr.single.modifiers]:
26464 </p>
26465
26466 <blockquote>
26467 <pre><del>T*</del> <ins>pointer</ins> release();</pre>
26468 ...
26469 <pre>void reset(<del>T*</del> <ins>pointer</ins> p = <del>0</del> <ins>pointer()</ins>);</pre>
26470 </blockquote>
26471
26472 <p>
26473 Change 20.7.11.3 [unique.ptr.runtime]:
26474 </p>
26475
26476 <blockquote><pre>template &lt;class T, class D&gt; class unique_ptr&lt;T[], D&gt; {
26477 public:
26478   <ins>typedef <i>implementation</i> pointer;</ins>
26479    ...
26480    explicit unique_ptr(<del>T*</del> <ins>pointer</ins> p);
26481    ...
26482    unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined</i> d);
26483    unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined</i> d);
26484    ...
26485    <del>T*</del> <ins>pointer</ins> get() const;
26486    ...
26487    <del>T*</del> <ins>pointer</ins> release();
26488    void reset(<del>T*</del> <ins>pointer</ins> p = <del>0</del> <ins>pointer()</ins>);
26489 };
26490 </pre></blockquote>
26491
26492 <p>
26493 Change 20.7.11.3.1 [unique.ptr.runtime.ctor]:
26494 </p>
26495
26496 <blockquote>
26497 <pre>unique_ptr(<del>T*</del> <ins>pointer</ins> p);
26498 unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined</i> d);
26499 unique_ptr(<del>T*</del> <ins>pointer</ins> p, <i>implementation defined</i> d);
26500 </pre>
26501
26502 <p>
26503 These constructors behave the same as in the primary template except
26504 that they do not accept pointer types which are convertible to
26505 <del><tt>T*</tt></del> <ins><tt>pointer</tt></ins>. [<i>Note:</i> One
26506 implementation technique is to create private templated overloads of
26507 these members. <i>-- end note</i>]
26508 </p>
26509 </blockquote>
26510
26511 <p>
26512 Change 20.7.11.3.3 [unique.ptr.runtime.modifiers]:
26513 </p>
26514
26515 <blockquote>
26516 <pre>void reset(<del>T*</del> <ins>pointer</ins> p = <del>0</del> <ins>pointer()</ins>);
26517 </pre>
26518
26519 <p>
26520 -1- <i>Requires:</i> Does not accept pointer types which are convertible
26521 to <del><tt>T*</tt></del> <ins><tt>pointer</tt></ins> (diagnostic
26522 required). [<i>Note:</i> One implementation technique is to create a private
26523 templated overload. <i>-- end note</i>]
26524 </p>
26525 </blockquote>
26526
26527 </li>
26528
26529 <li>
26530
26531 <p>
26532 Change 20.7.11.2.1 [unique.ptr.single.ctor]:
26533 </p>
26534
26535 <blockquote>
26536 <pre>unique_ptr();</pre>
26537 <blockquote>
26538 <p>
26539 <i>Requires:</i> <tt>D</tt> <del>must</del> <ins>shall</ins> be default constructible, and that
26540 construction <del>must</del> <ins>shall</ins> not throw an exception. <tt>D</tt> <del>must</del> <ins>shall</ins> not be a
26541 reference type <ins>or pointer type (diagnostic required)</ins>.
26542 </p>
26543 </blockquote>
26544 <pre>unique_ptr(<del>T*</del> <ins>pointer</ins> p);</pre>
26545 <blockquote>
26546 <p>
26547 <i>Requires:</i>  The expression <tt>D()(p)</tt> <del>must</del> <ins>shall</ins> be well formed.
26548 The default constructor of <tt>D</tt> <del>must</del> <ins>shall</ins> not throw an exception.
26549 <tt>D</tt> <del>must</del> <ins>shall</ins> not be a reference type <ins>or pointer type (diagnostic
26550 required)</ins>.
26551 </p>
26552 </blockquote>
26553 </blockquote>
26554
26555 </li>
26556
26557 </ul>
26558
26559
26560
26561
26562
26563
26564 <hr>
26565 <h3><a name="674"></a>674. <tt>shared_ptr</tt> interface changes for consistency with N1856</h3>
26566 <p><b>Section:</b> 20.7.12.2 [util.smartptr.shared] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26567  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2007-05-05</p>
26568 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#util.smartptr.shared">active issues</a> in [util.smartptr.shared].</p>
26569 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.shared">issues</a> in [util.smartptr.shared].</p>
26570 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26571 <p><b>Discussion:</b></p>
26572 <p>
26573 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1856.html">N1856</a> does not propose
26574 any changes to <tt>shared_ptr</tt>. It needs to be updated to use a rvalue reference where appropriate
26575 and to interoperate with <tt>unique_ptr</tt> as it does with <tt>auto_ptr</tt>.
26576 </p>
26577
26578
26579 <p><b>Proposed resolution:</b></p>
26580
26581 <p>
26582 Change 20.7.12.2 [util.smartptr.shared] as follows:
26583 </p>
26584
26585 <blockquote>
26586 <pre>template&lt;class Y&gt; explicit shared_ptr(auto_ptr&lt;Y&gt;<del>&amp;</del><ins>&amp;&amp;</ins> r);
26587 <ins>template&lt;class Y, class D&gt; explicit shared_ptr(const unique_ptr&lt;Y,D&gt;&amp; r) = delete;
26588 template&lt;class Y, class D&gt; explicit shared_ptr(unique_ptr&lt;Y,D&gt;&amp;&amp; r);</ins>
26589 ...
26590 template&lt;class Y&gt; shared_ptr&amp; operator=(auto_ptr&lt;Y&gt;<del>&amp;</del><ins>&amp;&amp;</ins> r);
26591 <ins>template&lt;class Y, class D&gt; shared_ptr&amp; operator=(const unique_ptr&lt;Y,D&gt;&amp; r) = delete;
26592 template&lt;class Y, class D&gt; shared_ptr&amp; operator=(unique_ptr&lt;Y,D&gt;&amp;&amp; r);</ins></pre>
26593 </blockquote>
26594
26595 <p>
26596 Change 20.7.12.2.1 [util.smartptr.shared.const] as follows:
26597 </p>
26598
26599 <blockquote>
26600 <pre><ins>template&lt;class Y&gt; shared_ptr(auto_ptr&lt;Y&gt;<del>&amp;</del><ins>&amp;&amp;</ins> r);</ins></pre>
26601 </blockquote>
26602
26603 <p>
26604 Add to 20.7.12.2.1 [util.smartptr.shared.const]:
26605 </p>
26606
26607 <blockquote>
26608 <pre><ins>template&lt;class Y, class D&gt; shared_ptr(unique_ptr&lt;Y, D&gt;&amp;&amp; r);</ins></pre>
26609 <blockquote>
26610
26611 <p><ins>
26612 <i>Effects:</i> Equivalent to <tt>shared_ptr( r.release(), r.get_deleter() )</tt> when <tt>D</tt> is
26613           not a reference type, <tt>shared_ptr( r.release(), ref( r.get_deleter() ) )</tt>
26614           otherwise.
26615 </ins></p>
26616
26617 <p><ins>
26618 <i>Exception safety:</i> If an exception is thrown, the constructor has no effect.
26619 </ins></p>
26620 </blockquote>
26621
26622 </blockquote>
26623
26624 <p>
26625 Change 20.7.12.2.3 [util.smartptr.shared.assign] as follows:
26626 </p>
26627
26628 <blockquote>
26629 <pre>template&lt;class Y&gt; shared_ptr&amp; operator=(auto_ptr&lt;Y&gt;<del>&amp;</del><ins>&amp;&amp;</ins> r);</pre>
26630 </blockquote>
26631
26632 <p>
26633 Add to 20.7.12.2.3 [util.smartptr.shared.assign]:
26634 </p>
26635
26636 <blockquote>
26637 <pre><ins>template&lt;class Y, class D&gt; shared_ptr&amp; operator=(unique_ptr&lt;Y,D&gt;&amp;&amp; r);</ins></pre>
26638
26639 <blockquote>
26640 <p><ins>
26641 -4- <i>Effects:</i> Equivalent to <tt>shared_ptr(std::move(r)).swap(*this)</tt>.
26642 </ins></p>
26643 <p><ins>
26644 -5- <i>Returns:</i> <tt>*this</tt>.
26645 </ins></p>
26646 </blockquote>
26647
26648 </blockquote>
26649
26650
26651
26652 <p><i>[
26653 Kona (2007): We may need to open an issue (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#743">743</a>) to deal with the question of
26654 whether <tt>shared_ptr</tt> needs an rvalue <tt>swap</tt>.
26655 ]</i></p>
26656
26657
26658
26659
26660
26661 <hr>
26662 <h3><a name="677"></a>677. Weaknesses in seed_seq::randomize [rand.util.seedseq]</h3>
26663 <p><b>Section:</b> 26.4.7.1 [rand.util.seedseq] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26664  <b>Submitter:</b> Charles Karney <b>Date:</b> 2007-05-15</p>
26665 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#rand.util.seedseq">active issues</a> in [rand.util.seedseq].</p>
26666 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.util.seedseq">issues</a> in [rand.util.seedseq].</p>
26667 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26668 <p><b>Discussion:</b></p>
26669 <p>
26670 <tt>seed_seq::randomize</tt> provides a mechanism for initializing random number
26671 engines which ideally would yield "distant" states when given "close"
26672 seeds.  The algorithm for <tt>seed_seq::randomize</tt> given in the current
26673 Working Draft for C++,
26674 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2284.pdf">N2284</a>
26675 (2007-05-08), has 3 weaknesses
26676 </p>
26677
26678 <ol>
26679 <li>
26680 <p> Collisions in state.  Because of the way the state is initialized,
26681     seeds of different lengths may result in the same state.  The
26682     current version of seed_seq has the following properties:</p>
26683 <ul>
26684 <li>  For a given <tt>s &lt;= n</tt>, each of the 2^(32s) seed vectors results in a
26685       distinct state.</li>
26686 </ul>
26687 <p>
26688     The proposed algorithm (below) has the considerably stronger
26689     properties:</p>
26690 <ul>
26691 <li>   All of the <tt>(2^(32n)-1)/(2^32-1)</tt> seed vectors of lengths <tt>s &lt; n</tt>
26692       result in distinct states.
26693 </li>
26694 <li>  All of the <tt>2^(32n)</tt> seed vectors of length <tt>s == n</tt> result in
26695       distinct states.
26696 </li>
26697 </ul>
26698 </li>
26699 <li>
26700 <p> Poor mixing of <tt>v'</tt>s entropy into the state.  Consider <tt>v.size() == n</tt>
26701     and hold <tt>v[n/2]</tt> thru <tt>v[n-1]</tt> fixed while varying <tt>v[0]</tt> thru <tt>v[n/2-1]</tt>,
26702     a total of <tt>2^(16n)</tt> possibilities.  Because of the simple recursion
26703     used in <tt>seed_seq</tt>, <tt>begin[n/2]</tt> thru <tt>begin[n-1]</tt> can take on only 2^64
26704     possible states.</p>
26705
26706 <p> The proposed algorithm uses a more complex recursion which results
26707     in much better mixing.</p>
26708 </li>
26709 <li> <tt>seed_seq::randomize</tt> is undefined for <tt>v.size() == 0</tt>.  The proposed
26710     algorithm remedies this.
26711 </li>
26712 </ol>
26713 <p>
26714 The current algorithm for <tt>seed_seq::randomize</tt> is adapted by me from the
26715 initialization procedure for the Mersenne Twister by Makoto Matsumoto
26716 and Takuji Nishimura.  The weakness (2) given above was communicated to
26717 me by Matsumoto last year.
26718 </p>
26719 <p>
26720 The proposed replacement for <tt>seed_seq::randomize</tt> is due to Mutsuo Saito,
26721 a student of Matsumoto, and is given in the implementation of the
26722 SIMD-oriented Fast Mersenne Twister random number generator SFMT.
26723 <a href="http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/SFMT/index.html">http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html</a>
26724 <a href="http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/SFMT/SFMT-src-1.2.tar.gz">http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/SFMT-src-1.2.tar.gz</a>
26725 </p>
26726 <p>
26727 See
26728 Mutsuo Saito,
26729 An Application of Finite Field: Design and Implementation of 128-bit
26730 Instruction-Based Fast Pseudorandom Number Generator,
26731 Master's Thesis, Dept. of Math., Hiroshima University (Feb. 2007)
26732 <a href="http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/SFMT/M062821.pdf">http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/M062821.pdf</a>
26733 </p>
26734 <p>
26735 One change has been made here, namely to treat the case of small <tt>n</tt>
26736 (setting <tt>t = (n-1)/2</tt> for <tt>n &lt; 7</tt>).
26737 </p>
26738 <p>
26739 Since <tt>seed_seq</tt> was introduced relatively recently there is little cost
26740 in making this incompatible improvement to it.
26741 </p>
26742
26743 <p>
26744 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
26745 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
26746 for some further discussion.
26747 </p>
26748
26749
26750 <p><b>Proposed resolution:</b></p>
26751 <p>
26752 Adopt the proposed resolution in
26753 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
26754 </p>
26755
26756
26757 <p><i>[
26758 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
26759 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
26760 ]</i></p>
26761
26762
26763
26764
26765
26766 <hr>
26767 <h3><a name="678"></a>678. Changes for [rand.req.eng]</h3>
26768 <p><b>Section:</b> 26.4.1.3 [rand.req.eng] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26769  <b>Submitter:</b> Charles Karney <b>Date:</b> 2007-05-15</p>
26770 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.req.eng">issues</a> in [rand.req.eng].</p>
26771 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26772 <p><b>Discussion:</b></p>
26773 <p>
26774 Section 26.4.1.3 [rand.req.eng] Random number engine requirements:
26775 </p>
26776
26777 <p>
26778 This change follows naturally from the proposed change to
26779 <tt>seed_seq::randomize</tt> in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#677">677</a>.
26780 </p>
26781
26782 <p>
26783 In table 104 the description of <tt>X(q)</tt> contains a special treatment of
26784 the case <tt>q.size() == 0</tt>.  This is undesirable for 4 reasons:
26785 </p>
26786
26787 <ol>
26788 <li>It replicates the functionality provided by <tt>X()</tt>.</li>
26789 <li>It leads to the possibility of a collision in the state provided
26790     by some other <tt>X(q)</tt> with <tt>q.size() &gt; 0</tt>.</li>
26791 <li>It is inconsistent with the description of the <tt>X(q)</tt> in
26792 paragraphs 26.4.3.1 [rand.eng.lcong] p5, 26.4.3.2 [rand.eng.mers] p8, and 26.4.3.3 [rand.eng.sub] p10 where
26793 there is no special treatment of <tt>q.size() == 0</tt>.</li>
26794 <li>The proposed replacement for <tt>seed_seq::randomize</tt> given above
26795     allows for the case <tt>q.size() == 0</tt>.</li>
26796 </ol>
26797
26798 <p>
26799 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
26800 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
26801 for some further discussion.
26802 </p>
26803
26804
26805 <p><b>Proposed resolution:</b></p>
26806 <p>
26807 Adopt the proposed resolution in
26808 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
26809 </p>
26810
26811
26812 <p><i>[
26813 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
26814 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
26815 ]</i></p>
26816
26817
26818
26819
26820
26821 <hr>
26822 <h3><a name="679"></a>679. resize parameter by value</h3>
26823 <p><b>Section:</b> 23.2 [sequences] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26824  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2007-06-11</p>
26825 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26826 <p><b>Discussion:</b></p>
26827 <p>
26828 The C++98 standard specifies that one member function alone of the containers
26829 passes its parameter (<tt>T</tt>) by value instead of by const reference:
26830 </p>
26831
26832 <blockquote><pre>void resize(size_type sz, T c = T());
26833 </pre></blockquote>
26834
26835 <p>
26836 This fact has been discussed / debated repeatedly over the years, the first time
26837 being even before C++98 was ratified.  The rationale for passing this parameter by
26838 value has been:
26839 </p>
26840
26841 <blockquote>
26842 <p>
26843 So that self referencing statements are guaranteed to work, for example:
26844 </p>
26845 <blockquote><pre>v.resize(v.size() + 1, v[0]);
26846 </pre></blockquote>
26847 </blockquote>
26848
26849 <p>
26850 However this rationale is not convincing as the signature for <tt>push_back</tt> is:
26851 </p>
26852
26853 <blockquote><pre>void push_back(const T&amp; x);
26854 </pre></blockquote>
26855
26856 <p>
26857 And <tt>push_back</tt> has similar semantics to <tt>resize</tt> (append).
26858 And <tt>push_back</tt> must also work in the self referencing case:
26859 </p>
26860
26861 <blockquote><pre>v.push_back(v[0]);  // must work
26862 </pre></blockquote>
26863
26864 <p>
26865 The problem with passing <tt>T</tt> by value is that it can be significantly more
26866 expensive than passing by reference.  The converse is also true, however when it is
26867 true it is usually far less dramatic (e.g. for scalar types).
26868 </p>
26869
26870 <p>
26871 Even with move semantics available, passing this parameter by value can be expensive.
26872 Consider for example <tt>vector&lt;vector&lt;int&gt;&gt;</tt>:
26873 </p>
26874
26875 <blockquote><pre>std::vector&lt;int&gt; x(1000);
26876 std::vector&lt;std::vector&lt;int&gt;&gt; v;
26877 ...
26878 v.resize(v.size()+1, x);
26879 </pre></blockquote>
26880
26881 <p>
26882 In the pass-by-value case, <tt>x</tt> is copied once to the parameter of
26883 <tt>resize</tt>.  And then internally, since the code can not know at compile
26884 time by how much <tt>resize</tt> is growing the <tt>vector</tt>, <tt>x</tt> is
26885 usually copied (not moved) a second time from <tt>resize</tt>'s parameter into its proper place
26886 within the <tt>vector</tt>.
26887 </p>
26888
26889 <p>
26890 With pass-by-const-reference, the <tt>x</tt> in the above example need be copied
26891 only once.  In this case, <tt>x</tt> has an expensive copy constructor and so any
26892 copies that can be saved represents a significant savings.
26893 </p>
26894
26895 <p>
26896 If we can be efficient for <tt>push_back</tt>, we should be efficient for <tt>resize</tt>
26897 as well.  The resize taking a reference parameter has been coded and shipped in the
26898 CodeWarrior library with no reports of problems which I am aware of.
26899 </p>
26900
26901
26902
26903 <p><b>Proposed resolution:</b></p>
26904 <p>
26905 Change 23.2.2 [deque], p2:
26906 </p>
26907
26908 <blockquote><pre>class deque {
26909    ...
26910    void resize(size_type sz, <ins>const </ins>T<ins>&amp;</ins> c);
26911 </pre></blockquote>
26912
26913 <p>
26914 Change 23.2.2.2 [deque.capacity], p3:
26915 </p>
26916
26917 <blockquote><pre>void resize(size_type sz, <ins>const </ins>T<ins>&amp;</ins> c);
26918 </pre></blockquote>
26919
26920 <p>
26921 Change 23.2.4 [list], p2:
26922 </p>
26923
26924 <blockquote><pre>class list {
26925    ...
26926    void resize(size_type sz, <ins>const </ins>T<ins>&amp;</ins> c);
26927 </pre></blockquote>
26928
26929 <p>
26930 Change 23.2.4.2 [list.capacity], p3:
26931 </p>
26932
26933 <blockquote><pre>void resize(size_type sz, <ins>const </ins>T<ins>&amp;</ins> c);
26934 </pre></blockquote>
26935
26936 <p>
26937 Change 23.2.6 [vector], p2:
26938 </p>
26939
26940 <blockquote><pre>class vector {
26941    ...
26942    void resize(size_type sz, <ins>const </ins>T<ins>&amp;</ins> c);
26943 </pre></blockquote>
26944
26945 <p>
26946 Change 23.2.6.2 [vector.capacity], p11:
26947 </p>
26948
26949 <blockquote><pre>void resize(size_type sz, <ins>const </ins>T<ins>&amp;</ins> c);
26950 </pre></blockquote>
26951
26952
26953
26954
26955
26956
26957 <hr>
26958 <h3><a name="680"></a>680. move_iterator operator-&gt; return</h3>
26959 <p><b>Section:</b> 24.4.3.1 [move.iterator] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
26960  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2007-06-11</p>
26961 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
26962 <p><b>Discussion:</b></p>
26963 <p>
26964 <tt>move_iterator</tt>'s <tt>operator-&gt;</tt> return type <tt>pointer</tt>
26965 does not consistently match the type which is returned in the description
26966 in 24.4.3.3.5 [move.iter.op.ref].
26967 </p>
26968
26969 <blockquote><pre>template &lt;class Iterator&gt;
26970 class move_iterator {
26971 public:
26972     ...
26973     typedef typename iterator_traits&lt;Iterator&gt;::pointer pointer;
26974     ...
26975     pointer operator-&gt;() const {return current;}
26976     ...
26977 private: 
26978     Iterator current; // exposition only
26979 };
26980 </pre></blockquote>
26981
26982
26983 <p>
26984 There are two possible fixes.
26985 </p>
26986
26987 <ol>
26988 <li><tt>pointer operator-&gt;() const {return &amp;*current;}</tt></li>
26989 <li><tt>typedef Iterator pointer;</tt></li>
26990 </ol>
26991
26992 <p>
26993 The first solution is the one chosen by <tt>reverse_iterator</tt>.  A potential
26994 disadvantage of this is it may not work well with iterators which return a
26995 proxy on dereference and that proxy has overloaded <tt>operator&amp;()</tt>.  Proxy
26996 references often need to overloaad <tt>operator&amp;()</tt> to return a proxy
26997 pointer.  That proxy pointer may or may not be the same type as the iterator's
26998 <tt>pointer</tt> type.
26999 </p>
27000
27001 <p>
27002 By simply returning the <tt>Iterator</tt> and taking advantage of the fact that
27003 the language forwards calls to <tt>operator-&gt;</tt> automatically until it
27004 finds a non-class type, the second solution avoids the issue of an overloaded
27005 <tt>operator&amp;()</tt> entirely.
27006 </p>
27007
27008 <p><b>Proposed resolution:</b></p>
27009 <p>
27010 Change the synopsis in 24.4.3.1 [move.iterator]:
27011 </p>
27012
27013 <blockquote><pre>typedef <del>typename iterator_traits&lt;</del>Iterator<del>&gt;::pointer</del> pointer;
27014 </pre></blockquote>
27015
27016
27017
27018
27019
27020
27021 <hr>
27022 <h3><a name="681"></a>681. Operator functions impossible to compare are defined in [re.submatch.op]</h3>
27023 <p><b>Section:</b> 28.9.2 [re.submatch.op] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27024  <b>Submitter:</b> Nozomu Katoo <b>Date:</b> 2007-05-27</p>
27025 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27026 <p><b>Discussion:</b></p>
27027 <p>
27028 In 28.9.2 [re.submatch.op] of N2284, 
27029 operator functions numbered 31-42 seem impossible to compare. &nbsp;E.g.: 
27030 </p>
27031
27032 <blockquote>
27033 <pre>template &lt;class BiIter&gt;
27034 &nbsp; &nbsp; bool operator==(typename iterator_traits&lt;BiIter&gt;::value_type const&amp; lhs,
27035 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const sub_match&lt;BiIter&gt;&amp; rhs);
27036 </pre>
27037 <blockquote>
27038 <p>
27039 -31- <i>Returns:</i> <tt>lhs == rhs.str()</tt>.
27040 </p>
27041 </blockquote>
27042 </blockquote>
27043
27044 <p>
27045 When <tt>char*</tt> is used as <tt>BiIter</tt>, <tt>iterator_traits&lt;BiIter&gt;::value_type</tt> would be 
27046 <tt>char</tt>, so that <tt>lhs == rhs.str()</tt> ends up comparing a <tt>char</tt> value and an object 
27047 of <tt>std::basic_string&lt;char&gt;</tt>. &nbsp;However, the behaviour of comparison between 
27048 these two types is not defined in 21.3.8 [string.nonmembers] of N2284.
27049 &nbsp;This applies when <tt>wchar_t*</tt> is used as <tt>BiIter</tt>. 
27050 </p>
27051
27052
27053 <p><b>Proposed resolution:</b></p>
27054 <p>
27055 Adopt the proposed resolution in
27056 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2409.pdf">N2409</a>.
27057 </p>
27058
27059
27060 <p><i>[
27061 Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue.
27062 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
27063 ]</i></p>
27064
27065
27066
27067
27068
27069 <hr>
27070 <h3><a name="682"></a>682. basic_regex ctor takes InputIterator or ForwardIterator?</h3>
27071 <p><b>Section:</b> 28.8.2 [re.regex.construct] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27072  <b>Submitter:</b> Eric Niebler <b>Date:</b> 2007-06-03</p>
27073 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27074 <p><b>Discussion:</b></p>
27075 <p>
27076 Looking at N2284, 28.8 [re.regex], p3 <tt>basic_regex</tt> class template synopsis shows this 
27077 constructor: 
27078 </p>
27079 <blockquote><pre>template &lt;class InputIterator&gt;
27080 &nbsp; &nbsp; &nbsp;basic_regex(InputIterator first, InputIterator last, 
27081 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;flag_type f = regex_constants::ECMAScript);
27082 </pre></blockquote>
27083
27084 <p>
27085 In 28.8.2 [re.regex.construct], p15, the constructor appears with this signature: 
27086 </p>
27087
27088 <blockquote><pre>template &lt;class ForwardIterator&gt;
27089 &nbsp; &nbsp; &nbsp;basic_regex(ForwardIterator first, ForwardIterator last, 
27090 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;flag_type f = regex_constants::ECMAScript);
27091 </pre></blockquote>
27092
27093 <p>
27094 <tt>ForwardIterator</tt> is probably correct, so the synopsis is wrong.
27095 </p>
27096
27097 <p><i>[
27098 John adds:
27099 ]</i></p>
27100
27101
27102 <blockquote>
27103 <p>
27104 I think either could be implemented? &nbsp;Although an input iterator would 
27105 probably require an internal copy of the string being made.
27106 </p>
27107 <p>
27108 I have no strong feelings either way, although I think my original intent 
27109 was <tt>InputIterator</tt>. 
27110 </p>
27111 </blockquote>
27112
27113
27114 <p><b>Proposed resolution:</b></p>
27115 <p>
27116 Adopt the proposed resolution in
27117 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2409.pdf">N2409</a>.
27118 </p>
27119
27120
27121 <p><i>[
27122 Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue.
27123 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
27124 ]</i></p>
27125
27126
27127
27128
27129
27130 <hr>
27131 <h3><a name="685"></a>685. reverse_iterator/move_iterator difference has invalid signatures</h3>
27132 <p><b>Section:</b> 24.4.1.3.19 [reverse.iter.opdiff], 24.4.3.3.14 [move.iter.nonmember] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27133  <b>Submitter:</b> Bo Persson <b>Date:</b> 2007-06-10</p>
27134 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27135 <p><b>Discussion:</b></p>
27136 <p>
27137 In C++03 the difference between two <tt>reverse_iterators</tt>
27138 </p>
27139 <blockquote><pre>ri1 - ri2
27140 </pre></blockquote>
27141 <p>
27142 is possible to compute only if both iterators have the same base 
27143 iterator. The result type is the <tt>difference_type</tt> of the base iterator. 
27144 </p>
27145 <p>
27146 In the current draft, the operator is defined as 24.4.1.3.19 [reverse.iter.opdiff] 
27147 </p>
27148 <blockquote><pre>template&lt;class Iterator1, class Iterator2&gt; 
27149 typename reverse_iterator&lt;Iterator&gt;::difference_type 
27150    operator-(const reverse_iterator&lt;Iterator1&gt;&amp; x, 
27151                     const reverse_iterator&lt;Iterator2&gt;&amp; y);
27152 </pre></blockquote>
27153 <p>
27154 The return type is the same as the C++03 one, based on the no longer 
27155 present <tt>Iterator</tt> template parameter. 
27156 </p>
27157 <p>
27158 Besides being slightly invalid, should this operator work only when 
27159 <tt>Iterator1</tt> and <tt>Iterator2</tt> has the same <tt>difference_type</tt>? Or should the 
27160 implementation choose one of them? Which one? 
27161 </p>
27162 <p>
27163 The same problem now also appears in <tt>operator-()</tt> for <tt>move_iterator</tt>
27164 24.4.3.3.14 [move.iter.nonmember]. 
27165 </p>
27166
27167
27168 <p><b>Proposed resolution:</b></p>
27169 <p>
27170 Change the synopsis in 24.4.1.1 [reverse.iterator]:
27171 </p>
27172
27173 <blockquote>
27174 <pre>template &lt;class Iterator1, class Iterator2&gt; 
27175   <del>typename reverse_iterator&lt;Iterator&gt;::difference_type</del> <ins>auto</ins> operator-( 
27176     const reverse_iterator&lt;Iterator1&gt;&amp; x, 
27177     const reverse_iterator&lt;Iterator2&gt;&amp; y)<ins> -&gt; decltype(y.current - x.current)</ins>;
27178 </pre>
27179 </blockquote>
27180
27181 <p>
27182 Change 24.4.1.3.19 [reverse.iter.opdiff]:
27183 </p>
27184
27185 <blockquote>
27186 <pre>template &lt;class Iterator1, class Iterator2&gt; 
27187   <del>typename reverse_iterator&lt;Iterator&gt;::difference_type</del> <ins>auto</ins> operator-( 
27188     const reverse_iterator&lt;Iterator1&gt;&amp; x, 
27189     const reverse_iterator&lt;Iterator2&gt;&amp; y)<ins> -&gt; decltype(y.current - x.current)</ins>;
27190 </pre>
27191 <blockquote>
27192 <p>
27193 <i>Returns:</i> <tt>y.current - x.current</tt>.
27194 </p>
27195 </blockquote>
27196 </blockquote>
27197
27198
27199 <p>
27200 Change the synopsis in 24.4.3.1 [move.iterator]:
27201 </p>
27202
27203 <blockquote>
27204 <pre>template &lt;class Iterator1, class Iterator2&gt; 
27205   <del>typename move_iterator&lt;Iterator&gt;::difference_type</del> <ins>auto</ins> operator-( 
27206     const move_iterator&lt;Iterator1&gt;&amp; x, 
27207     const move_iterator&lt;Iterator2&gt;&amp; y)<ins> -&gt; decltype(x.base() - y.base())</ins>;
27208 </pre>
27209 </blockquote>
27210
27211 <p>
27212 Change 24.4.3.3.14 [move.iter.nonmember]:
27213 </p>
27214
27215 <blockquote>
27216 <pre>template &lt;class Iterator1, class Iterator2&gt; 
27217   <del>typename move_iterator&lt;Iterator&gt;::difference_type</del> <ins>auto</ins> operator-( 
27218     const move_iterator&lt;Iterator1&gt;&amp; x, 
27219     const move_iterator&lt;Iterator2&gt;&amp; y)<ins> -&gt; decltype(x.base() - y.base())</ins>;
27220 </pre>
27221 <blockquote>
27222 <p>
27223 <i>Returns:</i> <tt>x.base() - y.base()</tt>.
27224 </p>
27225 </blockquote>
27226 </blockquote>
27227
27228 <p><i>[
27229 Pre Bellevue:  This issue needs to wait until the <tt>auto -&gt; return</tt> language feature
27230 goes in.
27231 ]</i></p>
27232
27233
27234
27235
27236
27237
27238
27239 <hr>
27240 <h3><a name="687"></a>687. shared_ptr conversion constructor not constrained</h3>
27241 <p><b>Section:</b> 20.7.12.2.1 [util.smartptr.shared.const], 20.7.12.3.1 [util.smartptr.weak.const] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27242  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2007-05-10</p>
27243 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.shared.const">issues</a> in [util.smartptr.shared.const].</p>
27244 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27245 <p><b>Discussion:</b></p>
27246 <p>
27247 Since all conversions from <tt>shared_ptr&lt;T&gt;</tt> to <tt>shared_ptr&lt;U&gt;</tt> have the same
27248 rank regardless of the relationship between <tt>T</tt> and <tt>U</tt>, reasonable user
27249 code that works with raw pointers fails with <tt>shared_ptr</tt>:
27250 </p>
27251
27252 <blockquote><pre>void f( shared_ptr&lt;void&gt; );
27253 void f( shared_ptr&lt;int&gt; );
27254
27255 int main()
27256 {
27257 &nbsp;&nbsp;f( shared_ptr&lt;double&gt;() ); // ambiguous
27258 }
27259 </pre></blockquote>
27260
27261 <p>
27262 Now that we officially have <tt>enable_if</tt>, we can constrain the constructor
27263 and the corresponding assignment operator to only participate in the
27264 overload resolution when the pointer types are compatible.
27265 </p>
27266
27267
27268 <p><b>Proposed resolution:</b></p>
27269 <p>
27270 In 20.7.12.2.1 [util.smartptr.shared.const], change:
27271 </p>
27272
27273 <blockquote><p>
27274 -14- <i>Requires:</i> <del>For the second constructor</del> <ins>The
27275 second constructor shall not participate in the overload resolution
27276 unless</ins> <tt>Y*</tt> <del>shall be</del> <ins>is implicitly</ins> convertible
27277 to <tt>T*</tt>.
27278 </p></blockquote>
27279
27280 <p>
27281 In 20.7.12.3.1 [util.smartptr.weak.const], change:
27282 </p>
27283
27284 <blockquote>
27285 <pre><del>template&lt;class Y&gt; weak_ptr(shared_ptr&lt;Y&gt; const&amp; r);</del>
27286 <del>weak_ptr(weak_ptr const&amp; r);</del>
27287 <del>template&lt;class Y&gt; weak_ptr(weak_ptr&lt;Y&gt; const&amp; r);</del>
27288 <ins>weak_ptr(weak_ptr const&amp; r);</ins>
27289 <ins>template&lt;class Y&gt; weak_ptr(weak_ptr&lt;Y&gt; const&amp; r);</ins>
27290 <ins>template&lt;class Y&gt; weak_ptr(shared_ptr&lt;Y&gt; const&amp; r);</ins>
27291 </pre>
27292 <blockquote><p>
27293 -4- <i>Requires:</i> <del>For</del> <del>t</del><ins>T</ins>he second and
27294 third constructors<del>,</del> <ins>shall not participate in the
27295 overload resolution unless</ins> <tt>Y*</tt> <del>shall be</del>
27296 <ins>is implicitly</ins> convertible to <tt>T*</tt>.
27297 </p></blockquote>
27298 </blockquote>
27299
27300
27301
27302
27303
27304
27305 <hr>
27306 <h3><a name="689"></a>689. reference_wrapper constructor overly constrained</h3>
27307 <p><b>Section:</b> 20.6.5.1 [refwrap.const] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27308  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2007-05-10</p>
27309 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#refwrap.const">issues</a> in [refwrap.const].</p>
27310 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27311 <p><b>Discussion:</b></p>
27312 <p>
27313 The constructor of <tt>reference_wrapper</tt> is currently <tt>explicit</tt>. The primary
27314 motivation behind this is the safety problem with respect to rvalues,
27315 which is addressed by the proposed resolution of the previous issue.
27316 Therefore we should consider relaxing the requirements on the
27317 constructor since requests for the implicit conversion keep resurfacing.
27318 </p>
27319 <p>
27320 Also please see the thread starting at c++std-lib-17398 for some good discussion on this subject.
27321 </p>
27322
27323
27324 <p><b>Proposed resolution:</b></p>
27325 <p>
27326 Remove the <tt>explicit</tt> from the constructor of <tt>reference_wrapper</tt>. If the
27327 proposed resolution of the previous issue is accepted, remove the
27328 <tt>explicit</tt> from the <tt>T&amp;&amp;</tt> constructor as well to keep them in sync.
27329 </p>
27330
27331
27332
27333
27334
27335 <hr>
27336 <h3><a name="693"></a>693. <code>std::bitset::all()</code> missing</h3>
27337 <p><b>Section:</b> 23.3.5 [template.bitset] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27338  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-06-22</p>
27339 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#template.bitset">issues</a> in [template.bitset].</p>
27340 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27341 <p><b>Discussion:</b></p>
27342 <p>
27343 The  <code>bitset</code> class template  provides the  member function
27344 <code>any()</code> to determine whether an  object of the type has any
27345 bits  set, and  the member  function <code>none()</code>  to determine
27346 whether all of an object's  bits are clear. However, the template does
27347 not   provide  a   corresponding  function   to  discover   whether  a
27348 <code>bitset</code>  object  has  all  its  bits  set.   While  it  is
27349 possible,  even easy,  to  obtain this  information  by comparing  the
27350 result of <code>count()</code>  with the result of <code>size()</code>
27351 for  equality  (i.e.,  via  <code>b.count()  ==  b.size()</code>)  the
27352 operation  is   less  efficient   than  a  member   function  designed
27353 specifically  for that purpose  could be.   (<code>count()</code> must
27354 count  all non-zero bits  in a  <code>bitset</code> a  word at  a time
27355 while <code>all()</code> could stop counting as soon as it encountered
27356 the first word with a zero bit).
27357 </p>
27358
27359
27360 <p><b>Proposed resolution:</b></p>
27361 <p>
27362 Add  a declaration of the new  member function <code>all()</code> to the
27363 defintion of the <code>bitset</code> template in 23.3.5 [template.bitset], p1,
27364 right above the declaration of <code>any()</code> as shown below:
27365 </p>
27366
27367 <blockquote><pre>bool operator!=(const bitset&lt;N&gt;&amp; rhs) const;
27368 bool test(size_t pos) const;
27369 <ins>bool all() const;</ins>
27370 bool any() const;
27371 bool none() const;
27372 </pre></blockquote>
27373
27374 <p>
27375 Add a description of the new member function to the end of 23.3.5.2 [bitset.members] with the following text:
27376 </p>
27377 <blockquote><p>
27378 <code>bool all() const;</code>
27379 </p>
27380 <blockquote>
27381 <i>Returns</i>: <code>count() == size()</code>.
27382 </blockquote>
27383 </blockquote>
27384
27385 <p>
27386 In  addition,   change  the  description   of  <code>any()</code>  and
27387 <code>none()</code>   for  consistency   with   <code>all()</code>  as
27388 follows:
27389 </p>
27390 <blockquote><p>
27391 <code>bool any() const;</code>
27392 </p>
27393 <blockquote>
27394 <p>
27395 <i>Returns</i>: <del><code>true</code> if any bit in <code>*this</code>
27396 is one</del><ins><code>count() != 0</code></ins>.
27397 </p>
27398 </blockquote>
27399 <p>
27400 <code>bool none() const;</code>
27401 </p>
27402 <blockquote>
27403 <p>
27404 <i>Returns</i>: <del><code>true</code> if no bit in <code>*this</code>
27405 is one</del><ins><code>count() == 0</code></ins>.
27406 </p>
27407 </blockquote>
27408 </blockquote>
27409
27410
27411
27412
27413
27414 <hr>
27415 <h3><a name="694"></a>694. <code>std::bitset</code> and <code>long long</code></h3>
27416 <p><b>Section:</b> 23.3.5 [template.bitset] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27417  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-06-22</p>
27418 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#template.bitset">issues</a> in [template.bitset].</p>
27419 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27420 <p><b>Discussion:</b></p>
27421 <p>
27422 Objects of the  <code>bitset</code> class template specializations can
27423 be constructed from  and explicitly converted to values  of the widest
27424 C++ integer  type, <code>unsigned long</code>.   With the introduction
27425 of  <code>long long</code> into  the language  the template  should be
27426 enhanced to make it possible  to interoperate with values of this type
27427 as well, or  perhaps <code>uintmax_t</code>.  See c++std-lib-18274 for
27428 a brief discussion in support of this change.
27429 </p>
27430
27431
27432 <p><b>Proposed resolution:</b></p>
27433 <p>
27434 For simplicity,  instead of  adding overloads for  <code>unsigned long
27435 long</code> and dealing with possible ambiguities in the spec, replace
27436 the <code>bitset</code> ctor  that takes an <code>unsigned long</code>
27437 argument  with  one  taking  <code>unsigned long  long</code>  in  the
27438 definition  of the  template as  shown below.   (The  standard permits
27439 implementations  to add  overloads on  other integer  types  or employ
27440 template tricks to  achieve the same effect provided  they don't cause
27441 ambiguities or changes in behavior.)
27442 </p>
27443 <blockquote>
27444 <pre>// [bitset.cons] constructors:
27445 bitset();
27446 bitset(unsigned <ins>long</ins> long val);
27447 template&lt;class charT, class traits, class Allocator&gt;
27448 explicit bitset(
27449                 const basic_string&lt;charT,traits,Allocator&gt;&amp; str,
27450                 typename basic_string&lt;charT,traits,Allocator&gt;::size_type pos = 0,
27451                 typename basic_string&lt;charT,traits,Allocator&gt;::size_type n =
27452                     basic_string&lt;charT,traits,Allocator&gt;::npos);
27453 </pre>
27454 </blockquote>
27455 <p>
27456 Make a corresponding change in 23.3.5.1 [bitset.cons], p2:
27457 </p>
27458 <blockquote>
27459 <p>
27460 <code>bitset(unsigned <ins>long</ins> long val);</code>
27461 </p>
27462 <blockquote>
27463 <i>Effects</i>:  Constructs   an  object  of   class  bitset&lt;N&gt;,
27464 initializing  the  first <code><i>M</i></code>  bit  positions to  the
27465 corresponding      bit     values      in     <code><i>val</i></code>.
27466 <code><i>M</i></code> is the  smaller of <code><i>N</i></code> and the
27467 number of bits in  the value representation (section [basic.types]) of
27468 <code>unsigned  <ins> long</ins> long</code>.   If  <code><i>M</i> &lt;
27469 <i>N</i></code>  <ins>is  <code>true</code></ins>,  the remaining  bit
27470 positions are initialized to zero.
27471 </blockquote>
27472 </blockquote>
27473
27474 <p>
27475 Additionally, introduce a new member function <code>to_ullong()</code>
27476 to make  it possible to  convert <code>bitset</code> to values  of the
27477 new  type. Add  the following  declaration  to the  definition of  the
27478 template, immediate  after the declaration  of <code>to_ulong()</code>
27479 in 23.3.5 [template.bitset], p1, as shown below:
27480 </p>
27481 <blockquote>
27482 <pre>// element access:
27483 bool operator[](size_t pos) const; // for b[i];
27484 reference operator[](size_t pos); // for b[i];
27485 unsigned long to_ulong() const;
27486 <ins>unsigned long long to_ullong() const;</ins>
27487 template &lt;class charT, class traits, class Allocator&gt;
27488 basic_string&lt;charT, traits, Allocator&gt; to_string() const;
27489 </pre>
27490 </blockquote>
27491 <p>
27492 And add a description of  the new member function to 23.3.5.2 [bitset.members],
27493 below  the  description of  the  existing <code>to_ulong()</code>  (if
27494 possible), with the following text:
27495 </p>
27496 <blockquote>
27497 <p>
27498 <code>unsigned long long to_ullong() const;</code>
27499 </p>
27500 <blockquote>
27501 <i>Throws</i>:  <code>overflow_error</code>   if  the  integral  value
27502 <code><i>x</i></code> corresponding to  the bits in <code>*this</code>
27503 cannot be represented as type <code>unsigned long long</code>.
27504 </blockquote>
27505 <blockquote>
27506 <i>Returns:</i> <code><i>x</i></code>.
27507 </blockquote>
27508 </blockquote>
27509
27510
27511
27512
27513
27514 <hr>
27515 <h3><a name="695"></a>695. ctype&lt;char&gt;::classic_table() not accessible</h3>
27516 <p><b>Section:</b> 22.2.1.3 [facet.ctype.special] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27517  <b>Submitter:</b> Martin Sebor <b>Date:</b> 2007-06-22</p>
27518 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27519 <p><b>Discussion:</b></p>
27520 <p>
27521 The   <code>ctype&lt;char&gt;::classic_table()</code>   static  member
27522 function    returns    a    pointer    to   an    array    of    const
27523 <code>ctype_base::mask</code>    objects    (enums)   that    contains
27524 <code>ctype&lt;char&gt;::table_size</code>    elements.    The   table
27525 describes the properties of the character set in the "C" locale (i.e.,
27526 whether a  character at an index  given by its value  is alpha, digit,
27527 punct,   etc.),   and   is    typically   used   to   initialize   the
27528 <code>ctype&lt;char&gt;</code>  facet in the  classic "C"  locale (the
27529 protected      <code>ctype&lt;char&gt;</code>      member     function
27530 <code>table()</code>    then    returns     the    same    value    as
27531 <code>classic_table()</code>).
27532 </p>
27533 <p>
27534 However, while <code>ctype&lt;char&gt;::table_size</code> (the size of
27535 the   table)    is   a   public    static   const   member    of   the
27536 <code>ctype&lt;char&gt;</code>           specialization,           the
27537 <code>classic_table()</code> static member function is protected. That
27538 makes getting at the classic  data less than convenient (i.e., one has
27539 to create  a whole derived class just  to get at the  masks array). It
27540 makes  little sense  to expose  the size  of the  table in  the public
27541 interface while making the table itself protected, especially when the
27542 table is a constant object.
27543 </p>
27544 <p>
27545 The  same argument  can be  made for  the non-static  protected member
27546 function <code>table()</code>.
27547 </p>
27548
27549
27550 <p><b>Proposed resolution:</b></p>
27551 <p>
27552 Make     the    <code>ctype&lt;char&gt;::classic_table()</code>    and
27553 <code>ctype&lt;char&gt;::table()</code>  member  functions  public  by
27554 moving their declarations into the public section of the definition of
27555 specialization in 22.2.1.3 [facet.ctype.special] as shown below:
27556 </p>
27557 <blockquote>
27558 <pre>  static locale::id id;
27559   static const size_t table_size = IMPLEMENTATION_DEFINED;
27560 <del>protected:</del>
27561   const mask* table() const throw();
27562   static const mask* classic_table() throw();
27563 <ins>protected:</ins>
27564
27565 ~ctype(); // virtual
27566 virtual char do_toupper(char c) const;
27567 </pre>
27568 </blockquote>
27569
27570
27571
27572
27573
27574 <hr>
27575 <h3><a name="699"></a>699. N2111 changes min/max</h3>
27576 <p><b>Section:</b> 26.4 [rand] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27577  <b>Submitter:</b> P.J. Plauger <b>Date:</b> 2007-07-01</p>
27578 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand">issues</a> in [rand].</p>
27579 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27580 <p><b>Discussion:</b></p>
27581 <p>
27582 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2111.pdf">N2111</a>
27583 changes <tt>min/max</tt> in several places in random from member
27584 functions to static data members. I believe this introduces
27585 a needless backward compatibility problem between C++0X and
27586 TR1. I'd like us to find new names for the static data members,
27587 or perhaps change <tt>min/max</tt> to <tt>constexpr</tt>s in C++0X.
27588 </p>
27589
27590 <p>
27591 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
27592 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
27593 for some further discussion.
27594 </p>
27595
27596
27597 <p><b>Proposed resolution:</b></p>
27598 <p>
27599 Adopt the proposed resolution in
27600 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
27601 </p>
27602
27603
27604 <p><i>[
27605 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
27606 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
27607 ]</i></p>
27608
27609
27610
27611
27612
27613 <hr>
27614 <h3><a name="700"></a>700. N1856 defines struct <tt>identity</tt></h3>
27615 <p><b>Section:</b> 20.2.2 [forward] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27616  <b>Submitter:</b> P.J. Plauger <b>Date:</b> 2007-07-01</p>
27617 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#forward">active issues</a> in [forward].</p>
27618 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#forward">issues</a> in [forward].</p>
27619 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27620 <p><b>Discussion:</b></p>
27621 <p>
27622 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1856.html">N1856</a>
27623 defines struct <tt>identity</tt> in <tt>&lt;utility&gt;</tt> which clashes with
27624 the traditional definition of struct <tt>identity</tt> in <tt>&lt;functional&gt;</tt>
27625 (not standard, but a common extension from old STL). Be nice
27626 if we could avoid this name clash for backward compatibility.
27627 </p>
27628
27629
27630 <p><b>Proposed resolution:</b></p>
27631 <p>
27632 Change 20.2.2 [forward]:
27633 </p>
27634
27635 <blockquote>
27636 <pre>template &lt;class T&gt; struct identity
27637 {
27638     typedef T type;
27639     <ins>const T&amp; operator()(const T&amp; x) const;</ins>
27640 };
27641 </pre>
27642 <blockquote>
27643 <pre><ins>const T&amp; operator()(const T&amp; x) const;</ins>
27644 </pre>
27645 <blockquote>
27646 <p>
27647 <ins><i>Returns:</i> <tt>x</tt>.</ins>
27648 </p>
27649 </blockquote>
27650 </blockquote>
27651
27652 </blockquote>
27653
27654
27655
27656
27657
27658
27659 <hr>
27660 <h3><a name="703"></a>703. <tt>map::at()</tt> need a complexity specification</h3>
27661 <p><b>Section:</b> 23.3.1.2 [map.access] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27662  <b>Submitter:</b> Joe Gottman <b>Date:</b> 2007-07-03</p>
27663 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#map.access">issues</a> in [map.access].</p>
27664 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27665 <p><b>Discussion:</b></p>
27666 <p>
27667 <tt>map::at()</tt> need a complexity specification.
27668 </p>
27669
27670
27671 <p><b>Proposed resolution:</b></p>
27672 <p>
27673 Add the following to the specification of <tt>map::at()</tt>, 23.3.1.2 [map.access]:
27674 </p>
27675 <blockquote>
27676 <p>
27677 <i>Complexity:</i> logarithmic.
27678 </p>
27679 </blockquote>
27680
27681
27682
27683
27684
27685 <hr>
27686 <h3><a name="705"></a>705. type-trait <tt>decay</tt> incompletely specified</h3>
27687 <p><b>Section:</b> 20.5.7 [meta.trans.other] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27688  <b>Submitter:</b> Thorsten Ottosen <b>Date:</b> 2007-07-08</p>
27689 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#meta.trans.other">active issues</a> in [meta.trans.other].</p>
27690 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#meta.trans.other">issues</a> in [meta.trans.other].</p>
27691 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27692 <p><b>Discussion:</b></p>
27693 <p>
27694 The current working draft has a type-trait <tt>decay</tt> in 20.5.7 [meta.trans.other].
27695 </p>
27696
27697 <p>
27698 Its use is to turn C++03 pass-by-value parameters into efficient C++0x
27699 pass-by-rvalue-reference parameters. However, the current definition
27700 introduces an incompatible change where the cv-qualification of the
27701 parameter type is retained. The deduced type should loose such
27702 cv-qualification, as pass-by-value does.
27703 </p>
27704
27705
27706 <p><b>Proposed resolution:</b></p>
27707 <p>
27708 In 20.5.7 [meta.trans.other] change the last sentence:
27709 </p>
27710
27711 <blockquote><p>
27712 Otherwise the  member typedef <tt>type</tt> equals <tt><ins>remove_cv&lt;</ins>U<ins>&gt;::type</ins></tt>.
27713 </p></blockquote>
27714
27715 <p>
27716 In 20.4.1.3 [tuple.creation]/1 change:
27717 </p>
27718
27719 <blockquote><p>
27720 <del>where each <tt>Vi</tt> in <tt>VTypes</tt> is <tt>X&amp;</tt> if, for the
27721 corresponding type <tt>Ti</tt> in <tt>Types</tt>,
27722 <tt>remove_cv&lt;remove_reference&lt;Ti&gt;::type&gt;::type</tt> equals
27723 <tt>reference_wrapper&lt;X&gt;</tt>, otherwise <tt>Vi</tt> is
27724 <tt>decay&lt;Ti&gt;::type</tt>.</del>
27725 <ins>Let <tt>Ui</tt> be <tt>decay&lt;Ti&gt;::type</tt> for each
27726 <tt>Ti</tt> in <tt>Types</tt>. Then each <tt>Vi</tt> in <tt>VTypes</tt>
27727 is <tt>X&amp;</tt> if <tt>Ui</tt> equals
27728 <tt>reference_wrapper&lt;X&gt;</tt>, otherwise <tt>Vi</tt> is
27729 <tt>Ui</tt>.</ins>
27730 </p></blockquote>
27731
27732
27733
27734
27735
27736
27737 <hr>
27738 <h3><a name="706"></a>706. <tt>make_pair()</tt> should behave as <tt>make_tuple()</tt> wrt. <tt>reference_wrapper()</tt></h3>
27739 <p><b>Section:</b> 20.2.3 [pairs] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27740  <b>Submitter:</b> Thorsten Ottosen <b>Date:</b> 2007-07-08</p>
27741 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#pairs">issues</a> in [pairs].</p>
27742 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27743 <p><b>Discussion:</b></p>
27744 <p>
27745 The current draft has <tt>make_pair()</tt> in 20.2.3 [pairs]/16
27746 and <tt>make_tuple()</tt> in 20.4.1.3 [tuple.creation].
27747 <tt>make_tuple()</tt> detects the presence of
27748 <tt>reference_wrapper&lt;X&gt;</tt> arguments and "unwraps" the reference in
27749 such cases. <tt>make_pair()</tt> would OTOH create a
27750 <tt>reference_wrapper&lt;X&gt;</tt> member. I suggest that the two
27751 functions are made to behave similar in this respect to minimize
27752 confusion.
27753 </p>
27754
27755
27756 <p><b>Proposed resolution:</b></p>
27757 <p>
27758 In 20.2 [utility] change the synopsis for make_pair() to read
27759 </p>
27760
27761 <blockquote><pre>template &lt;class T1, class T2&gt;
27762   pair&lt;<del>typename decay&lt;T1&gt;::type</del> <ins>V1</ins>, <del>typename decay&lt;T2&gt;::type</del> <ins>V2</ins>&gt; make_pair(T1&amp;&amp;, T2&amp;&amp;);
27763 </pre></blockquote>
27764
27765 <p>
27766 In 20.2.3 [pairs]/16 change the declaration to match the above synopsis.
27767 Then change the 20.2.3 [pairs]/17 to:
27768 </p>
27769
27770 <blockquote>
27771 <p>
27772 <i>Returns:</i> <tt>pair&lt;<del>typename decay&lt;T1&gt;::type</del> <ins>V1</ins>,<del>typename decay&lt;T2&gt;::type</del> <ins>V2</ins>&gt;(forward&lt;T1&gt;(x),forward&lt;T2&gt;(y))</tt> <ins>where <tt>V1</tt> and
27773 <tt>V2</tt> are determined as follows: Let <tt>Ui</tt> be
27774 <tt>decay&lt;Ti&gt;::type</tt> for each <tt>Ti</tt>. Then each
27775 <tt>Vi</tt> is <tt>X&amp;</tt> if <tt>Ui</tt> equals
27776 <tt>reference_wrapper&lt;X&gt;</tt>, otherwise <tt>Vi</tt> is
27777 <tt>Ui</tt>.</ins>
27778 </p>
27779 </blockquote>
27780
27781
27782
27783
27784
27785
27786 <hr>
27787 <h3><a name="710"></a>710. Missing postconditions</h3>
27788 <p><b>Section:</b> 20.7.12.2 [util.smartptr.shared] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27789  <b>Submitter:</b> Peter Dimov <b>Date:</b> 2007-08-24</p>
27790 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#util.smartptr.shared">active issues</a> in [util.smartptr.shared].</p>
27791 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#util.smartptr.shared">issues</a> in [util.smartptr.shared].</p>
27792 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27793 <p><b>Discussion:</b></p>
27794 <p>
27795 A discussion on
27796 <a href="http://groups.google.com/group/comp.std.c++/browse_frm/thread/8e89dceb35cd7971">comp.std.c++</a>
27797 has identified a contradiction in the <tt>shared_ptr</tt> specification.
27798 The <tt>shared_ptr</tt> move constructor and the cast functions are
27799 missing postconditions for the <tt>get()</tt> accessor.
27800 </p>
27801
27802 <p><i>[
27803 Bellevue:
27804 ]</i></p>
27805
27806
27807 <blockquote>
27808 <p>
27809 Move to "ready", adopting the first (Peter's) proposed resolution.
27810 </p>
27811 <p>
27812 Note to the project editor: there is an editorial issue here. The
27813 wording for the postconditions of the casts is slightly awkward, and the
27814 editor should consider rewording "If w is the return value...", e. g. as
27815 "For a return value w...".
27816 </p>
27817 </blockquote>
27818
27819
27820 <p><b>Proposed resolution:</b></p>
27821 <p>
27822 Add to 20.7.12.2.1 [util.smartptr.shared.const]:
27823 </p>
27824
27825 <blockquote>
27826 <pre>shared_ptr(shared_ptr&amp;&amp; r);
27827 template&lt;class Y&gt; shared_ptr(shared_ptr&lt;Y&gt;&amp;&amp; r);
27828 </pre>
27829 <blockquote>
27830 <p>
27831 <i>Postconditions:</i>  <tt>*this</tt> shall contain the old value of <tt>r</tt>. <tt>r</tt>
27832 shall be empty. <ins><tt>r.get() == 0</tt>.</ins>
27833 </p>
27834 </blockquote>
27835 </blockquote>
27836
27837 <p>
27838 Add to 20.7.12.2.10 [util.smartptr.shared.cast]:
27839 </p>
27840
27841 <blockquote>
27842 <pre>template&lt;class T, class U&gt; shared_ptr&lt;T&gt; static_pointer_cast(shared_ptr&lt;U&gt; const&amp; r);
27843 </pre>
27844 <blockquote>
27845 <p>
27846 <ins><i>Postconditions:</i> If <tt>w</tt> is the return value,
27847 <tt>w.get() == static_cast&lt;T*&gt;(r.get()) &amp;&amp; w.use_count() == r.use_count()</tt>.</ins>
27848 </p>
27849 </blockquote>
27850 </blockquote>
27851
27852 <blockquote>
27853 <pre>template&lt;class T, class U&gt; shared_ptr&lt;T&gt; dynamic_pointer_cast(shared_ptr&lt;U&gt; const&amp; r);
27854 </pre>
27855 <blockquote>
27856 <p>
27857 <ins><i>Postconditions:</i> If <tt>w</tt> is the return value, <tt>w.get() == dynamic_cast&lt;T*&gt;(r.get())</tt>.</ins>
27858 </p>
27859 </blockquote>
27860 </blockquote>
27861
27862 <blockquote>
27863 <pre>template&lt;class T, class U&gt; shared_ptr&lt;T&gt; const_pointer_cast(shared_ptr&lt;U&gt; const&amp; r);
27864 </pre>
27865 <blockquote>
27866 <p>
27867 <ins><i>Postconditions:</i> If <tt>w</tt> is the return value,
27868 <tt>w.get() == const_cast&lt;T*&gt;(r.get()) &amp;&amp; w.use_count() == r.use_count()</tt>.</ins>
27869 </p>
27870 </blockquote>
27871 </blockquote>
27872
27873 <p>
27874 Alberto Ganesh Barbati has written an
27875 <a href="http://barbati.net/c++/shared_ptr.pdf">alternative proposal</a>
27876 where he suggests (among other things) that the casts be respecified in terms of
27877 the aliasing constructor as follows:
27878 </p>
27879
27880 <p>
27881 Change 20.7.12.2.10 [util.smartptr.shared.cast]:
27882 </p>
27883
27884 <blockquote>
27885 <p>
27886 -2- <i>Returns:</i> <del>If <tt>r</tt> is empty, an <tt>empty
27887 shared_ptr&lt;T&gt;;</tt> otherwise, a <tt>shared_ptr&lt;T&gt;</tt>
27888 object that stores <tt>static_cast&lt;T*&gt;(r.get())</tt> and shares ownership with
27889 <tt>r</tt>.</del> <ins><tt>shared_ptr&lt;T&gt;(r, static_cast&lt;T*&gt;(r.get())</tt>.</ins>
27890 </p>
27891 </blockquote>
27892
27893 <blockquote>
27894 <p>
27895 -6- <i>Returns:</i>
27896 </p>
27897 <ul>
27898 <li><del>When <tt>dynamic_cast&lt;T*&gt;(r.get())</tt> returns a nonzero value,
27899 a <tt>shared_ptr&lt;T&gt;</tt> object that stores a copy 
27900 of it and <i>shares ownership</i> with <tt>r</tt>;</del></li>
27901 <li><del>Otherwise, an <i>empty</i> <tt>shared_ptr&lt;T&gt;</tt> object.</del></li>
27902 <li><ins>If <tt>p = dynamic_cast&lt;T*&gt;(r.get())</tt> is a non-null pointer, <tt>shared_ptr&lt;T&gt;(r, p);</tt></ins></li>
27903 <li><ins>Otherwise, <tt>shared_ptr&lt;T&gt;()</tt>.</ins></li>
27904 </ul>
27905 </blockquote>
27906
27907 <blockquote>
27908 <p>
27909 -10- <i>Returns:</i> <del>If <tt>r</tt> is empty, an <tt>empty
27910 shared_ptr&lt;T&gt;;</tt> otherwise, a <tt>shared_ptr&lt;T&gt;</tt>
27911 object that stores <tt>const_cast&lt;T*&gt;(r.get())</tt> and shares ownership with
27912 <tt>r</tt>.</del> <ins><tt>shared_ptr&lt;T&gt;(r, const_cast&lt;T*&gt;(r.get())</tt>.</ins>
27913 </p>
27914 </blockquote>
27915
27916 <p>
27917 This takes care of the missing postconditions for the casts by bringing
27918 in the aliasing constructor postcondition "by reference".
27919 </p>
27920
27921
27922
27923
27924
27925
27926 <hr>
27927 <h3><a name="712"></a>712. <tt>seed_seq::size</tt> no longer useful</h3>
27928 <p><b>Section:</b> 26.4.7.1 [rand.util.seedseq] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27929  <b>Submitter:</b> Marc Paterno <b>Date:</b> 2007-08-25</p>
27930 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#rand.util.seedseq">active issues</a> in [rand.util.seedseq].</p>
27931 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.util.seedseq">issues</a> in [rand.util.seedseq].</p>
27932 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27933 <p><b>Discussion:</b></p>
27934 <p>
27935 One of the motivations for incorporating <tt>seed_seq::size()</tt>
27936 was to simplify the wording
27937 in other parts of 26.4 [rand].
27938 As a side effect of resolving related issues,
27939 all such references
27940 to <tt>seed_seq::size()</tt> will have been excised.
27941 More importantly,
27942 the present specification is contradictory,
27943 as "The number of 32-bit units the object can deliver"
27944 is not the same as "the result of <tt>v.size()</tt>."
27945 </p>
27946
27947 <p>
27948 See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2391.pdf">N2391</a> and
27949 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>
27950 for some further discussion.
27951 </p>
27952
27953
27954 <p><b>Proposed resolution:</b></p>
27955 <p>
27956 Adopt the proposed resolution in
27957 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2423.pdf">N2423</a>.
27958 </p>
27959
27960
27961 <p><i>[
27962 Kona (2007): The LWG adopted the proposed resolution of N2423 for this issue.
27963 The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona.
27964 ]</i></p>
27965
27966
27967
27968
27969
27970 <hr>
27971 <h3><a name="715"></a>715. <tt>minmax_element</tt> complexity is too lax</h3>
27972 <p><b>Section:</b> 25.3.7 [alg.min.max] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
27973  <b>Submitter:</b> Matt Austern <b>Date:</b> 2007-08-30</p>
27974 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#alg.min.max">issues</a> in [alg.min.max].</p>
27975 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
27976 <p><b>Discussion:</b></p>
27977 <p>
27978 The complexity for <tt>minmax_element</tt> (25.3.7 [alg.min.max] par 16) says "At most <tt>max(2 *
27979 (last - first ) - 2, 0)</tt> applications of the corresponding comparisons",
27980 i.e. the worst case complexity is no better than calling <tt>min_element</tt> and
27981 <tt>max_element</tt> separately. This is gratuitously inefficient. There is a
27982 well known technique that does better: see section 9.1 of CLRS
27983 (Introduction to Algorithms, by Cormen, Leiserson, Rivest, and Stein).
27984 </p>
27985
27986
27987 <p><b>Proposed resolution:</b></p>
27988 <p>
27989 Change 25.3.7 [alg.min.max] to:
27990 </p>
27991
27992 <blockquote>
27993 <pre>template&lt;class ForwardIterator&gt; 
27994   pair&lt;ForwardIterator, ForwardIterator&gt; 
27995     minmax_element(ForwardIterator first , ForwardIterator last); 
27996 template&lt;class ForwardIterator, class Compare&gt; 
27997   pair&lt;ForwardIterator, ForwardIterator&gt; 
27998     minmax_element(ForwardIterator first , ForwardIterator last , Compare comp);
27999 </pre>
28000 <blockquote>
28001 <p>
28002 <i>Returns:</i> <tt>make_pair(m, M)</tt>, where <tt>m</tt> is
28003 <del><tt>min_element(first, last)</tt> or <tt>min_element(first, last,
28004 comp)</tt></del> <ins>the first iterator in <tt>[first,
28005 last)</tt> such that no iterator in the range refers to a smaller element,</ins> and
28006 <ins>where</ins> <tt>M</tt> is <del><tt>max_element(first, last)</tt> or
28007 <tt>max_element(first, last, comp)</tt></del> <ins>the last iterator
28008 in <tt>[first, last)</tt> such that no iterator in the range refers to a larger element</ins>.
28009 </p>
28010 <p>
28011 <i>Complexity:</i> At most <del><tt>max(2 * (last - first ) - 2, 0)</tt></del>
28012 <ins><tt>max(&#8970;(3/2) (N-1)&#8971;, 0)</tt></ins> applications of the
28013 corresponding <del>comparisons</del> <ins>predicate, where <tt>N</tt> is <tt>distance(first, last)</tt></ins>.
28014 </p>
28015 </blockquote>
28016 </blockquote>
28017
28018
28019
28020
28021
28022
28023 <hr>
28024 <h3><a name="722"></a>722. Missing [c.math] functions <tt>nanf</tt> and <tt>nanl</tt></h3>
28025 <p><b>Section:</b> 26.7 [c.math] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28026  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2007-08-27</p>
28027 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#c.math">issues</a> in [c.math].</p>
28028 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28029 <p><b>Discussion:</b></p>
28030 <p>
28031 In the listing of 26.7 [c.math], table 108: Header <tt>&lt;cmath&gt;</tt> synopsis I miss
28032 the following C99 functions (from 7.12.11.2):
28033 </p>
28034
28035 <blockquote><pre>float nanf(const char *tagp);
28036 long double nanl(const char *tagp);
28037 </pre></blockquote>
28038
28039 <p>
28040 (Note: These functions cannot be overloaded and they are also not
28041 listed anywhere else)
28042 </p>
28043
28044
28045 <p><b>Proposed resolution:</b></p>
28046 <p>
28047 In 26.7 [c.math], table 108, section "Functions", add <tt>nanf</tt> and <tt>nanl</tt>
28048 just after the existing entry <tt>nan</tt>.
28049 </p>
28050
28051
28052
28053
28054
28055 <hr>
28056 <h3><a name="740"></a>740. Please remove <tt>*_ptr&lt;T[N]&gt;</tt></h3>
28057 <p><b>Section:</b> 20.7.11.4 [unique.ptr.compiletime] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28058  <b>Submitter:</b> Herb Sutter <b>Date:</b> 2007-10-04</p>
28059 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28060 <p><b>Discussion:</b></p>
28061 <p>
28062 Please don't provide <tt>*_ptr&lt;T[N]&gt;</tt>. It doesn't enable any useful
28063 bounds-checking (e.g., you could imagine that doing <tt>op++</tt> on a
28064 <tt>shared_ptr&lt;T[N]&gt;</tt> yields a <tt>shared_ptr&lt;T[N-1]&gt;</tt>, but that promising path
28065 immediately falters on <tt>op--</tt> which can't reliably dereference because we
28066 don't know the lower bound). Also, most buffers you'd want to point to
28067 don't have a compile-time known size.
28068 </p>
28069
28070 <p>
28071 To enable any bounds-checking would require run-time information, with
28072 the usual triplet: base (lower bound), current offset, and max offset
28073 (upper  bound). And I can sympathize with the point of view that you
28074 wouldn't want to require this on <tt>*_ptr</tt> itself. But please let's not
28075 follow the <tt>&lt;T[N]&gt;</tt> path, especially not with additional functions to
28076 query the bounds etc., because this sets wrong user expectations by
28077 embarking on a path that doesn't go all the way to bounds checking as it
28078 seems to imply.
28079 </p>
28080
28081 <p>
28082 If bounds checking is desired, consider a <tt>checked_*_ptr</tt> instead (e.g.,
28083 <tt>checked_shared_ptr</tt>). And make the interfaces otherwise identical so that
28084 user code could easily <tt>#define/typedef</tt> between prepending <tt>checked_</tt> on
28085 debug builds and not doing so on release builds (for example).
28086 </p>
28087
28088 <p>
28089 Note that some may object that <tt>checked_*_ptr</tt> may seem to make the smart
28090 pointer more like <tt>vector</tt>, and we don't want two ways to spell <tt>vector</tt>. I
28091 don't agree, but if that were true that would be another reason to
28092 remove <tt>*_ptr&lt;T[N]&gt;</tt> which equally makes the smart pointer more like
28093 <tt>std::array.</tt> :-)
28094 </p>
28095
28096 <p><i>[
28097 Bellevue:
28098 ]</i></p>
28099
28100
28101 <blockquote>
28102 <p>Suggestion that fixed-size array instantiations are going to fail at
28103 compile time anyway (if we remove specialization) due to pointer decay,
28104 at least that appears to be result from available compilers.
28105 </p>
28106 <p>
28107 So concerns about about requiring static_assert seem unfounded.
28108 </p>
28109 <p>After a little more experimentation with compiler, it appears that
28110 fixed size arrays would only work at all if we supply these explicit
28111 specialization. So removing them appears less breaking than originally
28112 thought.
28113 </p>
28114 <p>
28115 straw poll unanimous move to Ready.
28116 </p>
28117 </blockquote>
28118
28119
28120
28121 <p><b>Proposed resolution:</b></p>
28122 <p>
28123 Change the synopsis under 20.7.11 [unique.ptr] p2:
28124 </p>
28125
28126 <blockquote><pre>...
28127 template&lt;class T&gt; struct default_delete; 
28128 template&lt;class T&gt; struct default_delete&lt;T[]&gt;; 
28129 <del>template&lt;class T, size_t N&gt; struct default_delete&lt;T[N]&gt;;</del>
28130
28131 template&lt;class T, class D = default_delete&lt;T&gt;&gt; class unique_ptr; 
28132 template&lt;class T, class D&gt; class unique_ptr&lt;T[], D&gt;; 
28133 <del>template&lt;class T, class D, size_t N&gt; class unique_ptr&lt;T[N], D&gt;;</del>
28134 ...
28135 </pre></blockquote>
28136
28137 <p>
28138 Remove the entire section 20.7.11.1.3 [unique.ptr.dltr.dflt2] <b><tt>default_delete&lt;T[N]&gt;</tt></b>.
28139 </p>
28140
28141 <p>
28142 Remove the entire section 20.7.11.4 [unique.ptr.compiletime] <b><tt>unique_ptr</tt> for array objects with a compile time length</b>
28143 and its subsections: 20.7.11.4.1 [unique.ptr.compiletime.dtor], 20.7.11.4.2 [unique.ptr.compiletime.observers],
28144 20.7.11.4.3 [unique.ptr.compiletime.modifiers].
28145 </p>
28146
28147
28148
28149
28150
28151
28152 <hr>
28153 <h3><a name="743"></a>743. rvalue <tt>swap</tt> for <tt>shared_ptr</tt></h3>
28154 <p><b>Section:</b> 20.7.12.2.9 [util.smartptr.shared.spec] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28155  <b>Submitter:</b> Howard Hinnant <b>Date:</b> 2007-10-10</p>
28156 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28157 <p><b>Discussion:</b></p>
28158 <p>
28159 When the LWG looked at <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#674">674</a> in Kona the following note was made:
28160 </p>
28161
28162 <blockquote><p>
28163 We may need to open an issue to deal with the question of
28164 whether <tt>shared_ptr</tt> needs an rvalue <tt>swap</tt>.
28165 </p></blockquote>
28166
28167 <p>
28168 This issue was opened in response to that note.
28169 </p>
28170
28171 <p>
28172 I believe allowing rvalue <tt>shared_ptr</tt>s to <tt>swap</tt> is both
28173 appropriate, and consistent with how other library components are currently specified.
28174 </p>
28175
28176 <p><i>[
28177 Bellevue:
28178 ]</i></p>
28179
28180
28181 <blockquote>
28182 <p>
28183 Concern that the three signatures for swap is needlessly complicated,
28184 but this issue merely brings shared_ptr into equal complexity with the
28185 rest of the library. Will open a new issue for concern about triplicate
28186 signatures.
28187 </p>
28188 <p>
28189 Adopt issue as written.
28190 </p>
28191 </blockquote>
28192
28193
28194 <p><b>Proposed resolution:</b></p>
28195 <p>
28196 Change the synopsis in 20.7.12.2 [util.smartptr.shared]:
28197 </p>
28198
28199 <blockquote><pre>void swap(shared_ptr&amp;<ins>&amp;</ins> r);
28200 ...
28201 template&lt;class T&gt; void swap(shared_ptr&lt;T&gt;&amp; a, shared_ptr&lt;T&gt;&amp; b);
28202 <ins>template&lt;class T&gt; void swap(shared_ptr&lt;T&gt;&amp;&amp; a, shared_ptr&lt;T&gt;&amp; b);
28203 template&lt;class T&gt; void swap(shared_ptr&lt;T&gt;&amp; a, shared_ptr&lt;T&gt;&amp;&amp; b);</ins>
28204 </pre></blockquote>
28205
28206 <p>
28207 Change 20.7.12.2.4 [util.smartptr.shared.mod]:
28208 </p>
28209
28210 <blockquote><pre>void swap(shared_ptr&amp;<ins>&amp;</ins> r);
28211 </pre></blockquote>
28212
28213 <p>
28214 Change 20.7.12.2.9 [util.smartptr.shared.spec]:
28215 </p>
28216
28217 <blockquote><pre>template&lt;class T&gt; void swap(shared_ptr&lt;T&gt;&amp; a, shared_ptr&lt;T&gt;&amp; b);
28218 <ins>template&lt;class T&gt; void swap(shared_ptr&lt;T&gt;&amp;&amp; a, shared_ptr&lt;T&gt;&amp; b);
28219 template&lt;class T&gt; void swap(shared_ptr&lt;T&gt;&amp; a, shared_ptr&lt;T&gt;&amp;&amp; b);</ins>
28220 </pre></blockquote>
28221
28222
28223
28224
28225
28226 <hr>
28227 <h3><a name="744"></a>744. What is the lifetime of an exception pointed to by an exception_ptr?</h3>
28228 <p><b>Section:</b> 18.7.5 [propagation] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28229  <b>Submitter:</b> Alisdair Meredith <b>Date:</b> 2007-10-10</p>
28230 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#propagation">active issues</a> in [propagation].</p>
28231 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#propagation">issues</a> in [propagation].</p>
28232 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28233 <p><b>Discussion:</b></p>
28234 <p>
28235 Without some lifetime guarantee, it is hard to know how this type can be
28236 used.  Very specifically, I don't see how the current wording would
28237 guarantee and exception_ptr caught at the end of one thread could be safely
28238 stored and rethrown in another thread - the original motivation for this
28239 API.
28240 </p>
28241 <p>
28242 (Peter Dimov agreed it should be clearer, maybe a non-normative note to
28243 explain?)
28244 </p>
28245
28246 <p><i>[
28247 Bellevue:
28248 ]</i></p>
28249
28250
28251 <blockquote>
28252 <p>
28253 Agree the issue is real.
28254 </p>
28255 <p>
28256 Intent is lifetime is similar to a shared_ptr (and we might even want to
28257 consider explicitly saying that it is a shared_ptr&lt; unspecified type &gt;).
28258 </p>
28259 <p>
28260 We expect that most implementations will use shared_ptr, and the
28261 standard should be clear that the exception_ptr type is intended to be
28262 something whose semantics are smart-pointer-like so that the user does
28263 not need to worry about lifetime management. We still need someone to
28264 draught those words - suggest emailing Peter Dimov.
28265 </p>
28266 <p>
28267 Move to Open.
28268 </p>
28269 </blockquote>
28270
28271
28272 <p><b>Proposed resolution:</b></p>
28273 <p>
28274 Change 18.7.5 [propagation]/7:
28275 </p>
28276
28277 <blockquote>
28278 -7- Returns: An <tt>exception_ptr</tt> object that refers to the currently
28279 handled exception or a copy of the currently handled exception, or a
28280 null <tt>exception_ptr</tt> object if no exception is being handled.
28281 <ins>The referenced object remains valid at least as long as there is an
28282 <tt>exception_ptr</tt> that refers to it.</ins>
28283 If the function needs to allocate memory and the attempt
28284 fails, it returns an <tt>exception_ptr</tt> object that refers to an instance of
28285 <tt>bad_alloc</tt>. It is unspecified whether the return values of two successive
28286 calls to <tt>current_exception</tt> refer to the same exception object. [<i>Note:</i>
28287 that is, it is unspecified whether <tt>current_exception</tt> creates a new copy
28288 each time it is called. <i>--end note</i>]
28289 </blockquote>
28290
28291
28292
28293
28294
28295 <hr>
28296 <h3><a name="746"></a>746. current_exception may fail with bad_alloc</h3>
28297 <p><b>Section:</b> 18.7.5 [propagation] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28298  <b>Submitter:</b> Alisdair Meredith <b>Date:</b> 2007-10-10</p>
28299 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#propagation">active issues</a> in [propagation].</p>
28300 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#propagation">issues</a> in [propagation].</p>
28301 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28302 <p><b>Discussion:</b></p>
28303 <p>
28304 I understand that the attempt to copy an exception may run out of memory,
28305 but I believe this is the only part of the standard that mandates failure
28306 with specifically <tt>bad_alloc</tt>, as opposed to allowing an
28307 implementation-defined type derived from <tt>bad_alloc</tt>.  For instance, the Core
28308 language for a failed new expression is:
28309 </p>
28310 <blockquote>
28311 <p>
28312 Any other allocation function that fails to allocate storage shall indicate
28313 failure only by throwing an exception of a type that would match a handler
28314 (15.3) of type <tt>std::bad_alloc</tt> (18.5.2.1).
28315 </p>
28316 </blockquote>
28317 <p>
28318 I think we should allow similar freedom here (or add a blanket
28319 compatible-exception freedom paragraph in 17)
28320 </p>
28321 <p>
28322 I prefer the clause 17 approach myself, and maybe clean up any outstanding
28323 wording that could also rely on it.
28324 </p>
28325 <p>
28326 Although filed against a specific case, this issue is a problem throughout
28327 the library. 
28328 </p>
28329
28330 <p><i>[
28331 Bellevue:
28332 ]</i></p>
28333
28334
28335 <blockquote>
28336 <p>
28337 Is issue bigger than library?
28338 </p>
28339 <p>
28340 No - Core are already very clear about their wording, which is inspiration for the issue.
28341 </p>
28342 <p>
28343 While not sold on the original 18.7.5 use case, the generalised 17.4.4.8 wording is the real issue.
28344 </p>
28345 <p>
28346 Accept the broad view and move to ready
28347 </p>
28348 </blockquote>
28349
28350
28351 <p><b>Proposed resolution:</b></p>
28352 <p>
28353 Add the following exemption clause to 17.4.4.9 [res.on.exception.handling]:
28354 </p>
28355
28356 <blockquote>
28357 A function may throw a type not listed in its <i>Throws</i> clause so long as it is
28358 derived from a class named in the <i>Throws</i> clause, and would be caught by an
28359 exception handler for the base type.
28360 </blockquote>
28361
28362
28363
28364
28365
28366 <hr>
28367 <h3><a name="749"></a>749. Currently <tt>has_nothrow_copy_constructor&lt;T&gt;::value</tt> is true if T has 'a' nothrow copy constructor.</h3>
28368 <p><b>Section:</b> 20.5.4.3 [meta.unary.prop] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28369  <b>Submitter:</b> Alisdair Meredith <b>Date:</b> 2007-10-10</p>
28370 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#meta.unary.prop">issues</a> in [meta.unary.prop].</p>
28371 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28372 <p><b>Discussion:</b></p>
28373 <p>
28374 Unfortunately a class can have multiple copy constructors, and I believe to
28375 be useful this trait should only return true is ALL copy constructors are
28376 no-throw.
28377 </p>
28378 <p>
28379 For instance:
28380 </p>
28381 <blockquote>
28382 <pre>struct awkward {
28383  awkward( const awkward &amp; ) throw() {}
28384  awkward( awkward &amp; ) { throw "oops"; } };
28385 </pre>
28386 </blockquote>
28387
28388
28389 <p><b>Proposed resolution:</b></p>
28390 <p>
28391 Change 20.5.4.3 [meta.unary.prop]:
28392 </p>
28393
28394 <blockquote>
28395 <pre>has_trivial_copy_constructor</pre>
28396 <blockquote>
28397 <tt>T</tt> is a trivial type (3.9) or a reference type or a class type <del>with a trivial copy constructor</del>
28398 <ins>where all copy constructors are trivial</ins> (12.8).
28399 </blockquote>
28400 </blockquote>
28401
28402 <blockquote>
28403 <pre>has_trivial_assign</pre>
28404 <blockquote>
28405 <tt>T</tt> is neither <tt>const</tt> nor a reference type, and <tt>T</tt> is a trivial type (3.9)
28406 or a class type <del>with a trivial copy assignment operator</del> <ins>where all copy assignment operators are trivial</ins> (12.8).
28407 </blockquote>
28408 </blockquote>
28409
28410 <blockquote>
28411 <pre>has_nothrow_copy_constructor</pre>
28412 <blockquote>
28413 <tt>has_trivial_copy_constructor&lt;T&gt;::value</tt> is <tt>true</tt> or <tt>T</tt> is a class type <del>with
28414 a</del> <ins>where all</ins> copy constructor<ins>s</ins> <del>that is</del> <ins>are</ins> 
28415 known not to throw any exceptions or <tt>T</tt> is an
28416 array of such a class type
28417 </blockquote>
28418 </blockquote>
28419
28420 <blockquote>
28421 <pre>has_nothrow_assign</pre>
28422 <blockquote>
28423 <tt>T</tt> is neither <tt>const</tt> nor a reference type, and
28424 <tt>has_trivial_assign&lt;T&gt;::value</tt> is <tt>true</tt> or <tt>T</tt> is a class type <del>with a</del>
28425 <ins>where all</ins> copy
28426 assignment operator<ins>s</ins> tak<ins>e</ins><del>ing</del> an lvalue of type <tt>T</tt> that is known not to
28427 throw any exceptions or <tt>T</tt> is an array of such a class type.
28428 </blockquote>
28429 </blockquote>
28430
28431
28432
28433
28434
28435
28436 <hr>
28437 <h3><a name="755"></a>755. <tt>std::vector</tt> and <tt>std:string</tt> lack explicit shrink-to-fit operations</h3>
28438 <p><b>Section:</b> 23.2.6.2 [vector.capacity], 21.3.4 [string.capacity] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28439  <b>Submitter:</b> Beman Dawes <b>Date:</b> 2007-10-31</p>
28440 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#vector.capacity">issues</a> in [vector.capacity].</p>
28441 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28442 <p><b>Discussion:</b></p>
28443 <p>
28444 A <tt>std::vector</tt> can be shrunk-to-fit via the swap idiom:
28445 </p>
28446
28447 <blockquote><pre>vector&lt;int&gt; v;
28448 ...
28449 v.swap(vector&lt;int&gt;(v));  // shrink to fit
28450 </pre>
28451 <blockquote><p>
28452 or:
28453 </p></blockquote>
28454 <pre>vector&lt;int&gt;(v).swap(v);  // shrink to fit
28455 </pre>
28456 <blockquote><p>
28457 or:
28458 </p></blockquote>
28459 <pre>swap(v, vector&lt;int&gt;(v));  // shrink to fit
28460 </pre>
28461 </blockquote>
28462
28463 <p>
28464 A non-binding request for shrink-to-fit can be made to a <tt>std::string</tt> via:
28465 </p>
28466
28467 <blockquote><pre>string s;
28468 ...
28469 s.reserve(0);
28470 </pre></blockquote>
28471
28472 <p>
28473 Neither of these is at all obvious to beginners, and even some
28474 experienced C++ programmers are not aware that shrink-to-fit is
28475 trivially available.
28476 </p>
28477 <p>
28478 Lack of explicit functions to perform these commonly requested
28479 operations makes vector and string less usable for non-experts. Because
28480 the idioms are somewhat obscure, code readability is impaired. It is
28481 also unfortunate that two similar vector-like containers use different
28482 syntax for the same operation.
28483 </p>
28484 <p>
28485 The proposed resolution addresses these concerns. The proposed function
28486 takes no arguments to keep the solution simple and focused.
28487 </p>
28488
28489
28490 <p><b>Proposed resolution:</b></p>
28491 <p>
28492 To Class template basic_string 21.3 [basic.string] synopsis,
28493 Class template vector 23.2.6 [vector] synopsis, and Class
28494 vector&lt;bool&gt; 23.2.7 [vector.bool] synopsis, add:
28495 </p>
28496
28497 <blockquote><pre>    
28498 void shrink_to_fit();
28499 </pre></blockquote>
28500
28501 <p>
28502 To basic_string capacity 21.3.4 [string.capacity] and vector
28503 capacity 23.2.6.2 [vector.capacity], add:
28504 </p>
28505
28506 <blockquote>
28507 <pre>void shrink_to_fit();
28508 </pre>
28509 <blockquote>
28510 <i>Remarks:</i> <tt>shrink_to_fit</tt> is a non-binding request to reduce
28511 <tt>capacity()</tt> to <tt>size()</tt>. [<i>Note:</i> The request is non-binding to
28512 allow latitude for implementation-specific optimizations.
28513 <i>-- end note</i>]
28514 </blockquote>
28515 </blockquote>
28516
28517 <p><i>[
28518 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#850">850</a> has been added to deal with this issue with respect to <tt>deque</tt>.
28519 ]</i></p>
28520
28521
28522
28523
28524
28525
28526 <hr>
28527 <h3><a name="759"></a>759. A reference is not an object</h3>
28528 <p><b>Section:</b> 23.1 [container.requirements] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28529  <b>Submitter:</b> Jens Maurer <b>Date:</b> 2007-11-06</p>
28530 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
28531 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
28532 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28533 <p><b>Discussion:</b></p>
28534 <p>
28535 23.1 [container.requirements] says:
28536 </p>
28537
28538 <blockquote>
28539 -12- Objects passed to member functions of a container as rvalue references shall not be elements of that container. No 
28540 diagnostic required.
28541 </blockquote>
28542
28543 <p>
28544 A reference is not an object, but this sentence appears to claim so.
28545 </p>
28546
28547 <p>
28548 What is probably meant here:
28549 </p>
28550 <blockquote>
28551 An object bound to an rvalue
28552 reference parameter of a member function of a container shall not be
28553 an element of that container; no diagnostic required.
28554 </blockquote>
28555
28556
28557
28558 <p><b>Proposed resolution:</b></p>
28559 <p>
28560 Change 23.1 [container.requirements]:
28561 </p>
28562
28563 <blockquote>
28564 -12- <del>Objects passed to member functions of a container as rvalue references shall not be elements</del>
28565 <ins>An object bound to an rvalue
28566 reference parameter of a member function of a container shall not be
28567 an element</ins>
28568 of that container<del>.</del><ins>;</ins> <del>N</del><ins>n</ins>o 
28569 diagnostic required.
28570 </blockquote>
28571
28572
28573
28574
28575
28576
28577 <hr>
28578 <h3><a name="761"></a>761. <tt>unordered_map</tt> needs an <tt>at()</tt> member function</h3>
28579 <p><b>Section:</b> 23.4.1.2 [unord.map.elem] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28580  <b>Submitter:</b> Joe Gottman <b>Date:</b> 2007-11-15</p>
28581 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28582 <p><b>Discussion:</b></p>
28583 <p>
28584 The new member function <tt>at()</tt> was recently added to <tt>std::map()</tt>.  It acts 
28585 like <tt>operator[]()</tt>, except it throws an exception when the input key is 
28586 not found.  It is useful when the <tt>map</tt> is <tt>const</tt>, the <tt>value_type</tt> of the 
28587 key doesn't have  a default constructor, it is an error if the key is 
28588 not found, or the user wants to avoid accidentally adding an element to 
28589 the map.  For exactly these same reasons, <tt>at()</tt> would be equally useful 
28590 in <tt>std::unordered_map</tt>.
28591 </p>
28592
28593
28594 <p><b>Proposed resolution:</b></p>
28595 <p>
28596 Add the following functions to the definition of <tt>unordered_map</tt> under "lookup" (23.4.1 [unord.map]):
28597 </p>
28598
28599 <blockquote><pre>mapped_type&amp; at(const key_type&amp; k);
28600 const mapped_type &amp;at(const key_type &amp;k) const;
28601 </pre></blockquote>
28602
28603 <p>
28604 Add the following definitions to 23.4.1.2 [unord.map.elem]:
28605 </p>
28606
28607 <blockquote>
28608 <pre>mapped_type&amp; at(const key_type&amp; k);
28609 const mapped_type &amp;at(const key_type &amp;k) const;
28610 </pre>
28611 <blockquote>
28612 <p>
28613 <i>Returns:</i> A reference to <tt>x.second</tt>, where <tt>x</tt> is the (unique) element 
28614 whose key is equivalent to <tt>k</tt>.
28615 </p>
28616 <p>
28617 <i>Throws:</i> An exception object of type <tt>out_of_range</tt> if no such element 
28618 is present.
28619 </p>
28620 </blockquote>
28621 </blockquote>
28622
28623 <p><i>[
28624 Bellevue:  Editorial note: the "(unique)" differs from map.
28625 ]</i></p>
28626
28627
28628
28629
28630
28631
28632
28633 <hr>
28634 <h3><a name="766"></a>766. Inconsistent exception guarantees between ordered and unordered associative containers</h3>
28635 <p><b>Section:</b> 23.1 [container.requirements], 23.1.5.1 [unord.req.except] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28636  <b>Submitter:</b> Ion Gaztañaga <b>Date:</b> 2007-12-22</p>
28637 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#container.requirements">active issues</a> in [container.requirements].</p>
28638 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#container.requirements">issues</a> in [container.requirements].</p>
28639 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28640 <p><b>Discussion:</b></p>
28641 <p>
28642 23.1 [container.requirements]p10 states:
28643 </p>
28644
28645 <blockquote>
28646 <p>
28647 Unless otherwise specified (see 23.2.2.3 and 23.2.5.4) all container types defined in this clause meet the following
28648 additional requirements:
28649 </p>
28650 <ul>
28651
28652 <li>[...]</li>
28653
28654 <li>no <tt>erase()</tt>, <tt>pop_back()</tt> or <tt>pop_front()</tt> function throws an exception.</li>
28655
28656 </ul>
28657 </blockquote>
28658
28659 <p>
28660 23.2.2.3 [deque.modifiers] and 23.2.6.4 [vector.modifiers] offer
28661 additional guarantees for <tt>deque</tt>/<tt>vector insert()</tt> and
28662 <tt>erase()</tt> members. However, 23.1 [container.requirements]p10
28663 does not mention 23.1.5.1 [unord.req.except] that specifies exception
28664 safety guarantees
28665 for unordered containers. In addition, 23.1.5.1 [unord.req.except]p1
28666 offers the following guaratee for
28667 <tt>erase()</tt>:
28668 </p>
28669
28670 <blockquote>
28671 No <tt>erase()</tt> function throws an exception unless that exception
28672 is thrown by the container's Hash or Pred object (if any).
28673 </blockquote>
28674
28675 <p>
28676 Summary:
28677 </p>
28678
28679 <p>
28680 According to 23.1 [container.requirements]p10 no
28681 <tt>erase()</tt> function should throw an exception unless otherwise
28682 specified. Although does not explicitly mention 23.1.5.1 [unord.req.except], this section offers additional guarantees
28683 for unordered containers, allowing <tt>erase()</tt> to throw if
28684 predicate or hash function throws.
28685 </p>
28686
28687 <p>
28688 In contrast, associative containers have no exception safety guarantees
28689 section so no <tt>erase()</tt> function should throw, <em>including
28690 <tt>erase(k)</tt></em> that needs to use the predicate function to
28691 perform its work. This means that the predicate of an associative
28692 container is not allowed to throw.
28693 </p>
28694
28695 <p>
28696 So:
28697 </p>
28698
28699 <ol>
28700 <li>
28701 <tt>erase(k)</tt> for associative containers is not allowed to throw. On
28702 the other hand, <tt>erase(k)</tt> for unordered associative containers
28703 is allowed to throw.
28704 </li>
28705 <li>
28706 <tt>erase(q)</tt> for associative containers is not allowed to throw. On
28707 the other hand, <tt>erase(q)</tt> for unordered associative containers
28708 is allowed to throw if it uses the hash or predicate.
28709 </li>
28710 <li>
28711 To fulfill 1), predicates of associative containers are not allowed to throw.
28712 Predicates of unordered associative containers are allowed to throw.
28713 </li>
28714 <li>
28715 2) breaks a widely used programming pattern (flyweight pattern) for
28716 unordered containers, where objects are registered in a global map in
28717 their constructors and unregistered in their destructors. If <tt>erase(q)</tt> is
28718 allowed to throw, the destructor of the object would need to rethrow the
28719 exception or swallow it, leaving the object registered.
28720 </li>
28721 </ol>
28722
28723
28724 <p><b>Proposed resolution:</b></p>
28725 <p>
28726 Create a new sub-section of 23.1.4 [associative.reqmts] (perhaps [associative.req.except]) titled "Exception
28727 safety guarantees".
28728 </p>
28729
28730 <blockquote>
28731 <p>
28732 1 For associative containers, no <tt>clear()</tt> function throws an exception.
28733 <tt>erase(k)</tt> does not throw an exception unless that exception is thrown by
28734 the container's Pred object (if any).
28735 </p>
28736
28737 <p>
28738 2 For associative containers, if an exception is thrown by any operation
28739 from within an <tt>insert()</tt> function inserting a single element, the
28740 <tt>insert()</tt> function has no effect.
28741 </p>
28742
28743 <p>
28744 3 For associative containers, no <tt>swap</tt> function throws an exception
28745 unless that exception is thrown by the copy constructor or copy
28746 assignment operator of the container's Pred object (if any).
28747 </p>
28748 </blockquote>
28749
28750 <p>
28751 Change 23.1.5.1 [unord.req.except]p1:
28752 </p>
28753
28754 <blockquote>
28755 For unordered associative containers, no <tt>clear()</tt> function
28756 throws an exception. <del>No</del> <tt>erase(<ins>k</ins>)</tt>
28757 <del>function</del> <ins>does not</ins> throw<del>s</del> an exception
28758 unless that exception is thrown by the container's Hash or Pred object
28759 (if any).
28760 </blockquote>
28761
28762 <p>
28763 Change 23.1 [container.requirements]p10 to add references to new sections:
28764 </p>
28765
28766 <blockquote>
28767 Unless otherwise specified (see [deque.modifiers]<ins>,</ins>
28768 <del>and</del> [vector.modifiers]<ins>, [associative.req.except],
28769 [unord.req.except]</ins>) all container types defined in this clause meet
28770 the following additional requirements:
28771 </blockquote>
28772
28773 <p>
28774 Change 23.1 [container.requirements]p10 referring to <tt>swap</tt>:
28775 </p>
28776
28777 <blockquote>
28778 <ul>
28779 <li>
28780 no <tt>swap()</tt> function throws an exception<del> unless that exception is thrown
28781 by the copy constructor or assignment operator of the container's
28782 Compare object (if any; see [associative.reqmts])</del>.
28783 </li>
28784 </ul>
28785 </blockquote>
28786
28787
28788
28789
28790
28791
28792 <hr>
28793 <h3><a name="768"></a>768. Typos in [atomics]?</h3>
28794 <p><b>Section:</b> 29.3.3 [atomics.types.generic] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28795  <b>Submitter:</b> Alberto Ganesh Barbati <b>Date:</b> 2007-12-28</p>
28796 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28797 <p><b>Discussion:</b></p>
28798 <p>
28799 in the latest publicly available draft, paper
28800 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf">N2641</a>,
28801 in section 29.3.3 [atomics.types.generic], the following specialization of the template
28802 <tt>atomic&lt;&gt;</tt> is provided for pointers:
28803 </p>
28804
28805 <blockquote><pre>template &lt;class T&gt; struct atomic&lt;T*&gt; : atomic_address { 
28806   T* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; 
28807   T* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; 
28808
28809   atomic() = default; 
28810   constexpr explicit atomic(T); 
28811   atomic(const atomic&amp;) = delete; 
28812   atomic&amp; operator=(const atomic&amp;) = delete; 
28813
28814   T* operator=(T*) volatile; 
28815   T* operator++(int) volatile; 
28816   T* operator--(int) volatile; 
28817   T* operator++() volatile; 
28818   T* operator--() volatile; 
28819   T* operator+=(ptrdiff_t) volatile;
28820   T* operator-=(ptrdiff_t) volatile; 
28821 };
28822 </pre></blockquote>
28823
28824 <p>
28825 First of all, there is a typo in the non-default constructor which
28826 should take a <tt>T*</tt> rather than a <tt>T</tt>.
28827 </p>
28828
28829 <p>
28830 As you can see, the specialization redefine and therefore hide a few
28831 methods from the base class <tt>atomic_address</tt>, namely <tt>fetch_add</tt>, <tt>fetch_sub</tt>,
28832 <tt>operator=</tt>, <tt>operator+=</tt> and <tt>operator-=</tt>. That's good, but... what happened
28833 to the other methods, in particular these ones:
28834 </p>
28835
28836 <blockquote><pre>void store(T*, memory_order = memory_order_seq_cst) volatile;
28837 T* load( memory_order = memory_order_seq_cst ) volatile;
28838 T* swap( T*, memory_order = memory_order_seq_cst ) volatile;
28839 bool compare_swap( T*&amp;, T*, memory_order, memory_order ) volatile;
28840 bool compare_swap( T*&amp;, T*, memory_order = memory_order_seq_cst ) volatile;
28841 </pre></blockquote>
28842
28843 <p>
28844 By reading paper
28845 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html">N2427 "C++ Atomic Types and Operations"</a>,
28846 I see that the
28847 definition of the specialization <tt>atomic&lt;T*&gt;</tt> matches the one in the
28848 draft, but in the example implementation the methods <tt>load()</tt>, <tt>swap()</tt>
28849 and <tt>compare_swap()</tt> are indeed present.
28850 </p>
28851
28852 <p>
28853 Strangely, the example implementation does not redefine the method
28854 <tt>store()</tt>. It's true that a <tt>T*</tt> is always convertible to <tt>void*</tt>, but not
28855 hiding the <tt>void*</tt> signature from the base class makes the class
28856 error-prone to say the least: it lets you assign pointers of any type to
28857 a <tt>T*</tt>, without any hint from the compiler.
28858 </p>
28859
28860 <p>
28861 Is there a true intent to remove them from the specialization or are
28862 they just missing from the definition because of a mistake?
28863 </p>
28864
28865 <p><i>[
28866 Bellevue:
28867 ]</i></p>
28868
28869
28870 <blockquote>
28871 <p>
28872 The proposed revisions are accepted.
28873 </p>
28874 <p>
28875 Further discussion: why is the ctor labeled "constexpr"? Lawrence said
28876 this permits the object to be statically initialized, and that's
28877 important because otherwise there would be a race condition on
28878 initialization.
28879 </p>
28880 </blockquote>
28881
28882
28883 <p><b>Proposed resolution:</b></p>
28884 <p>
28885 Change the synopsis in 29.3.3 [atomics.types.generic]:
28886 </p>
28887
28888 <blockquote><pre>template &lt;class T&gt; struct atomic&lt;T*&gt; : atomic_address { 
28889   <ins>void store(T*, memory_order = memory_order_seq_cst) volatile;</ins>
28890   <ins>T* load( memory_order = memory_order_seq_cst ) volatile;</ins>
28891   <ins>T* swap( T*, memory_order = memory_order_seq_cst ) volatile;</ins>
28892   <ins>bool compare_swap( T*&amp;, T*, memory_order, memory_order ) volatile;</ins>
28893   <ins>bool compare_swap( T*&amp;, T*, memory_order = memory_order_seq_cst ) volatile;</ins>
28894
28895   T* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; 
28896   T* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; 
28897
28898   atomic() = default; 
28899   constexpr explicit atomic(T<ins>*</ins>); 
28900   atomic(const atomic&amp;) = delete; 
28901   atomic&amp; operator=(const atomic&amp;) = delete; 
28902
28903   T* operator=(T*) volatile; 
28904   T* operator++(int) volatile; 
28905   T* operator--(int) volatile; 
28906   T* operator++() volatile; 
28907   T* operator--() volatile; 
28908   T* operator+=(ptrdiff_t) volatile;
28909   T* operator-=(ptrdiff_t) volatile; 
28910 };
28911 </pre></blockquote>
28912
28913
28914
28915
28916
28917
28918 <hr>
28919 <h3><a name="770"></a>770. std::function should use rvalue swap</h3>
28920 <p><b>Section:</b> 20.6.15 [func.wrap] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28921  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2008-01-10</p>
28922 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28923 <p><b>Discussion:</b></p>
28924 <p>
28925 It is expected that typical implementations of <tt>std::function</tt> will
28926 use dynamic memory allocations at least under given conditions,
28927 so it seems appropriate to change the current lvalue swappabilty of
28928 this class to rvalue swappability.
28929 </p>
28930
28931
28932 <p><b>Proposed resolution:</b></p>
28933 <p>
28934 In 20.6 [function.objects], header <tt>&lt;functional&gt;</tt> synopsis, just below of
28935 </p>
28936
28937 <blockquote><pre>template&lt;class R, class... ArgTypes&gt;
28938   void swap(function&lt;R(ArgTypes...)&gt;&amp;, function&lt;R(ArgTypes...)&gt;&amp;);
28939 <ins>template&lt;class R, class... ArgTypes&gt;
28940   void swap(function&lt;R(ArgTypes...)&gt;&amp;&amp;, function&lt;R(ArgTypes...)&gt;&amp;);
28941 template&lt;class R, class... ArgTypes&gt;
28942   void swap(function&lt;R(ArgTypes...)&gt;&amp;, function&lt;R(ArgTypes...)&gt;&amp;&amp;);</ins>
28943 </pre></blockquote>
28944
28945 <p>
28946 In 20.6.15.2 [func.wrap.func] class <tt>function</tt> definition, change
28947 </p>
28948
28949 <blockquote><pre>void swap(function&amp;<ins>&amp;</ins>);
28950 </pre></blockquote>
28951
28952 <p>
28953 In 20.6.15.2 [func.wrap.func], just below of
28954 </p>
28955
28956 <blockquote><pre>template &lt;class R, class... ArgTypes&gt;
28957   void swap(function&lt;R(ArgTypes...)&gt;&amp;, function&lt;R(ArgTypes...)&gt;&amp;);
28958 <ins>template &lt;class R, class... ArgTypes&gt;
28959   void swap(function&lt;R(ArgTypes...)&gt;&amp;&amp;, function&lt;R(ArgTypes...)&gt;&amp;);
28960 template &lt;class R, class... ArgTypes&gt;
28961   void swap(function&lt;R(ArgTypes...)&gt;&amp;, function&lt;R(ArgTypes...)&gt;&amp;&amp;);</ins>
28962 </pre></blockquote>
28963
28964 <p>
28965 In 20.6.15.2.2 [func.wrap.func.mod] change
28966 </p>
28967
28968 <blockquote><pre>void swap(function&amp;<ins>&amp;</ins> other);
28969 </pre></blockquote>
28970
28971 <p>
28972 In 20.6.15.2.7 [func.wrap.func.alg] add the two overloads
28973 </p>
28974
28975 <blockquote><pre><ins>template&lt;class R, class... ArgTypes&gt;
28976   void swap(function&lt;R(ArgTypes...)&gt;&amp;&amp; f1, function&lt;R(ArgTypes...)&gt;&amp; f2);
28977 template&lt;class R, class... ArgTypes&gt;
28978   void swap(function&lt;R(ArgTypes...)&gt;&amp; f1, function&lt;R(ArgTypes...)&gt;&amp;&amp; f2);</ins>
28979 </pre></blockquote>
28980
28981
28982
28983
28984
28985
28986 <hr>
28987 <h3><a name="775"></a>775. Tuple indexing should be unsigned?</h3>
28988 <p><b>Section:</b> 20.4.1.4 [tuple.helper] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
28989  <b>Submitter:</b> Alisdair Meredith <b>Date:</b> 2008-01-16</p>
28990 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
28991 <p><b>Discussion:</b></p>
28992 <p>
28993 The tuple element access API identifies the element in the sequence
28994 using signed integers, and then goes on to enforce the requirement that
28995 I be &gt;= 0.  There is a much easier way to do this - declare I as
28996 <tt>unsigned</tt>.
28997 </p>
28998 <p>
28999 In fact the proposal is to use <code>std::size_t</code>, matching the type used in the <tt>tuple_size</tt> API.
29000 </p>
29001 <p>
29002 A second suggestion is that it is hard to imagine an API that deduces
29003 and index at compile time and returns a reference throwing an exception.
29004 Add a specific <em>Throws:</em> Nothing paragraph to each element
29005 access API.
29006 </p>
29007 <p>
29008 In addition to <code>tuple</code>, update the API applies to
29009 <code>pair</code> and <code>array</code>, and should be updated
29010 accordingly.
29011 </p>
29012
29013 <p>
29014 A third observation is that the return type of the <code>get</code>
29015 functions for <code>std::pair</code> is pseudo-code, but it is not
29016 clearly marked as such.  There is actually no need for pseudo-code as
29017 the return type can be specified precisely with a call to
29018 <code>tuple_element</code>.  This is already done for
29019 <code>std::tuple</code>, and <code>std::array</code> does not have a
29020 problem as all elements are of type <code>T</code>.
29021 </p>
29022
29023
29024 <p><b>Proposed resolution:</b></p>
29025 <p>
29026 Update header &lt;utility&gt; synopsis in 20.2 [utility]
29027 </p>
29028 <pre><em>// 20.2.3, tuple-like access to pair:</em>
29029 template &lt;class T&gt; class tuple_size;
29030 template &lt;<del>int</del><ins>size_t</ins> I, class T&gt; class tuple_element;
29031
29032 template &lt;class T1, class T2&gt; struct tuple_size&lt;std::pair&lt;T1, T2&gt; &gt;;
29033 template &lt;class T1, class T2&gt; struct tuple_element&lt;0, std::pair&lt;T1, T2&gt; &gt;;
29034 template &lt;class T1, class T2&gt; struct tuple_element&lt;1, std::pair&lt;T1, T2&gt; &gt;;
29035
29036 template&lt;<del>int</del><ins>size_t</ins> I, class T1, class T2&gt;
29037   <del>P</del><ins>typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type </ins>&amp; get(std::pair&lt;T1, T2&gt;&amp;);
29038 template&lt;<del>int</del><ins>size_t</ins> I, class T1, class T2&gt;
29039   const <del>P</del><ins>typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type </ins>&amp; get(const std::pair&lt;T1, T2&gt;&amp;);
29040 </pre>
29041 <p>
29042 Update <strong>20.2.3 [pairs] Pairs</strong>
29043 </p>
29044 <pre>template&lt;<del>int</del><ins>size_t</ins> I, class T1, class T2&gt;
29045   <del>P</del><ins>typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type </ins>&amp; get(pair&lt;T1, T2&gt;&amp;);
29046 template&lt;<del>int</del><ins>size_t</ins> I, class T1, class T2&gt;
29047   const <del>P</del><ins>typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type </ins>&amp; get(const pair&lt;T1, T2&gt;&amp;);
29048 </pre>
29049 <p>
29050 <del>24 <em>Return type:</em> If <code>I == 0</code> then <code>P</code> is <code>T1</code>, if <code>I == 1</code> then <code>P</code> is <code>T2</code>, and otherwise the program is ill-formed.</del>
29051 </p>
29052 <p>
29053 25 <em>Returns:</em> If <code>I == 0</code> returns <code>p.first</code>, <del>otherwise</del> <ins>if <code>I == 1</code></ins> returns <code>p.second</code><ins>, and otherwise the program is ill-formed</ins>.
29054 </p>
29055 <p>
29056 <ins><em>Throws:</em> Nothing.</ins>
29057 </p>
29058
29059
29060 <p>
29061 Update header &lt;tuple&gt; synopsis in 20.4 [tuple] with a APIs as below:
29062 </p>
29063 <pre>template &lt;<del>int</del><ins>size_t</ins> I, class T&gt; class tuple_element; <em>// undefined</em>
29064 template &lt;<del>int</del><ins>size_t</ins> I, class... Types&gt; class tuple_element&lt;I, tuple&lt;Types...&gt; &gt;;
29065
29066 <em>// 20.3.1.4, element access:</em>
29067 template &lt;<del>int</del><ins>size_t</ins> I, class... Types&gt;
29068   typename tuple_element&lt;I, tuple&lt;Types...&gt; &gt;::type&amp; get(tuple&lt;Types...&gt;&amp;);
29069 template &lt;<del>int</del><ins>size_t</ins> I, class ... types&gt;
29070   typename tuple_element&lt;I, tuple&lt;Types...&gt; &gt;::type const&amp; get(const tuple&lt;Types...&gt;&amp;);
29071 </pre>
29072
29073 <p>
29074 Update <strong>20.4.1.4 [tuple.helper] Tuple helper classes</strong>
29075 </p>
29076 <pre>template &lt;<del>int</del><ins>size_t</ins> I, class... Types&gt;
29077 class tuple_element&lt;I, tuple&lt;Types...&gt; &gt; {
29078 public:
29079   typedef TI type;
29080 };</pre>
29081 <p>
29082 1 <em>Requires:</em> <code><del>0 &lt;= I and </del>I &lt; sizeof...(Types)</code>. The program is ill-formed if <code>I</code> is out of bounds.
29083 </p>
29084 <p>
29085 2 <em>Type:</em> <code>TI</code> is the type of the <code>I</code>th element of <code>Types</code>, where indexing is zero-based.
29086 </p>
29087 <p>
29088 Update <strong>20.4.1.5 [tuple.elem] Element access</strong>
29089 </p>
29090 <pre>template &lt;<del>int</del><ins>size_t</ins> I, class... types &gt;
29091 typename tuple_element&lt;I, tuple&lt;Types...&gt; &gt;::type&amp; get(tuple&lt;Types...&gt;&amp; t);
29092 </pre>
29093 1 <em>Requires:</em> <code><del>0 &lt;= I and </del>I &lt; sizeof...(Types)</code>. The program is ill-formed if <code>I</code> is out of bounds.
29094 <p>
29095 2 <em>Returns:</em> A reference to the <code>I</code>th element of <code>t</code>, where indexing is zero-based.
29096 </p>
29097 <ins><em>Throws:</em> Nothing.</ins>
29098 <pre>template &lt;<del>int</del><ins>size_t</ins> I, class... types&gt;
29099 typename tuple_element&lt;I, tuple&lt;Types...&gt; &gt;::type const&amp; get(const tuple&lt;Types...&gt;&amp; t);
29100 </pre>
29101 <p>
29102 3 <em>Requires:</em> <code><del>0 &lt;= I and </del>I &lt; sizeof...(Types)</code>. The program is ill-formed if <code>I</code> is out of bounds.
29103 </p>
29104 <p>
29105 4 <em>Returns:</em> A const reference to the <code>I</code>th element of <code>t</code>, where indexing is zero-based.
29106 </p>
29107 <p>
29108 <ins><em>Throws:</em> Nothing.</ins>
29109 </p>
29110
29111
29112 <p>
29113 Update header &lt;array&gt; synopsis in 20.2 [utility]
29114 </p>
29115 <pre>template &lt;class T&gt; class tuple_size; <em>// forward declaration</em>
29116 template &lt;<del>int</del><ins>size_t</ins> I, class T&gt; class tuple_element; <em>// forward declaration</em>
29117 template &lt;class T, size_t N&gt;
29118   struct tuple_size&lt;array&lt;T, N&gt; &gt;;
29119 template &lt;<del>int</del><ins>size_t</ins> I, class T, size_t N&gt;
29120   struct tuple_element&lt;I, array&lt;T, N&gt; &gt;;
29121 template &lt;<del>int</del><ins>size_t</ins> I, class T, size_t N&gt;
29122   T&amp; get(array&lt;T, N&gt;&amp;);
29123 template &lt;<del>int</del><ins>size_t</ins> I, class T, size_t N&gt;
29124   const T&amp; get(const array&lt;T, N&gt;&amp;);
29125 </pre>
29126
29127 <p>
29128 Update <strong>23.2.1.6 [array.tuple] Tuple interface to class template array</strong>
29129 </p>
29130 <pre>tuple_element&lt;<ins>size_t </ins>I, array&lt;T, N&gt; &gt;::type
29131 </pre>
29132 <p>
29133 3 <em>Requires:</em> <code><del>0 &lt;= </del>I &lt; N.</code> The program is ill-formed if <code>I</code> is out of bounds.
29134 </p>
29135 <p>
29136 4 <em>Value:</em> The type <code>T</code>.
29137 </p>
29138 <pre>template &lt;<del>int</del><ins>size_t</ins> I, class T, size_t N&gt; T&amp; get(array&lt;T, N&gt;&amp; a);
29139 </pre>
29140 <p>
29141 5 <em>Requires:</em> <code><del>0 &lt;= </del>I &lt; N</code>. The program is ill-formed if <code>I</code> is out of bounds.
29142 </p>
29143 <p>
29144 <em>Returns:</em> A reference to the <code>I</code>th element of <code>a</code>, where indexing is zero-based.
29145 </p>
29146 <p>
29147 <ins><em>Throws:</em> Nothing.</ins>
29148 </p>
29149 <pre>template &lt;<del>int</del><ins>size_t</ins> I, class T, size_t N&gt; const T&amp; get(const array&lt;T, N&gt;&amp; a);
29150 </pre>
29151 <p>
29152 6 <em>Requires:</em> <code><del>0 &lt;= </del>I &lt; N</code>. The program is ill-formed if <code>I</code> is out of bounds.
29153 </p>
29154 <p>
29155 7 <em>Returns:</em> A const reference to the <code>I</code>th element of <code>a</code>, where indexing is zero-based.
29156 </p>
29157 <p>
29158 <ins><em>Throws:</em> Nothing.</ins>
29159 </p>
29160
29161
29162 <p><i>[
29163 Bellevue: Note also that the phrase "The program is ill-formed if I is
29164 out of bounds" in the requires clauses are probably unnecessary, and
29165 could be removed at the editor's discretion. Also std:: qualification
29166 for pair is also unnecessary.
29167 ]</i></p>
29168
29169
29170
29171
29172 <hr>
29173 <h3><a name="777"></a>777. Atomics Library Issue</h3>
29174 <p><b>Section:</b> 29.4 [atomics.types.operations] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29175  <b>Submitter:</b> Lawrence Crowl <b>Date:</b> 2008-01-21</p>
29176 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#atomics.types.operations">issues</a> in [atomics.types.operations].</p>
29177 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29178 <p><b>Discussion:</b></p>
29179 <p>
29180 The load functions are defined as
29181 </p>
29182
29183 <blockquote><pre>C atomic_load(volatile A* object);
29184 C atomic_load_explicit(volatile A* object, memory_order);
29185 C A::load(memory_order order = memory_order_seq_cst) volatile;
29186 </pre></blockquote>
29187
29188 <p>
29189 which prevents their use in <tt>const</tt> contexts.
29190 </p>
29191
29192 <p><i>[
29193 post Bellevue Peter adds:
29194 ]</i></p>
29195
29196
29197 <blockquote>
29198 <p>
29199 Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#777">777</a> suggests making <tt>atomic_load</tt> operate on <tt>const</tt> objects. There is a
29200 subtle point here. Atomic loads do not generally write to the object, except
29201 potentially for the <tt>memory_order_seq_cst</tt> constraint. Depending on the
29202 architecture, a dummy write with the same value may be required to be issued
29203 by the atomic load to maintain sequential consistency. This, in turn, may
29204 make the following code:
29205 </p>
29206
29207 <blockquote><pre>const atomic_int x{};
29208
29209 int main()
29210 {
29211   x.load();
29212 }
29213 </pre></blockquote>
29214
29215 <p>
29216 dump core under a straightforward implementation that puts const objects in
29217 a read-only section.
29218 </p>
29219 <p>
29220 There are ways to sidestep the problem, but it needs to be considered.
29221 </p>
29222 <p>
29223 The tradeoff is between making the data member of the atomic types
29224 mutable and requiring the user to explicitly mark atomic members as
29225 mutable, as is already the case with mutexes.
29226 </p>
29227 </blockquote>
29228
29229
29230
29231 <p><b>Proposed resolution:</b></p>
29232 <p>
29233 Add the <tt>const</tt> qualifier to <tt>*object</tt> and <tt>*this</tt>.
29234 </p>
29235
29236 <blockquote><pre>C atomic_load(<ins>const</ins> volatile A* object);
29237 C atomic_load_explicit(<ins>const</ins> volatile A* object, memory_order);
29238 C A::load(memory_order order = memory_order_seq_cst) <ins>const</ins> volatile;
29239 </pre></blockquote>
29240
29241
29242
29243
29244
29245
29246 <hr>
29247 <h3><a name="778"></a>778. std::bitset does not have any constructor taking a string literal</h3>
29248 <p><b>Section:</b> 23.3.5.1 [bitset.cons] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29249  <b>Submitter:</b> Thorsten Ottosen <b>Date:</b> 2008-01-24</p>
29250 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#bitset.cons">issues</a> in [bitset.cons].</p>
29251 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29252 <p><b>Duplicate of:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#116">116</a></p>
29253 <p><b>Discussion:</b></p>
29254 <p>
29255 A small issue with <tt>std::bitset</tt>: it does not have any constructor
29256 taking a string literal, which is clumsy and looks like an oversigt when
29257 we tried to enable uniform use of <tt>string</tt> and <tt>const char*</tt> in the library.
29258 </p>
29259
29260 <p>
29261 Suggestion: Add
29262 </p>
29263
29264 <blockquote><pre>explicit bitset( const char* str );
29265 </pre></blockquote>
29266
29267 <p>
29268 to std::bitset.
29269 </p>
29270
29271
29272 <p><b>Proposed resolution:</b></p>
29273 <p>
29274 Add to synopsis in 23.3.5 [template.bitset]
29275 </p>
29276
29277 <blockquote><pre>explicit bitset( const char* str );
29278 </pre></blockquote>
29279
29280 <p>
29281 Add to synopsis in 23.3.5.1 [bitset.cons]
29282 </p>
29283
29284 <blockquote><pre>explicit bitset( const char* str );
29285 </pre>
29286 <p>
29287 <i>Effects:</i> Constructs a <tt>bitset</tt> as if <tt>bitset(string(str))</tt>.
29288 </p>
29289 </blockquote>
29290
29291
29292
29293
29294
29295
29296 <hr>
29297 <h3><a name="781"></a>781. <tt>std::complex</tt> should add missing C99 functions</h3>
29298 <p><b>Section:</b> 26.3.7 [complex.value.ops] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29299  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2008-01-26</p>
29300 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#complex.value.ops">issues</a> in [complex.value.ops].</p>
29301 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29302 <p><b>Discussion:</b></p>
29303 <p>
29304 A comparision of the N2461 header <tt>&lt;complex&gt;</tt> synopsis ([complex.synopsis])
29305 with the C99 standard (ISO 9899, 2nd edition and the two corrigenda) show
29306 some complex functions that are missing in C++. These are:
29307 </p>
29308
29309 <ol>
29310 <li>
29311 7.3.9.4: (required elements of the C99 library)<br>
29312 The <tt>cproj</tt> functions
29313 </li>
29314 <li>
29315 7.26.1: (optional elements of the C99 library)<br>
29316 <pre>cerf    cerfc    cexp2
29317 cexpm1  clog10   clog1p
29318 clog2   clgamma  ctgamma
29319 </pre>
29320 </li>
29321 </ol>
29322
29323 <p>
29324 I propose that at least the required <tt>cproj</tt> overloads are provided as equivalent
29325 C++ functions. This addition is easy to do in one sentence (delegation to C99
29326 function).
29327 </p>
29328
29329 <p>
29330 Please note also that the current entry <tt>polar</tt>
29331 in 26.3.9 [cmplx.over]/1
29332 should be removed from the mentioned overload list. It does not make sense to require that a
29333 function already expecting <em>scalar</em> arguments
29334 should cast these arguments into corresponding
29335 <tt>complex&lt;T&gt;</tt> arguments, which are not accepted by
29336 this function.
29337 </p>
29338
29339
29340 <p><b>Proposed resolution:</b></p>
29341 <p>
29342 In 26.3.1 [complex.synopsis] add just between the declaration of <tt>conj</tt> and <tt>fabs</tt>:
29343 </p>
29344
29345 <blockquote><pre>template&lt;class T&gt; complex&lt;T&gt; conj(const complex&lt;T&gt;&amp;);
29346 <ins>template&lt;class T&gt; complex&lt;T&gt; proj(const complex&lt;T&gt;&amp;);</ins>
29347 template&lt;class T&gt; complex&lt;T&gt; fabs(const complex&lt;T&gt;&amp;);
29348 </pre></blockquote>
29349
29350 <p>
29351 In 26.3.7 [complex.value.ops] just after p.6 (return clause of <tt>conj</tt>) add:
29352 </p>
29353
29354 <blockquote>
29355 <pre>template&lt;class T&gt; complex&lt;T&gt; proj(const complex&lt;T&gt;&amp; x);
29356 </pre>
29357 <blockquote>
29358
29359 <i>Effects:</i> Behaves the same as C99 function <tt>cproj</tt>, defined in
29360 subclause 7.3.9.4."
29361 </blockquote>
29362 </blockquote>
29363
29364 <p>
29365 In 26.3.9 [cmplx.over]/1, add one further entry <tt>proj</tt> to
29366 the overload list.
29367 </p>
29368
29369 <blockquote>
29370 <p>
29371 The following function templates shall have additional overloads:
29372 </p>
29373 <blockquote><pre>arg           norm 
29374 conj          <del>polar</del> <ins>proj</ins>
29375 imag          real
29376 </pre></blockquote>
29377 </blockquote>
29378
29379
29380
29381
29382
29383
29384 <hr>
29385 <h3><a name="782"></a>782. Extended <tt>seed_seq</tt> constructor is useless</h3>
29386 <p><b>Section:</b> 26.4.7.1 [rand.util.seedseq] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29387  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2008-01-27</p>
29388 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#rand.util.seedseq">active issues</a> in [rand.util.seedseq].</p>
29389 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.util.seedseq">issues</a> in [rand.util.seedseq].</p>
29390 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29391 <p><b>Discussion:</b></p>
29392 <p>
29393 Part of the resolution of n2423, issue 8 was the proposal to
29394 extend the <tt>seed_seq</tt> constructor accepting an input range
29395 as follows (which is now part of N2461):
29396 </p>
29397
29398 <blockquote><pre>template&lt;class InputIterator,
29399 size_t u = numeric_limits&lt;iterator_traits&lt;InputIterator&gt;::value_type&gt;::digits&gt;
29400 seed_seq(InputIterator begin, InputIterator end);
29401 </pre></blockquote>
29402
29403 <p>
29404 First, the expression <tt>iterator_traits&lt;InputIterator&gt;::value_type</tt>
29405 is invalid due to missing <tt>typename</tt> keyword, which is easy to
29406 fix.
29407 </p>
29408
29409 <p>
29410 Second (and worse), while the language now supports default
29411 template arguments of function templates, this customization
29412 point via the second <tt>size_t</tt> template parameter is of no advantage,
29413 because <tt>u</tt> can never be deduced, and worse - because it is a
29414 constructor function template - it can also never be explicitly
29415 provided (14.8.1 [temp.arg.explicit]/7).
29416 </p>
29417
29418 <p>
29419 The question arises, which advantages result from a compile-time
29420 knowledge of <tt>u</tt> versus a run time knowledge? If run time knowledge
29421 suffices, this parameter should be provided as normal function
29422 default argument [Resolution marked (A)], if compile-time knowledge
29423 is important, this could be done via a tagging template or more
29424 user-friendly via a standardized helper generator function
29425 (<tt>make_seed_seq</tt>), which allows this [Resolution marked (B)].
29426 </p>
29427
29428 <p><i>[
29429 Bellevue:
29430 ]</i></p>
29431
29432
29433 <blockquote>
29434 <p>
29435 Fermilab does not have a strong opinion. Would prefer to go with
29436 solution A. Bill agrees that solution A is a lot simpler and does the
29437 job.
29438 </p>
29439 <p>
29440 Proposed Resolution: Accept Solution A.
29441 </p>
29442 </blockquote>
29443
29444 <p>
29445 Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#803">803</a> claims to make this issue moot.
29446 </p>
29447
29448
29449
29450 <p><b>Proposed resolution:</b></p>
29451 <ol type="A">
29452 <li>
29453 <p>
29454 In 26.4.7.1 [rand.util.seedseq]/2, class <tt>seed_seq</tt> synopsis replace:
29455 </p>
29456
29457 <blockquote><pre>class seed_seq 
29458
29459 public:
29460    ...
29461    template&lt;class InputIterator<del>,
29462       size_t u = numeric_limits&lt;iterator_traits&lt;InputIterator&gt;::value_type&gt;::digits</del>&gt;
29463           seed_seq(InputIterator begin, InputIterator end<ins>,
29464           size_t u = numeric_limits&lt;typename iterator_traits&lt;InputIterator&gt;::value_type&gt;::digits</ins>);
29465    ...
29466 };
29467 </pre></blockquote>
29468
29469 <p>
29470 and do a similar replacement in the member description between
29471 p.3 and p.4.
29472 </p>
29473 </li>
29474
29475 <li>
29476 <p>
29477 In 26.4.7.1 [rand.util.seedseq]/2, class <tt>seed_seq</tt> synopsis <em>and</em> in the
29478 member description between p.3 and p.4 replace:
29479 </p>
29480
29481 <blockquote><pre>template&lt;class InputIterator<del>,
29482   size_t u = numeric_limits&lt;iterator_traits&lt;InputIterator&gt;::value_type&gt;::digits</del>&gt;
29483           seed_seq(InputIterator begin, InputIterator end);
29484 <ins>template&lt;class InputIterator, size_t u&gt;
29485 seed_seq(InputIterator begin, InputIterator end, <i>implementation-defined</i> s);</ins>
29486 </pre></blockquote>
29487
29488 <p>
29489 In 26.4.2 [rand.synopsis], header <tt>&lt;random&gt;</tt> synopsis, immediately after the
29490 class <tt>seed_seq</tt> declaration <em>and</em> in 26.4.7.1 [rand.util.seedseq]/2, immediately
29491 after the class <tt>seed_seq</tt> definition add:
29492 </p>
29493
29494 <blockquote><pre>template&lt;size_t u, class InputIterator&gt;
29495   seed_seq make_seed_seq(InputIterator begin, InputIterator end);
29496 </pre></blockquote>
29497
29498 <p>
29499 In 26.4.7.1 [rand.util.seedseq], just before p.5 insert two paragraphs:
29500 </p>
29501
29502 <blockquote>
29503 <p>
29504 The first constructor behaves as if it would provide an
29505 integral constant expression <tt>u</tt> of type <tt>size_t</tt> of value
29506 <tt>numeric_limits&lt;typename iterator_traits&lt;InputIterator&gt;::value_type&gt;::digits</tt>.
29507 </p>
29508 <p>
29509 The second constructor uses an implementation-defined mechanism
29510 to provide an integral constant expression <tt>u</tt> of type <tt>size_t</tt> and
29511 is called by the function <tt>make_seed_seq</tt>.
29512 </p>
29513 </blockquote>
29514
29515 <p>
29516 In 26.4.7.1 [rand.util.seedseq], just after the last paragraph add:
29517 </p>
29518
29519 <blockquote>
29520 <pre>template&lt;size_t u, class InputIterator&gt;
29521    seed_seq make_seed_seq(InputIterator begin, InputIterator end);
29522 </pre>
29523 <blockquote>
29524 <p>
29525 where <tt>u</tt> is used to construct an object <tt>s</tt> of implementation-defined type.
29526 </p>
29527 <p>
29528 <i>Returns:</i> <tt>seed_seq(begin, end, s)</tt>;
29529 </p>
29530 </blockquote>
29531 </blockquote>
29532
29533 </li>
29534 </ol>
29535
29536
29537
29538
29539
29540
29541 <hr>
29542 <h3><a name="783"></a>783. <tt>thread::id</tt> reuse</h3>
29543 <p><b>Section:</b> 30.2.1.1 [thread.thread.id] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29544  <b>Submitter:</b> Hans Boehm <b>Date:</b> 2008-02-01</p>
29545 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29546 <p><b>Discussion:</b></p>
29547 <p>
29548 The current working paper 
29549 (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html">N2497</a>,
29550 integrated just before Bellevue) is
29551 not completely clear whether a given <tt>thread::id</tt> value may be reused once
29552 a thread has exited and has been joined or detached.  Posix allows
29553 thread ids (<tt>pthread_t</tt> values) to be reused in this case.  Although it is
29554 not completely clear whether this originally was the right decision, it
29555 is clearly the established practice, and we believe it was always the
29556 intent of the C++ threads API to follow Posix and allow this.  Howard
29557 Hinnant's example implementation implicitly relies on allowing reuse
29558 of ids, since it uses Posix thread ids directly.
29559 </p>
29560
29561 <p>
29562 It is important to be clear on this point, since it the reuse of thread
29563 ids often requires extra care in client code, which would not be
29564 necessary if thread ids were unique across all time.  For example, a
29565 hash table indexed by thread id may have to be careful not to associate
29566 data values from an old thread with a new one that happens to reuse the
29567 id.  Simply removing the old entry after joining a thread may not be
29568 sufficient, if it creates a visible window between the join and removal
29569 during which a new thread with the same id could have been created and
29570 added to the table.
29571 </p>
29572
29573 <p><i>[
29574 post Bellevue Peter adds:
29575 ]</i></p>
29576
29577
29578 <blockquote>
29579 <p>
29580 There is a real issue with <tt>thread::id</tt> reuse, but I urge the LWG to
29581 reconsider fixing this by disallowing reuse, rather than explicitly allowing
29582 it. Dealing with thread id reuse is an incredibly painful exercise that
29583 would just force the world to reimplement a non-conflicting <tt>thread::id</tt> over
29584 and over.
29585 </p>
29586 <p>
29587 In addition, it would be nice if a <tt>thread::id</tt> could be manipulated
29588 atomically in a lock-free manner, as motivated by the recursive lock
29589 example:
29590 </p>
29591
29592 <p>
29593 <a href="http://www.decadentplace.org.uk/pipermail/cpp-threads/2006-August/001091.html">http://www.decadentplace.org.uk/pipermail/cpp-threads/2006-August/001091.html</a>
29594 </p>
29595 </blockquote>
29596
29597
29598
29599 <p><b>Proposed resolution:</b></p>
29600 <p>
29601 Add a sentence to 30.2.1.1 [thread.thread.id]/p1:
29602 </p>
29603
29604 <blockquote>
29605 <p>
29606 An object of type <code>thread::id</code> provides
29607 a unique identifier for each thread of execution
29608 and a single distinct value for all thread objects
29609 that do not represent a thread of execution ([thread.threads.class]).
29610 Each thread of execution has a <code>thread::id</code>
29611 that is not equal to the <code>thread::id</code>
29612 of other threads of execution
29613 and that is not equal to
29614 the <code>thread::id</code> of <code>std::thread</code> objects
29615 that do not represent threads of execution.
29616 <ins>The library may reuse the value of a <code>thread::id</code> of a
29617 terminated thread that can no longer be joined.</ins>
29618 </p>
29619 </blockquote>
29620
29621
29622
29623
29624
29625 <hr>
29626 <h3><a name="789"></a>789. <tt>xor_combine_engine(result_type)</tt> should be explicit</h3>
29627 <p><b>Section:</b> 26.4.4.4 [rand.adapt.xor] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29628  <b>Submitter:</b> P.J. Plauger <b>Date:</b> 2008-02-09</p>
29629 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.adapt.xor">issues</a> in [rand.adapt.xor].</p>
29630 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29631 <p><b>Discussion:</b></p>
29632 <p>
29633 <tt>xor_combine_engine(result_type)</tt> should be <tt>explicit</tt>. (Obvious oversight.)
29634 </p>
29635
29636 <p><i>[
29637 Bellevue:
29638 ]</i></p>
29639
29640
29641 <blockquote>
29642 Non-controversial. Bill is right, but Fermilab believes that this is
29643 easy to use badly and hard to use right, and so it should be removed
29644 entirely. Got into TR1 by well defined route, do we have permission to
29645 remove stuff? Should probably check with Jens, as it is believed he is
29646 the originator. Broad consensus that this is not a robust engine
29647 adapter.
29648 </blockquote>
29649
29650
29651 <p><b>Proposed resolution:</b></p>
29652 <p>
29653 Remove xor_combine_engine from synopsis of 26.4.2 [rand.synopsis].
29654 </p>
29655 <p>
29656 Remove 26.4.4.4 [rand.adapt.xor] <tt>xor_combine_engine</tt>.
29657 </p>
29658
29659
29660
29661
29662
29663 <hr>
29664 <h3><a name="792"></a>792. <tt>piecewise_constant_distribution</tt> is undefined for a range with just one endpoint</h3>
29665 <p><b>Section:</b> 26.4.8.5.2 [rand.dist.samp.pconst] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29666  <b>Submitter:</b> P.J. Plauger <b>Date:</b> 2008-02-09</p>
29667 <p><b>View other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index-open.html#rand.dist.samp.pconst">active issues</a> in [rand.dist.samp.pconst].</p>
29668 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#rand.dist.samp.pconst">issues</a> in [rand.dist.samp.pconst].</p>
29669 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29670 <p><b>Discussion:</b></p>
29671 <p>
29672 <tt>piecewise_constant_distribution</tt> is undefined for a range with just one
29673 endpoint. (Probably should be the same as an empty range.)
29674 </p>
29675
29676
29677 <p><b>Proposed resolution:</b></p>
29678 <p>
29679 Change 26.4.8.5.2 [rand.dist.samp.pconst] paragraph 3b:
29680 </p>
29681
29682 <blockquote>
29683 b) If <tt>firstB == lastB</tt> <ins>or the sequence <tt>w</tt> has the length zero</ins>,
29684 </blockquote>
29685
29686
29687
29688
29689
29690 <hr>
29691 <h3><a name="798"></a>798. Refactoring of binders lead to interface breakage</h3>
29692 <p><b>Section:</b> D.8 [depr.lib.binders] <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#WP">WP</a>
29693  <b>Submitter:</b> Daniel Krügler <b>Date:</b> 2008-02-14</p>
29694 <p><b>View all other</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html#depr.lib.binders">issues</a> in [depr.lib.binders].</p>
29695 <p><b>View all issues with</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html#WP">WP</a> status.</p>
29696 <p><b>Discussion:</b></p>
29697 <p>
29698 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2521.pdf">N2521</a>
29699 and its earlier predecessors have moved the old binders from
29700 [lib.binders] to D.8 [depr.lib.binders] thereby introducing some renaming
29701 of the template parameter names (<tt>Operation -&gt; Fn</tt>). During this
29702 renaming process the <em>protected</em> data member <tt>op</tt> was also renamed to
29703 <tt>fn</tt>, which seems as an unnecessary interface breakage to me - even if
29704 this user access point is probably rarely used.
29705 </p>
29706
29707
29708 <p><b>Proposed resolution:</b></p>
29709 <p>
29710 Change D.8.1 [depr.lib.binder.1st]:
29711 </p>
29712
29713 <blockquote>
29714 <pre>template &lt;class Fn&gt; 
29715 class binder1st 
29716   : public unary_function&lt;typename Fn::second_argument_type, 
29717                           typename Fn::result_type&gt; { 
29718 protected: 
29719   Fn <del>fn</del> <ins>op</ins>; 
29720   typename Fn::first_argument_type value; 
29721 public: 
29722   binder1st(const Fn&amp; x, 
29723             const typename Fn::first_argument_type&amp; y); 
29724   typename Fn::result_type 
29725     operator()(const typename Fn::second_argument_type&amp; x) const; 
29726   typename Fn::result_type 
29727     operator()(typename Fn::second_argument_type&amp; x) const; 
29728 };
29729 </pre>
29730
29731 <blockquote>
29732 <p>
29733 -1- The constructor initializes <del><tt>fn</tt></del> <ins><tt>op</tt></ins> with <tt>x</tt> and <tt>value</tt> with <tt>y</tt>.
29734 </p>
29735 <p>
29736 -2- <tt>operator()</tt> returns <tt><del>fn</del><ins>op</ins>(value,x)</tt>.
29737 </p>
29738 </blockquote>
29739 </blockquote>
29740
29741 <p>
29742 Change D.8.3 [depr.lib.binder.2nd]:
29743 </p>
29744
29745 <blockquote>
29746 <pre>template &lt;class Fn&gt; 
29747 class binder2nd
29748   : public unary_function&lt;typename Fn::first_argument_type, 
29749                           typename Fn::result_type&gt; { 
29750 protected: 
29751   Fn <del>fn</del> <ins>op</ins>; 
29752   typename Fn::second_argument_type value; 
29753 public: 
29754   binder2nd(const Fn&amp; x, 
29755             const typename Fn::second_argument_type&amp; y); 
29756   typename Fn::result_type 
29757     operator()(const typename Fn::first_argument_type&amp; x) const; 
29758   typename Fn::result_type 
29759     operator()(typename Fn::first_argument_type&amp; x) const; 
29760 };
29761 </pre>
29762
29763 <blockquote>
29764 <p>
29765 -1- The constructor initializes <del><tt>fn</tt></del> <ins><tt>op</tt></ins> with <tt>x</tt> and <tt>value</tt> with <tt>y</tt>.
29766 </p>
29767 <p>
29768 -2- <tt>operator()</tt> returns <tt><del>fn</del><ins>op</ins>(value,x)</tt>.
29769 </p>
29770 </blockquote>
29771 </blockquote>
29772
29773
29774
29775
29776
29777
29778 </body></html>