1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> 2<html><head><title>C++ Standard Library Closed Issues List</title> 3 4<style>ins {background-color:#FFFFA0} 5del {background-color:#FFFFA0}</style></head> 6 7<body bgcolor="#ffffff" text="#000000"> 8<table> 9<tbody><tr> 10<td align="left">Doc. no.</td> 11<td align="left">N2132=06-0202</td> 12</tr> 13<tr> 14<td align="left">Date:</td> 15<td align="left">2006-11-03</td> 16</tr> 17<tr> 18<td align="left">Project:</td> 19<td align="left">Programming Language C++</td> 20</tr> 21<tr> 22<td align="left">Reply to:</td> 23<td align="left">Howard Hinnant <howard.hinnant@gmail.com></td> 24</tr> 25</tbody></table> 26<h1>C++ Standard Library Closed Issues List (Revision R45)</h1> 27 <p>Reference ISO/IEC IS 14882:1998(E)</p> 28 <p>Also see:</p> 29 <ul> 30 <li> 31<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-toc.html">Table of Contents</a> for all library issues.</li> 32 <li> 33<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-index.html">Index by Section</a> for all library issues.</li> 34 <li> 35<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-status.html">Index by Status</a> for all library issues.</li> 36 <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html">Library Active Issues List</a></li> 37 <li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html">Library Defect Reports List</a></li> 38 </ul> 39 40 <p>This document contains only library issues which have been closed 41 by the Library Working Group as duplicates or not defects. That is, 42 issues which have a status of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> or <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a>. See the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html">Library Active Issues List</a> active issues and more 43 information. See the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html">Library Defect Reports List</a> for issues considered 44 defects. The introductory material in that document also applies to 45 this document.</p> 46<h2>Revision History</h2> 47<ul> 48<li>R45: 492006-11-03 post-Portland mailing. 50Moved 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. 51Moved 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. 52Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#569">569</a> to Dup. 53Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.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-active.html#524">524</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.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-active.html#557">557</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.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. 54Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#543">543</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.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-active.html#598">598</a> - <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#603">603</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#605">605</a> to Ready. 55Moved issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#531">531</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#551">551</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#604">604</a> to Review. 56Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#593">593</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#609">609</a>. 57</li> 58<li>R44: 592006-09-08 pre-Portland mailing. 60Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#583">583</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#592">592</a>. 61</li> 62<li>R43: 632006-06-23 mid-term mailing. 64Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#575">575</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#582">582</a>. 65Reopened <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#255">255</a>. 66Moved 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. 67</li> 68<li>R42: 692006-04-21 post-Berlin mailing. 70Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#567">567</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#572">572</a>. 71Moved 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. 72Moved 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-active.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-active.html#525">525</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#529">529</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#532">532</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.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-active.html#548">548</a> to Open. 73Moved 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-active.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. 74Moved 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. 75Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#534">534</a> to Review. 76</li> 77<li>R41: 782006-02-24 pre-Berlin mailing. 79Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#536">536</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#566">566</a>. 80Moved <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#342">342</a> from Ready to Open. 81Reopened <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#309">309</a>. 82</li> 83<li>R40: 842005-12-16 mid-term mailing. 85Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#529">529</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#535">535</a>. 86</li> 87<li>R39: 882005-10-14 post-Mont Tremblant mailing. 89Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#526">526</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#528">528</a>. 90Moved 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. 91Moved 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. 92Moved 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. 93Moved 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. 94Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#500">500</a> from New to NAD. 95Moved issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#518">518</a> from New to Review. 96</li> 97<li>R38: 982005-07-03 pre-Mont Tremblant mailing. 99Merged 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>. 100Added 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> 101</li> 102<li>R37: 1032005-06 mid-term mailing. 104Added 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>. 105</li> 106<li>R36: 1072005-04 post-Lillehammer mailing. All issues in "ready" status except 108for <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 109previously in "DR" status were moved to "WP". 110</li> 111<li>R35: 1122005-03 pre-Lillehammer mailing. 113</li> 114<li>R34: 1152005-01 mid-term mailing. Added new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#488">488</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#494">494</a>. 116</li> 117<li>R33: 1182004-11 post-Redmond mailing. Reflects actions taken in Redmond. 119</li> 120<li>R32: 1212004-09 pre-Redmond mailing: reflects new proposed resolutions and 122new issues received after the 2004-07 mailing. Added 123new issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#479">479</a>-<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#481">481</a>. 124</li> 125<li>R31: 1262004-07 mid-term mailing: reflects new proposed resolutions and 127new issues received after the post-Sydney mailing. Added 128new 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>. 129</li> 130<li>R30: 131Post-Sydney mailing: reflects decisions made at the Sydney meeting. 132Voted all "Ready" issues from R29 into the working paper. 133Added 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-active.html#462">462</a>. 134</li> 135<li>R29: 136Pre-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>. 137</li> 138<li>R28: 139Post-Kona mailing: reflects decisions made at the Kona meeting. 140Added 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>. 141</li> 142<li>R27: 143Pre-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>. 144</li> 145<li>R26: 146Post-Oxford mailing: reflects decisions made at the Oxford meeting. 147All issues in Ready status were voted into DR status. All issues in 148DR status were voted into WP status. 149</li> 150<li>R25: 151Pre-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>. 152</li> 153<li>R24: 154Post-Santa Cruz mailing: reflects decisions made at the Santa Cruz 155meeting. 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 156moved 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 157at 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 158concerns with <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#226">226</a> involve wording. 159</li> 160<li>R23: 161Pre-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>. 162Moved issues in the TC to TC status. 163</li> 164<li>R22: 165Post-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>. 166</li> 167<li>R21: 168Pre-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>. 169</li> 170<li>R20: 171Post-Redmond mailing; reflects actions taken in Redmond. Added 172new 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 173<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 174not discussed at the meeting. 175 176All Ready issues were moved to DR status, with the exception of issues 177<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>. 178 179Noteworthy issues discussed at Redmond include 180<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-active.html#233">233</a>, 181<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-active.html#254">254</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#323">323</a>. 182</li> 183<li>R19: 184Pre-Redmond mailing. Added new issues 185<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>. 186</li> 187<li>R18: 188Post-Copenhagen mailing; reflects actions taken in Copenhagen. 189Added 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 190new 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>. 191 192Changed status of issues 193<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> 194<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> 195<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> 196<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> 197<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> 198<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> 199<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#268">268</a> 200to DR. 201 202Changed status of issues 203<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> 204<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> 205<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> 206<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> 207<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> 208<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> 209<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> 210<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> 211<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> 212to Ready. 213 214Closed issues 215<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> 216<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> 217<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#314">314</a> 218as NAD. 219 220</li> 221<li>R17: 222Pre-Copenhagen mailing. Converted issues list to XML. Added proposed 223resolutions 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>. 224Added 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>. 225</li> 226<li>R16: 227post-Toronto mailing; reflects actions taken in Toronto. Added new 228issues <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 229<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>, 230<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>, 231<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>, 232<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>, 233<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>, 234<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>, 235<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>, 236<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>, 237<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>, 238<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>, 239<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>, 240<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>, 241<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 242issue <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 243<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 244issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#70">70</a>: signature should be changed both places it 245appears. Fixed issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#160">160</a>: previous version didn't fix 246the bug in enough places. 247</li> 248<li>R15: 249pre-Toronto mailing. Added issues 250<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.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 251changes so that we pass Weblint tests. 252</li> 253<li>R14: 254post-Tokyo II mailing; reflects committee actions taken in 255Tokyo. 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) 256</li> 257<li>R13: 258pre-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>. 259</li> 260<li>R12: 261pre-Tokyo II mailing: Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#199">199</a> to 262<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 263of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#29">29</a>. Add further rationale to issue 264<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#178">178</a>. 265</li> 266<li>R11: 267post-Kona mailing: Updated to reflect LWG and full committee actions 268in Kona (99-0048/N1224). Note changed resolution of issues 269<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> 270to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198">198</a>. Closed issues list split into "defects" and 271"closed" documents. Changed the proposed resolution of issue 272<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 273of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#38">38</a>. 274</li> 275<li>R10: 276pre-Kona updated. Added proposed resolutions <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#83">83</a>, 277<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>, 278<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-closed.html#190">190</a> to 279<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#195">195</a>. (99-0033/D1209, 14 Oct 99) 280</li> 281<li>R9: 282pre-Kona mailing. Added issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#140">140</a> to 283<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#189">189</a>. Issues list split into separate "active" and 284"closed" documents. (99-0030/N1206, 25 Aug 99) 285</li> 286<li>R8: 287post-Dublin mailing. Updated to reflect LWG and full committee actions 288in Dublin. (99-0016/N1193, 21 Apr 99) 289</li> 290<li>R7: 291pre-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>, 292<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>, 293<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>, 294<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) 295</li> 296<li>R6: 297pre-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-closed.html#128">128</a>, 298and <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#129">129</a>. (99-0007/N1194, 22 Feb 99) 299</li> 300<li>R5: 301update 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 302<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 303for making list public. (30 Dec 98) 304</li> 305<li>R4: 306post-Santa Cruz II updated: Issues <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#110">110</a>, 307<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 308issues corrected. (22 Oct 98) 309</li> 310<li>R3: 311post-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> 312added, many issues updated to reflect LWG consensus (12 Oct 98) 313</li> 314<li>R2: 315pre-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, 316issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#17">17</a> updated. (29 Sep 98) 317</li> 318<li>R1: 319Correction 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 320format, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#64">64</a> title. (17 Sep 98) 321</li> 322</ul> 323<h2>Closed Issues</h2> 324<hr> 325<a name="2"><h3>2. Auto_ptr conversions effects incorrect</h3></a><p><b>Section:</b> 20.4.5.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.meta.unary.prop"> [lib.meta.unary.prop]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nathan Myers <b>Date:</b> 4 Dec 1997</p> 326<p>Paragraph 1 in "Effects", says "Calls 327p->release()" where it clearly must be "Calls 328p.release()". (As it is, it seems to require using 329auto_ptr<>::operator-> to refer to X::release, assuming that 330exists.)</p> 331<p><b>Proposed resolution:</b></p> 332<p>Change 20.4.5.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.meta.unary.prop"> [lib.meta.unary.prop]</a> paragraph 1 Effects from 333"Calls p->release()" to "Calls p.release()".</p> 334<p><b>Rationale:</b></p> 335<p>Not a defect: the proposed change is already found in the standard. 336[Originally classified as a defect, later reclassified.]</p> 337<hr> 338<a name="4"><h3>4. Basic_string size_type and difference_type should be implementation defined</h3></a><p><b>Section:</b> 21.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.basic.string"> [lib.basic.string]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Beman Dawes <b>Date:</b> 16 Nov 1997</p> 339<p>In Morristown we changed the size_type and difference_type typedefs 340for all the other containers to implementation defined with a 341reference to 23.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.requirements"> [lib.container.requirements]</a>. This should probably also have been 342done for strings. </p> 343<p><b>Proposed resolution:</b></p> 344<p><b>Rationale:</b></p> 345<p>Not a defect. [Originally classified as a defect, later 346reclassified.] basic_string, unlike the other standard library 347template containers, is severely constrained by its use of 348char_traits. Those types are dictated by the traits class, and are far 349from implementation defined.</p> 350<hr> 351<a name="6"><h3>6. File position not an offset unimplementable</h3></a><p><b>Section:</b> 27.4.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.fpos"> [lib.fpos]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 15 Dec 1997</p> 352<p>Table 88, in I/O, is too strict; it's unimplementable on systems 353where a file position isn't just an offset. It also never says just 354what fpos<> is really supposed to be. [Here's my summary, which 355Jerry agrees is more or less accurate. "I think I now know what 356the class really is, at this point: it's a magic cookie that 357encapsulates an mbstate_t and a file position (possibly represented as 358an fpos_t), it has syntactic support for pointer-like arithmetic, and 359implementors are required to have real, not just syntactic, support 360for arithmetic." This isn't standardese, of course.] </p> 361<p><b>Proposed resolution:</b></p> 362<p><b>Rationale:</b></p> 363<p>Not a defect. The LWG believes that the Standard is already clear, 364and that the above summary is what the Standard in effect says.</p> 365<hr> 366<a name="10"><h3>10. Codecvt<>::do unclear</h3></a><p><b>Section:</b> 22.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt.byname"> [lib.locale.codecvt.byname]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 14 Jan 1998</p> 367<p>Section 22.2.1.5.2 says that codecvt<>::do_in and do_out 368should return the value noconv if "no conversion was 369needed". However, I don't see anything anywhere that defines what 370it means for a conversion to be needed or not needed. I can think of 371several circumstances where one might plausibly think that a 372conversion is not "needed", but I don't know which one is 373intended here. </p> 374<p><b>Proposed resolution:</b></p> 375<p><b>Rationale:</b></p> 376<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#19">19</a>.</p> 377<hr> 378<a name="12"><h3>12. Way objects hold allocators unclear</h3></a><p><b>Section:</b> 20.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.default.con.req"> [lib.default.con.req]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Angelika Langer <b>Date:</b> 23 Feb 1998</p> 379<p>I couldn't find a statement in the standard saying whether the allocator object held by 380a container is held as a copy of the constructor argument or whether a pointer of 381reference is maintained internal. There is an according statement for compare objects and 382how they are maintained by the associative containers, but I couldn't find anything 383regarding allocators. </p> 384 385<p>Did I overlook it? Is it an open issue or known defect? Or is it deliberately left 386unspecified? </p> 387<p><b>Proposed resolution:</b></p> 388<p><b>Rationale:</b></p> 389<p>Not a defect. The LWG believes that the Standard is already 390clear. See 23.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.requirements"> [lib.container.requirements]</a>, paragraph 8.</p> 391<hr> 392<a name="43"><h3>43. Locale table correction</h3></a><p><b>Section:</b> 22.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt.byname"> [lib.locale.codecvt.byname]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Brendan Kehoe <b>Date:</b> 1 Jun 1998</p> 393<p><b>Proposed resolution:</b></p> 394<p><b>Rationale:</b></p> 395<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#33">33</a>.</p> 396<hr> 397<a name="45"><h3>45. Stringstreams read/write pointers initial position unclear</h3></a><p><b>Section:</b> 27.7.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ostringstream"> [lib.ostringstream]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matthias Mueller <b>Date:</b> 27 May 1998</p> 398<p>In a comp.lang.c++.moderated Matthias Mueller wrote:</p> 399 400<p>"We are not sure how to interpret the CD2 (see 27.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.iostream.forward"> [lib.iostream.forward]</a>, 27.7.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ostringstream.cons"> [lib.ostringstream.cons]</a>, 27.7.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.stringbuf.cons"> [lib.stringbuf.cons]</a>) 401with respect to the question as to what the correct initial positions 402of the write and read pointers of a stringstream should 403be."</p> 404 405<p>"Is it the same to output two strings or to initialize the stringstream with the 406first and to output the second?"</p> 407 408<p><i>[PJ Plauger, Bjarne Stroustrup, Randy Smithey, Sean Corfield, and 409Jerry Schwarz have all offered opinions; see reflector messages 410lib-6518, 6519, 6520, 6521, 6523, 6524.]</i></p> 411 412<p><b>Proposed resolution:</b></p> 413<p><b>Rationale:</b></p> 414<p>The LWG believes the Standard is correct as written. The behavior 415of stringstreams is consistent with fstreams, and there is a 416constructor which can be used to obtain the desired effect. This 417behavior is known to be different from strstreams.</p> 418<hr> 419<a name="58"><h3>58. Extracting a char from a wide-oriented stream</h3></a><p><b>Section:</b> 27.6.1.2.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream::extractors"> [lib.istream::extractors]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 1 Jul 1998</p> 420<p>27.6.1.2.3 has member functions for extraction of signed char and 421unsigned char, both singly and as strings. However, it doesn't say 422what it means to extract a <tt>char</tt> from a 423<tt>basic_streambuf<charT, Traits></tt>. </p> 424 425<p>basic_streambuf, after all, has no members to extract a char, so 426basic_istream must somehow convert from charT to signed char or 427unsigned char. The standard doesn't say how it is to perform that 428conversion. </p> 429<p><b>Proposed resolution:</b></p> 430<p><b>Rationale:</b></p> 431<p>The Standard is correct as written. There is no such extractor and 432this is the intent of the LWG.</p> 433<hr> 434<a name="65"><h3>65. Underspecification of strstreambuf::seekoff</h3></a><p><b>Section:</b> D.7.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/future.html#depr.strstreambuf.virtuals"> [depr.strstreambuf.virtuals]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 18 Aug 1998</p> 435<p>The standard says how this member function affects the current 436stream position. (<tt>gptr</tt> or <tt>pptr</tt>) However, it does not 437say how this member function affects the beginning and end of the 438get/put area. </p> 439 440<p>This is an issue when seekoff is used to position the get pointer 441beyond the end of the current read area. (Which is legal. This is 442implicit in the definition of <i>seekhigh</i> in D.7.1, paragraph 4.) 443</p> 444<p><b>Proposed resolution:</b></p> 445<p><b>Rationale:</b></p> 446<p>The LWG agrees that seekoff() is underspecified, but does not wish 447to invest effort in this deprecated feature.</p> 448<hr> 449<a name="67"><h3>67. Setw useless for strings</h3></a><p><b>Section:</b> 21.3.7.9 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string.io"> [lib.string.io]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Steve Clamage <b>Date:</b> 9 Jul 1998</p> 450<p>In a comp.std.c++ posting Michel Michaud wrote: What 451should be output by: </p> 452 453<pre> string text("Hello"); 454 cout << '[' << setw(10) << right << text << ']'; 455</pre> 456 457<p>Shouldn't it be:</p> 458 459<pre> [ Hello]</pre> 460 461<p>Another person replied: Actually, according to the FDIS, the width 462of the field should be the minimum of width and the length of the 463string, so the output shouldn't have any padding. I think that this is 464a typo, however, and that what is wanted is the maximum of the 465two. (As written, setw is useless for strings. If that had been the 466intent, one wouldn't expect them to have mentioned using its value.) 467</p> 468 469<p>It's worth pointing out that this is a recent correction anyway; 470IIRC, earlier versions of the draft forgot to mention formatting 471parameters whatsoever.</p> 472<p><b>Proposed resolution:</b></p> 473<p><b>Rationale:</b></p> 474<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#25">25</a>.</p> 475<hr> 476<a name="72"><h3>72. Do_convert phantom member function</h3></a><p><b>Section:</b> 22.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt.byname"> [lib.locale.codecvt.byname]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Nathan Myers <b>Date:</b> 24 Aug 1998</p> 477<p>In 22.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt.byname"> [lib.locale.codecvt.byname]</a> par 3, and in <font color="red">22.2.1.5.2</font> par 8, a nonexistent member function 478"do_convert" is mentioned. This member was replaced with 479"do_in" and "do_out", the proper referents in the 480contexts above.</p> 481<p><b>Proposed resolution:</b></p> 482<p><b>Rationale:</b></p> 483<p>Duplicate: see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#24">24</a>.</p> 484<hr> 485<a name="73"><h3>73. <tt>is_open</tt> should be const</h3></a><p><b>Section:</b> 27.8.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.fstreams"> [lib.fstreams]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 27 Aug 1998</p> 486<p>Classes <tt>basic_ifstream</tt>, <tt>basic_ofstream</tt>, and 487<tt>basic_fstream</tt> all have a member function <tt>is_open</tt>. It 488should be a <tt>const</tt> member function, since it does nothing but 489call one of <tt>basic_filebuf</tt>'s const member functions. </p> 490<p><b>Proposed resolution:</b></p> 491<p><b>Rationale:</b></p> 492<p>Not a defect. This is a deliberate feature; const streams would be 493meaningless.</p> 494<hr> 495<a name="77"></a><h3><a name="77">77. Valarray operator[] const returning value</a></h3><p><b>Section:</b> 26.5.2.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.valarray.access"> [lib.valarray.access]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Levente Farkas <b>Date:</b> 9 Sep 1998</p> 496<p>valarray:<br> 497<br> 498 <tt>T operator[] (size_t) const;</tt><br> 499<br> 500why not <br> 501<br> 502 <tt>const T& operator[] (size_t) const;</tt><br> 503<br> 504as in vector ???<br> 505<br> 506One can't copy even from a const valarray eg:<br> 507<br> 508 <tt>memcpy(ptr, &v[0], v.size() * sizeof(double));<br> 509</tt><br> 510[I] find this bug in valarray is very difficult.</p> 511<p><b>Proposed resolution:</b></p> 512<p><b>Rationale:</b></p> 513<p>The LWG believes that the interface was deliberately designed that 514way. That is what valarray was designed to do; that's where the 515"value array" name comes from. LWG members further comment 516that "we don't want valarray to be a full STL container." 51726.5.2.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.valarray.access"> [lib.valarray.access]</a> specifies properties that indicate "an 518absence of aliasing" for non-constant arrays; this allows 519optimizations, including special hardware optimizations, that are not 520otherwise possible. </p> 521<hr> 522<a name="81"><h3>81. Wrong declaration of slice operations</h3></a><p><b>Section:</b> 26.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.member.ops"> [lib.complex.member.ops]</a>, 26.3.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.value.ops"> [lib.complex.value.ops]</a>, 26.3.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.transcendentals"> [lib.complex.transcendentals]</a>, 26.3.9 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.cmplx.over"> [lib.cmplx.over]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 523<p>Isn't the definition of copy constructor and assignment operators wrong? 524 Instead of</p> 525 526<pre> slice_array(const slice_array&); 527 slice_array& operator=(const slice_array&);</pre> 528 529<p>IMHO they have to be</p> 530 531<pre> slice_array(const slice_array<T>&); 532 slice_array& operator=(const slice_array<T>&);</pre> 533 534<p>Same for gslice_array. </p> 535<p><b>Proposed resolution:</b></p> 536<p><b>Rationale:</b></p> 537<p>Not a defect. The Standard is correct as written. </p> 538<hr> 539<a name="82"><h3>82. Missing constant for set elements</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 540<p>Paragraph 5 specifies:</p> 541 542<blockquote> 543For set and multiset the value type is the same as the key type. For 544map and multimap it is equal to pair<const Key, T>. 545</blockquote> 546 547<p>Strictly speaking, this is not correct because for set and multiset 548the value type is the same as the <b>constant</b> key type.</p> 549<p><b>Proposed resolution:</b></p> 550<p><b>Rationale:</b></p> 551<p>Not a defect. The Standard is correct as written; it uses a 552different mechanism (const &) for <tt>set</tt> and 553<tt>multiset</tt>. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#103">103</a> for a related 554issue.</p> 555<hr> 556<a name="84"><h3>84. Ambiguity with string::insert()</h3></a><p><b>Section:</b> 21.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string.modifiers"> [lib.string.modifiers]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 557<p>If I try</p> 558<pre> s.insert(0,1,' ');</pre> 559 560<p> I get an nasty ambiguity. It might be</p> 561<pre> s.insert((size_type)0,(size_type)1,(charT)' ');</pre> 562 563<p>which inserts 1 space character at position 0, or</p> 564<pre> s.insert((char*)0,(size_type)1,(charT)' ')</pre> 565 566<p>which inserts 1 space character at iterator/address 0 (bingo!), or</p> 567<pre> s.insert((char*)0, (InputIterator)1, (InputIterator)' ')</pre> 568 569<p>which normally inserts characters from iterator 1 to iterator ' 570'. But according to 23.1.1.9 (the "do the right thing" fix) 571it is equivalent to the second. However, it is still ambiguous, 572because of course I mean the first!</p> 573<p><b>Proposed resolution:</b></p> 574<p><b>Rationale:</b></p> 575<p>Not a defect. The LWG believes this is a "genetic 576misfortune" inherent in the design of string and thus not a 577defect in the Standard as such .</p> 578<hr> 579<a name="85"><h3>85. String char types</h3></a><p><b>Section:</b> 21 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.strings"> [lib.strings]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 580<p>The standard seems not to require that charT is equivalent to 581traits::char_type. So, what happens if charT is not equivalent to 582traits::char_type?</p> 583<p><b>Proposed resolution:</b></p> 584<p><b>Rationale:</b></p> 585<p>There is already wording in 21.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.char.traits"> [lib.char.traits]</a> paragraph 3 that 586requires them to be the same.</p> 587<hr> 588<a name="87"><h3>87. Error in description of string::compare()</h3></a><p><b>Section:</b> 21.3.6.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::compare"> [lib.string::compare]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 589<p>The following compare() description is obviously a bug:</p> 590 591<pre>int compare(size_type pos, size_type n1, 592 charT *s, size_type n2 = npos) const; 593</pre> 594 595<p>because without passing n2 it should compare up to the end of the 596string instead of comparing npos characters (which throws an 597exception) </p> 598<p><b>Proposed resolution:</b></p> 599<p><b>Rationale:</b></p> 600<p>Duplicate; see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#5">5</a>.</p> 601<hr> 602<a name="88"><h3>88. Inconsistency between string::insert() and string::append()</h3></a><p><b>Section:</b> 21.3.5.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::insert"> [lib.string::insert]</a>, 21.3.5.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::append"> [lib.string::append]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 603<p>Why does </p> 604<pre> template<class InputIterator> 605 basic_string& append(InputIterator first, InputIterator last);</pre> 606 607<p>return a string, while</p> 608<pre> template<class InputIterator> 609 void insert(iterator p, InputIterator first, InputIterator last);</pre> 610 611<p>returns nothing ?</p> 612<p><b>Proposed resolution:</b></p> 613<p><b>Rationale:</b></p> 614<p>The LWG believes this stylistic inconsistency is not sufficiently 615serious to constitute a defect.</p> 616<hr> 617<a name="89"><h3>89. Missing throw specification for string::insert() and string::replace()</h3></a><p><b>Section:</b> 21.3.5.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::insert"> [lib.string::insert]</a>, 21.3.5.6 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::replace"> [lib.string::replace]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 618<p>All insert() and replace() members for strings with an iterator as 619first argument lack a throw specification. The throw 620specification should probably be: length_error if size exceeds 621maximum. </p> 622<p><b>Proposed resolution:</b></p> 623<p><b>Rationale:</b></p> 624<p>Considered a duplicate because it will be solved by the resolution 625of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#83">83</a>.</p> 626<hr> 627<a name="93"><h3>93. Incomplete Valarray Subset Definitions</h3></a><p><b>Section:</b> 26.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.numbers"> [lib.complex.numbers]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 29 Sep 1998</p> 628<p>You can easily create subsets, but you can't easily combine them 629with other subsets. Unfortunately, you almost always needs an 630explicit type conversion to valarray. This is because the standard 631does not specify that valarray subsets provide the same operations as 632valarrays. </p> 633 634<p>For example, to multiply two subsets and assign the result to a third subset, you can't 635write the following:</p> 636 637<pre>va[slice(0,4,3)] = va[slice(1,4,3)] * va[slice(2,4,3)];</pre> 638 639<p>Instead, you have to code as follows:</p> 640 641<pre>va[slice(0,4,3)] = static_cast<valarray<double> >(va[slice(1,4,3)]) * 642 static_cast<valarray<double> >(va[slice(2,4,3)]);</pre> 643 644<p>This is tedious and error-prone. Even worse, it costs performance because each cast 645creates a temporary objects, which could be avoided without the cast. </p> 646<p><b>Proposed resolution:</b></p> 647<p>Extend all valarray subset types so that they offer all valarray operations.</p> 648<p><b>Rationale:</b></p> 649<p>This is not a defect in the Standard; it is a request for an extension.</p> 650<hr> 651<a name="94"><h3>94. May library implementors add template parameters to Standard Library classes?</h3></a><p><b>Section:</b> 17.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.conforming"> [lib.conforming]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 22 Jan 1998</p> 652<p>Is it a permitted extension for library implementors to add template parameters to 653standard library classes, provided that those extra parameters have defaults? For example, 654instead of defining <tt>template <class T, class Alloc = allocator<T> > class 655vector;</tt> defining it as <tt>template <class T, class Alloc = allocator<T>, 656int N = 1> class vector;</tt> </p> 657 658<p>The standard may well already allow this (I can't think of any way that this extension 659could break a conforming program, considering that users are not permitted to 660forward-declare standard library components), but it ought to be explicitly permitted or 661forbidden. </p> 662 663<p>comment from Steve Cleary via comp.std.c++:</p> 664<blockquote> 665<p>I disagree [with the proposed resolution] for the following reason: 666consider user library code with template template parameters. For 667example, a user library object may be templated on the type of 668underlying sequence storage to use (deque/list/vector), since these 669classes all take the same number and type of template parameters; this 670would allow the user to determine the performance tradeoffs of the 671user library object. A similar example is a user library object 672templated on the type of underlying set storage (set/multiset) or map 673storage (map/multimap), which would allow users to change (within 674reason) the semantic meanings of operations on that object.</p> 675<p>I think that additional template parameters should be forbidden in 676the Standard classes. Library writers don't lose any expressive power, 677and can still offer extensions because additional template parameters 678may be provided by a non-Standard implementation class:</p> 679<pre> 680 template <class T, class Allocator = allocator<T>, int N = 1> 681 class __vector 682 { ... }; 683 template <class T, class Allocator = allocator<T> > 684 class vector: public __vector<T, Allocator> 685 { ... }; 686</pre> 687 688</blockquote> 689 690<p><b>Proposed resolution:</b></p> 691<p>Add a new subclause [presumably 17.4.4.9] following 17.4.4.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.res.on.exception.handling"> [lib.res.on.exception.handling]</a>:</p> 692 693<blockquote> 694 <p>17.4.4.9 Template Parameters</p> <p>A specialization of a 695 template class described in the C++ Standard Library behaves the 696 same as if the implementation declares no additional template 697 parameters.</p> <p>Footnote: Additional template parameters with 698 default values are thus permitted.</p> 699</blockquote> 700 701<p>Add "template parameters" to the list of subclauses at 702the end of 17.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.conforming"> [lib.conforming]</a> paragraph 1.</p> 703 704<p><i>[Kona: The LWG agreed the standard needs clarification. After 705discussion with John Spicer, it seems added template parameters can be 706detected by a program using template-template parameters. A straw vote 707- "should implementors be allowed to add template 708parameters?" found no consensus ; 5 - yes, 7 - no.]</i></p> 709 710<p><b>Rationale:</b></p> 711<p> 712There is no ambiguity; the standard is clear as written. Library 713implementors are not permitted to add template parameters to standard 714library classes. This does not fall under the "as if" rule, 715so it would be permitted only if the standard gave explicit license 716for implementors to do this. This would require a change in the 717standard. 718</p> 719 720<p> 721The LWG decided against making this change, because it would break 722user code involving template template parameters or specializations 723of standard library class templates. 724</p> 725<hr> 726<a name="95"><h3>95. Members added by the implementation</h3></a><p><b>Section:</b> 17.4.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.member.functions"> [lib.member.functions]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 727<p>In 17.3.4.4/2 vs 17.3.4.7/0 there is a hole; an implementation could add virtual 728members a base class and break user derived classes.</p> 729 730<p>Example: </p> 731 732<blockquote> 733 <pre>// implementation code: 734struct _Base { // _Base is in the implementer namespace 735 virtual void foo (); 736}; 737class vector : _Base // deriving from a class is allowed 738{ ... }; 739 740// user code: 741class vector_checking : public vector 742{ 743 void foo (); // don't want to override _Base::foo () as the 744 // user doesn't know about _Base::foo () 745};</pre> 746</blockquote> 747<p><b>Proposed resolution:</b></p> 748<p>Clarify the wording to make the example illegal.</p> 749<p><b>Rationale:</b></p> 750<p>This is not a defect in the Standard. The example is already 751illegal. See 17.4.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.member.functions"> [lib.member.functions]</a> paragraph 2.</p> 752<hr> 753<a name="97"><h3>97. Insert inconsistent definition</h3></a><p><b>Section:</b> 23 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.containers"> [lib.containers]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 754<p><tt>insert(iterator, const value_type&)</tt> is defined both on 755sequences and on set, with unrelated semantics: insert here (in 756sequences), and insert with hint (in associative containers). They 757should have different names (B.S. says: do not abuse overloading).</p> 758<p><b>Proposed resolution:</b></p> 759<p><b>Rationale:</b></p> 760<p>This is not a defect in the Standard. It is a genetic misfortune of 761the design, for better or for worse.</p> 762<hr> 763<a name="99"><h3>99. Reverse_iterator comparisons completely wrong</h3></a><p><b>Section:</b> 24.4.1.3.13 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.reverse.iter.op=="> [lib.reverse.iter.op==]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 764<p>The <, >, <=, >= comparison operator are wrong: they 765return the opposite of what they should.</p> 766 767<p>Note: same problem in CD2, these were not even defined in CD1. SGI 768STL code is correct; this problem is known since the Morristown 769meeting but there it was too late</p> 770<p><b>Proposed resolution:</b></p> 771<p><b>Rationale:</b></p> 772<p>This is not a defect in the Standard. A careful reading shows the Standard is correct 773as written. A review of several implementations show that they implement 774exactly what the Standard says.</p> 775<hr> 776<a name="100"><h3>100. Insert iterators/ostream_iterators overconstrained</h3></a><p><b>Section:</b> 24.4.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.insert.iterators"> [lib.insert.iterators]</a>, 24.5.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.ostreambuf.iterator"> [lib.ostreambuf.iterator]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 777<p>Overspecified For an insert iterator it, the expression *it is 778required to return a reference to it. This is a simple possible 779implementation, but as the SGI STL documentation says, not the only 780one, and the user should not assume that this is the case.</p> 781<p><b>Proposed resolution:</b></p> 782<p><b>Rationale:</b></p> 783<p>The LWG believes this causes no harm and is not a defect in the 784standard. The only example anyone could come up with caused some 785incorrect code to work, rather than the other way around.</p> 786<hr> 787<a name="101"><h3>101. No way to free storage for vector and deque</h3></a><p><b>Section:</b> 23.2.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.adaptors"> [lib.container.adaptors]</a>, 23.2.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.array"> [lib.array]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 788<p>Reserve can not free storage, unlike string::reserve</p> 789<p><b>Proposed resolution:</b></p> 790<p><b>Rationale:</b></p> 791<p>This is not a defect in the Standard. The LWG has considered this 792issue in the past and sees no need to change the Standard. Deque has 793no reserve() member function. For vector, shrink-to-fit can be 794expressed in a single line of code (where <tt>v</tt> is 795<tt>vector<T></tt>): 796</p> 797 798<blockquote> 799 <p><tt>vector<T>(v).swap(v); // shrink-to-fit v</tt></p> 800</blockquote> 801<hr> 802<a name="102"><h3>102. Bug in insert range in associative containers</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 803<p>Table 69 of Containers say that a.insert(i,j) is linear if [i, j) is ordered. It seems 804impossible to implement, as it means that if [i, j) = [x], insert in an associative 805container is O(1)!</p> 806<p><b>Proposed resolution:</b></p> 807<p>N+log (size()) if [i,j) is sorted according to value_comp()</p> 808<p><b>Rationale:</b></p> 809<p>Subsumed by issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#264">264</a>.</p> 810<hr> 811<a name="104"><h3>104. Description of basic_string::operator[] is unclear</h3></a><p><b>Section:</b> 21.3.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string.access"> [lib.string.access]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 812<p>It is not clear that undefined behavior applies when pos == size () 813for the non const version.</p> 814<p><b>Proposed resolution:</b></p> 815<p>Rewrite as: Otherwise, if pos > size () or pos == size () and 816the non-const version is used, then the behavior is undefined.</p> 817<p><b>Rationale:</b></p> 818<p>The Standard is correct. The proposed resolution already appears in 819the Standard.</p> 820<hr> 821<a name="105"><h3>105. fstream ctors argument types desired</h3></a><p><b>Section:</b> 27.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.file.streams"> [lib.file.streams]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 822<p>fstream ctors take a const char* instead of string.<br> 823fstream ctors can't take wchar_t</p> 824 825<p>An extension to add a const wchar_t* to fstream would make the 826implementation non conforming.</p> 827<p><b>Proposed resolution:</b></p> 828<p><b>Rationale:</b></p> 829<p>This is not a defect in the Standard. It might be an 830interesting extension for the next Standard. </p> 831<hr> 832<a name="107"><h3>107. Valarray constructor is strange</h3></a><p><b>Section:</b> 26.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex"> [lib.complex]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> AFNOR <b>Date:</b> 7 Oct 1998</p> 833<p>The order of the arguments is (elem, size) instead of the normal 834(size, elem) in the rest of the library. Since elem often has an 835integral or floating point type, both types are convertible to each 836other and reversing them leads to a well formed program.</p> 837<p><b>Proposed resolution:</b></p> 838<p>Inverting the arguments could silently break programs. Introduce 839the two signatures (const T&, size_t) and (size_t, const T&), 840but make the one we do not want private so errors result in a 841diagnosed access violation. This technique can also be applied to STL 842containers.</p> 843<p><b>Rationale:</b></p> 844<p>The LWG believes that while the order of arguments is unfortunate, 845it does not constitute a defect in the standard. The LWG believes that 846the proposed solution will not work for valarray<size_t> and 847perhaps other cases.</p> 848<hr> 849<a name="111"><h3>111. istreambuf_iterator::equal overspecified, inefficient</h3></a><p><b>Section:</b> 24.5.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.istreambuf.iterator::equal"> [lib.istreambuf.iterator::equal]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Nathan Myers <b>Date:</b> 15 Oct 1998</p> 850<p>The member istreambuf_iterator<>::equal is specified to be 851unnecessarily inefficient. While this does not affect the efficiency 852of conforming implementations of iostreams, because they can 853"reach into" the iterators and bypass this function, it does 854affect users who use istreambuf_iterators. </p> 855 856<p>The inefficiency results from a too-scrupulous definition, which 857requires a "true" result if neither iterator is at eof. In 858practice these iterators can only usefully be compared with the 859"eof" value, so the extra test implied provides no benefit, 860but slows down users' code. </p> 861 862<p>The solution is to weaken the requirement on the function to return 863true only if both iterators are at eof. </p> 864<p><b>Proposed resolution:</b></p> 865<p>Replace 24.5.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.istreambuf.iterator::equal"> [lib.istreambuf.iterator::equal]</a>, 866paragraph 1, </p> 867 868<blockquote> 869 <p>-1- Returns: true if and only if both iterators are at end-of-stream, or neither is at 870 end-of-stream, regardless of what streambuf object they use. </p> 871</blockquote> 872 873<p>with</p> 874 875<blockquote> 876 <p>-1- Returns: true if and only if both iterators are at 877 end-of-stream, regardless of what streambuf object they use. </p> 878</blockquote> 879 880<p><b>Rationale:</b></p> 881<p>It is not clear that this is a genuine defect. Additionally, the 882LWG was reluctant to make a change that would result in 883operator== not being a equivalence relation. One consequence of 884this change is that an algorithm that's passed the range [i, i) 885would no longer treat it as an empty range.</p> 886<hr> 887<a name="113"><h3>113. Missing/extra iostream sync semantics</h3></a><p><b>Section:</b> 27.6.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream"> [lib.istream]</a>, 27.6.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream.unformatted"> [lib.istream.unformatted]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Steve Clamage <b>Date:</b> 13 Oct 1998</p> 888<p>In 27.6.1.1, class basic_istream has a member function sync, described in 27.6.1.3, 889paragraph 36. </p> 890 891<p>Following the chain of definitions, I find that the various sync functions have defined 892semantics for output streams, but no semantics for input streams. On the other hand, 893basic_ostream has no sync function. </p> 894 895<p>The sync function should at minimum be added to basic_ostream, for internal 896consistency. </p> 897 898<p>A larger question is whether sync should have assigned semantics for input streams. </p> 899 900<p>Classic iostreams said streambuf::sync flushes pending output and attempts to return 901unread input characters to the source. It is a protected member function. The filebuf 902version (which is public) has that behavior (it backs up the read pointer). Class 903strstreambuf does not override streambuf::sync, and so sync can't be called on a 904strstream. </p> 905 906<p>If we can add corresponding semantics to the various sync functions, we should. If not, 907we should remove sync from basic_istream.</p> 908<p><b>Proposed resolution:</b></p> 909<p><b>Rationale:</b></p> 910<p>A sync function is not needed in basic_ostream because the flush function provides the 911desired functionality.</p> 912 913<p>As for the other points, the LWG finds the standard correct as written.</p> 914<hr> 915<a name="116"><h3>116. bitset cannot be constructed with a const char*</h3></a><p><b>Section:</b> 23.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.template.bitset"> [lib.template.bitset]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 6 Nov 1998</p> 916<p>The following code does not compile with the EDG compiler:</p> 917 918<blockquote> 919 <pre>#include <bitset> 920using namespace std; 921bitset<32> b("111111111");</pre> 922</blockquote> 923 924<p>If you cast the ctor argument to a string, i.e.:</p> 925 926<blockquote> 927 <pre>bitset<32> b(string("111111111"));</pre> 928</blockquote> 929 930<p>then it will compile. The reason is that bitset has the following templatized 931constructor:</p> 932 933<blockquote> 934 <pre>template <class charT, class traits, class Allocator> 935explicit bitset (const basic_string<charT, traits, Allocator>& str, ...);</pre> 936</blockquote> 937 938<p>According to the compiler vendor, Steve Adamcyk at EDG, the user 939cannot pass this template constructor a <tt>const char*</tt> and 940expect a conversion to <tt>basic_string</tt>. The reason is 941"When you have a template constructor, it can get used in 942contexts where type deduction can be done. Type deduction basically 943comes up with exact matches, not ones involving conversions." 944</p> 945 946<p>I don't think the intention when this constructor became 947templatized was for construction from a <tt>const char*</tt> to no 948longer work.</p> 949<p><b>Proposed resolution:</b></p> 950<p>Add to 23.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.template.bitset"> [lib.template.bitset]</a> a bitset constructor declaration</p> 951 952<blockquote> 953 <pre>explicit bitset(const char*);</pre> 954</blockquote> 955 956<p>and in Section 23.3.5.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.bitset.cons"> [lib.bitset.cons]</a> add:</p> 957 958<blockquote> 959 <pre>explicit bitset(const char* str);</pre> 960 <p>Effects: <br> 961 Calls <tt>bitset((string) str, 0, string::npos);</tt></p> 962</blockquote> 963<p><b>Rationale:</b></p> 964<p>Although the problem is real, the standard is designed that way so 965it is not a defect. Education is the immediate workaround. A future 966standard may wish to consider the Proposed Resolution as an 967extension.</p> 968<hr> 969<a name="121"><h3>121. Detailed definition for ctype<wchar_t> specialization</h3></a><p><b>Section:</b> 22.1.1.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.category"> [lib.locale.category]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 15 Dec 1998</p> 970<p>Section 22.1.1.1.1 has the following listed in Table 51: ctype<char> , 971ctype<wchar_t>. </p> 972 973<p>Also Section 22.2.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.ctype"> [lib.locale.ctype]</a> says: </p> 974 975<blockquote> 976 <p>The instantiations required in Table 51 (22.1.1.1.1) namely ctype<char> and 977 ctype<wchar_t> , implement character classing appropriate to the implementation's 978 native character set. </p> 979</blockquote> 980 981<p>However, Section 22.2.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.special"> [lib.facet.ctype.special]</a> 982only has a detailed description of the ctype<char> specialization, not the 983ctype<wchar_t> specialization. </p> 984<p><b>Proposed resolution:</b></p> 985<p>Add the ctype<wchar_t> detailed class description to Section 98622.2.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.special"> [lib.facet.ctype.special]</a>. </p> 987<p><b>Rationale:</b></p> 988<p>Specialization for wchar_t is not needed since the default is acceptable.</p> 989<hr> 990<a name="128"><h3>128. Need open_mode() function for file stream, string streams, file buffers, and string buffers</h3></a><p><b>Section:</b> 27.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.string.streams"> [lib.string.streams]</a>, 27.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.file.streams"> [lib.file.streams]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Angelika Langer <b>Date:</b> 22 Feb 1999</p> 991<p>The following question came from Thorsten Herlemann:</p> 992 993<blockquote> 994 <p>You can set a mode when constructing or opening a file-stream or 995 filebuf, e.g. ios::in, ios::out, ios::binary, ... But how can I get 996 that mode later on, e.g. in my own operator << or operator 997 >> or when I want to check whether a file-stream or 998 file-buffer object passed as parameter is opened for input or output 999 or binary? Is there no possibility? Is this a design-error in the 1000 standard C++ library? </p> 1001</blockquote> 1002 1003<p>It is indeed impossible to find out what a stream's or stream 1004buffer's open mode is, and without that knowledge you don't know 1005how certain operations behave. Just think of the append mode. </p> 1006 1007<p>Both streams and stream buffers should have a <tt>mode()</tt> function that returns the 1008current open mode setting. </p> 1009<p><b>Proposed resolution:</b></p> 1010<p>For stream buffers, add a function to the base class as a non-virtual function 1011qualified as const to 27.5.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.streambuf"> [lib.streambuf]</a>:</p> 1012 1013<p> <tt>openmode mode() const</tt>;</p> 1014 1015<p><b> Returns</b> the current open mode.</p> 1016 1017<p>With streams, I'm not sure what to suggest. In principle, the mode 1018could already be returned by <tt>ios_base</tt>, but the mode is only 1019initialized for file and string stream objects, unless I'm overlooking 1020anything. For this reason it should be added to the most derived 1021stream classes. Alternatively, it could be added to <tt>basic_ios</tt> 1022and would be default initialized in <tt>basic_ios<>::init()</tt>.</p> 1023<p><b>Rationale:</b></p> 1024<p>This might be an interesting extension for some future, but it is 1025not a defect in the current standard. The Proposed Resolution is 1026retained for future reference.</p> 1027<hr> 1028<a name="131"><h3>131. list::splice throws nothing</h3></a><p><b>Section:</b> 23.2.2.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.deque.special"> [lib.deque.special]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Howard Hinnant <b>Date:</b> 6 Mar 1999</p> 1029<p>What happens if a splice operation causes the size() of a list to grow 1030beyond max_size()?</p> 1031<p><b>Proposed resolution:</b></p> 1032<p><b>Rationale:</b></p> 1033<p>Size() cannot grow beyond max_size(). </p> 1034<hr> 1035<a name="135"><h3>135. basic_iostream doubly initialized</h3></a><p><b>Section:</b> 27.6.1.5.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.iostream.cons"> [lib.iostream.cons]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Howard Hinnant <b>Date:</b> 6 Mar 1999</p> 1036<p>-1- Effects Constructs an object of class basic_iostream, assigning 1037initial values to the base classes by calling 1038basic_istream<charT,traits>(sb) (lib.istream) and 1039basic_ostream<charT,traits>(sb) (lib.ostream)</p> 1040 1041<p>The called for basic_istream and basic_ostream constructors call 1042init(sb). This means that the basic_iostream's virtual base class is 1043initialized twice.</p> 1044<p><b>Proposed resolution:</b></p> 1045<p>Change 27.6.1.5.1, paragraph 1 to:</p> 1046 1047<p>-1- Effects Constructs an object of class basic_iostream, assigning 1048initial values to the base classes by calling 1049basic_istream<charT,traits>(sb) (lib.istream).</p> 1050<p><b>Rationale:</b></p> 1051<p>The LWG agreed that the <tt> init()</tt> function is called 1052twice, but said that this is harmless and so not a defect in the 1053standard.</p> 1054<hr> 1055<a name="138"><h3>138. Class ctype_byname<char> redundant and misleading</h3></a><p><b>Section:</b> 22.2.1.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt"> [lib.locale.codecvt]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Angelika Langer <b>Date:</b> March 18, 1999</p> 1056<p>Section 22.2.1.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt"> [lib.locale.codecvt]</a> specifies that 1057ctype_byname<char> must be a specialization of the ctype_byname 1058template.</p> 1059 1060<p>It is common practice in the standard that specializations of class templates are only 1061mentioned where the interface of the specialization deviates from the interface of the 1062template that it is a specialization of. Otherwise, the fact whether or not a required 1063instantiation is an actual instantiation or a specialization is left open as an 1064implementation detail. </p> 1065 1066<p>Clause 22.2.1.4 deviates from that practice and for that reason is misleading. The 1067fact, that ctype_byname<char> is specified as a specialization suggests that there 1068must be something "special" about it, but it has the exact same interface as the 1069ctype_byname template. Clause 22.2.1.4 does not have any explanatory value, is at best 1070redundant, at worst misleading - unless I am missing anything. </p> 1071 1072<p>Naturally, an implementation will most likely implement ctype_byname<char> as a 1073specialization, because the base class ctype<char> is a specialization with an 1074interface different from the ctype template, but that's an implementation detail and need 1075not be mentioned in the standard. </p> 1076<p><b>Proposed resolution:</b></p> 1077<p><b>Rationale:</b></p> 1078<p> The standard as written is mildly misleading, but the correct fix 1079is to deal with the underlying problem in the ctype_byname base class, 1080not in the specialization. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#228">228</a>.</p> 1081<hr> 1082<a name="140"><h3>140. map<Key, T>::value_type does not satisfy the assignable requirement</h3></a><p><b>Section:</b> 23.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.map"> [lib.map]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Mark Mitchell <b>Date:</b> 14 Apr 1999</p> 1083<blockquote> 1084 <p>23.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.requirements"> [lib.container.requirements]</a><br> 1085 <br> 1086 expression return type 1087 pre/post-condition<br> 1088 ------------- ----------- 1089 -------------------<br> 1090 X::value_type T 1091 1092 T is assignable<br> 1093 <br> 1094 23.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.map"> [lib.map]</a><br> 1095 <br> 1096 A map satisfies all the requirements of a container.<br> 1097 <br> 1098 For a map<Key, T> ... the value_type is pair<const Key, T>.</p> 1099</blockquote> 1100 1101<p>There's a contradiction here. In particular, `pair<const Key, 1102T>' is not assignable; the `const Key' cannot be assigned 1103to. So, map<Key, T>::value_type does not satisfy the 1104assignable requirement imposed by a container.</p> 1105 1106<p><i>[See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#103">103</a> for the slightly related issue of 1107modification of set keys.]</i></p> 1108<p><b>Proposed resolution:</b></p> 1109<p><b>Rationale:</b></p> 1110<p>The LWG believes that the standard is inconsistent, but that this 1111is a design problem rather than a strict defect. May wish to 1112reconsider for the next standard.</p> 1113<hr> 1114<a name="143"><h3>143. C .h header wording unclear</h3></a><p><b>Section:</b> D.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/future.html#depr.c.headers"> [depr.c.headers]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Christophe de Dinechin <b>Date:</b> 4 May 1999</p> 1115<p>[depr.c.headers] paragraph 2 reads:</p> 1116 1117<blockquote> 1118 1119<p>Each C header, whose name has the form name.h, behaves as if each 1120name placed in the Standard library namespace by the corresponding 1121cname header is also placed within the namespace scope of the 1122namespace std and is followed by an explicit using-declaration 1123(_namespace.udecl_)</p> 1124 1125</blockquote> 1126 1127<p>I think it should mention the global name space somewhere... 1128Currently, it indicates that name placed in std is also placed in 1129std...</p> 1130 1131<p>I don't know what is the correct wording. For instance, if struct 1132tm is defined in time.h, ctime declares std::tm. However, the current 1133wording seems ambiguous regarding which of the following would occur 1134for use of both ctime and time.h:</p> 1135 1136<blockquote> 1137 <pre>// version 1: 1138namespace std { 1139 struct tm { ... }; 1140} 1141using std::tm; 1142 1143// version 2: 1144struct tm { ... }; 1145namespace std { 1146 using ::tm; 1147} 1148 1149// version 3: 1150struct tm { ... }; 1151namespace std { 1152 struct tm { ... }; 1153}</pre> 1154</blockquote> 1155 1156<p>I think version 1 is intended.</p> 1157 1158<p><i>[Kona: The LWG agreed that the wording is not clear. It also 1159agreed that version 1 is intended, version 2 is not equivalent to 1160version 1, and version 3 is clearly not intended. The example below 1161was constructed by Nathan Myers to illustrate why version 2 is not 1162equivalent to version 1.</i></p> 1163 1164<p><i>Although not equivalent, the LWG is unsure if (2) is enough of 1165a problem to be prohibited. Points discussed in favor of allowing 1166(2):</i></p> 1167 1168<blockquote> 1169 <ul> 1170 <li><i>It may be a convenience to implementors.</i></li> 1171 <li><i>The only cases that fail are structs, of which the C library 1172 contains only a few.</i></li> 1173 </ul> 1174</blockquote> 1175 1176<p><i>]</i></p> 1177 1178<p><b>Example:</b></p> 1179 1180<blockquote> 1181 1182<pre>#include <time.h> 1183#include <utility> 1184 1185int main() { 1186 std::tm * t; 1187 make_pair( t, t ); // okay with version 1 due to Koenig lookup 1188 // fails with version 2; make_pair not found 1189 return 0; 1190}</pre> 1191 1192</blockquote> 1193<p><b>Proposed resolution:</b></p> 1194 1195<p>Replace D.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/future.html#depr.c.headers"> [depr.c.headers]</a> paragraph 2 with:</p> 1196 1197<blockquote> 1198 1199<p> Each C header, whose name has the form name.h, behaves as if each 1200name placed in the Standard library namespace by the corresponding 1201cname header is also placed within the namespace scope of the 1202namespace std by name.h and is followed by an explicit 1203using-declaration (_namespace.udecl_) in global scope.</p> 1204 1205</blockquote> 1206 1207<p><b>Rationale:</b></p> 1208<p> The current wording in the standard is the result of a difficult 1209compromise that averted delay of the standard. Based on discussions 1210in Tokyo it is clear that there is no still no consensus on stricter 1211wording, so the issue has been closed. It is suggested that users not 1212write code that depends on Koenig lookup of C library functions.</p> 1213<hr> 1214<a name="145"><h3>145. adjustfield lacks default value</h3></a><p><b>Section:</b> 27.4.4.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.basic.ios.cons"> [lib.basic.ios.cons]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Angelika Langer <b>Date:</b> 12 May 1999</p> 1215<p>There is no initial value for the adjustfield defined, although 1216many people believe that the default adjustment were right. This is a 1217common misunderstanding. The standard only defines that, if no 1218adjustment is specified, all the predefined inserters must add fill 1219characters before the actual value, which is "as if" the 1220right flag were set. The flag itself need not be set.</p> 1221 1222<p>When you implement a user-defined inserter you cannot rely on right 1223being the default setting for the adjustfield. Instead, you must be 1224prepared to find none of the flags set and must keep in mind that in 1225this case you should make your inserter behave "as if" the 1226right flag were set. This is surprising to many people and complicates 1227matters more than necessary.</p> 1228 1229<p>Unless there is a good reason why the adjustfield should not be 1230initialized I would suggest to give it the default value that 1231everybody expects anyway.</p> 1232 1233<p><b>Proposed resolution:</b></p> 1234<p><b>Rationale:</b></p> 1235<p>This is not a defect. It is deliberate that the default is no bits 1236set. Consider Arabic or Hebrew, for example. See 22.2.2.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.num.put.virtuals"> [lib.facet.num.put.virtuals]</a> paragraph 19, Table 61 - Fill padding.</p> 1237<hr> 1238<a name="149"><h3>149. Insert should return iterator to first element inserted</h3></a><p><b>Section:</b> 23.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.sequence.reqmts"> [lib.sequence.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Andrew Koenig <b>Date:</b> 28 Jun 1999</p> 1239<p>Suppose that c and c1 are sequential containers and i is an 1240iterator that refers to an element of c. Then I can insert a copy of 1241c1's elements into c ahead of element i by executing </p> 1242 1243<blockquote> 1244 1245<pre>c.insert(i, c1.begin(), c1.end());</pre> 1246 1247</blockquote> 1248 1249<p>If c is a vector, it is fairly easy for me to find out where the 1250newly inserted elements are, even though i is now invalid: </p> 1251 1252<blockquote> 1253 1254<pre>size_t i_loc = i - c.begin(); 1255c.insert(i, c1.begin(), c1.end());</pre> 1256 1257</blockquote> 1258 1259<p>and now the first inserted element is at c.begin()+i_loc and one 1260past the last is at c.begin()+i_loc+c1.size().<br> 1261<br> 1262But what if c is a list? I can still find the location of one past the 1263last inserted element, because i is still valid. To find the location 1264of the first inserted element, though, I must execute something like </p> 1265 1266<blockquote> 1267 1268<pre>for (size_t n = c1.size(); n; --n) 1269 --i;</pre> 1270 1271</blockquote> 1272 1273<p>because i is now no longer a random-access iterator.<br> 1274<br> 1275Alternatively, I might write something like </p> 1276 1277<blockquote> 1278 1279<pre>bool first = i == c.begin(); 1280list<T>::iterator j = i; 1281if (!first) --j; 1282c.insert(i, c1.begin(), c1.end()); 1283if (first) 1284 j = c.begin(); 1285else 1286 ++j;</pre> 1287 1288</blockquote> 1289 1290<p>which, although wretched, requires less overhead.<br> 1291<br> 1292But I think the right solution is to change the definition of insert 1293so that instead of returning void, it returns an iterator that refers 1294to the first element inserted, if any, and otherwise is a copy of its 1295first argument. </p> 1296<p><b>Proposed resolution:</b></p> 1297<p><b>Rationale:</b></p> 1298<p>The LWG believes this was an intentional design decision and so is 1299not a defect. It may be worth revisiting for the next standard.</p> 1300<hr> 1301<a name="157"><h3>157. Meaningless error handling for <tt>pword()</tt> and <tt>iword()</tt> 1302</h3></a><p><b>Section:</b> 27.4.2.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ios.base.storage"> [lib.ios.base.storage]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dietmar K�hl <b>Date:</b> 20 Jul 1999</p> 1303<p>According to paragraphs 2 and 4 of 27.4.2.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ios.base.storage"> [lib.ios.base.storage]</a>, the 1304functions <tt>iword()</tt> and <tt>pword()</tt> "set the 1305<tt>badbit</tt> (which might throw an exception)" on 1306failure. ... but what does it mean for <tt>ios_base</tt> to set the 1307<tt>badbit</tt>? The state facilities of the IOStream library are 1308defined in <tt>basic_ios</tt>, a derived class! It would be possible 1309to attempt a down cast but then it would be necessary to know the 1310character type used...</p> 1311<p><b>Proposed resolution:</b></p> 1312<p><b>Rationale:</b></p> 1313<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#41">41</a>.</p> 1314<hr> 1315<a name="162"><h3>162. Really "formatted input functions"?</h3></a><p><b>Section:</b> 27.6.1.2.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream::extractors"> [lib.istream::extractors]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dietmar K�hl <b>Date:</b> 20 Jul 1999</p> 1316<p>It appears to be somewhat nonsensical to consider the functions 1317defined in the paragraphs 1 to 5 to be "Formatted input 1318function" but since these functions are defined in a section 1319labeled "Formatted input functions" it is unclear to me 1320whether these operators are considered formatted input functions which 1321have to conform to the "common requirements" from 27.6.1.2.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream.formatted.reqmts"> [lib.istream.formatted.reqmts]</a>: If this is the case, all manipulators, not just 1322<tt>ws</tt>, would skip whitespace unless <tt>noskipws</tt> is set 1323(... but setting <tt>noskipws</tt> using the manipulator syntax would 1324also skip whitespace :-)</p> 1325 1326<p>See also issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#166">166</a> for the same problem in formatted 1327output</p> 1328<p><b>Proposed resolution:</b></p> 1329<p><b>Rationale:</b></p> 1330<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#60">60</a>.</p> 1331<hr> 1332<a name="163"><h3>163. Return of <tt>gcount()</tt> after a call to <tt>gcount</tt> 1333</h3></a><p><b>Section:</b> 27.6.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream.unformatted"> [lib.istream.unformatted]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dietmar K�hl <b>Date:</b> 20 Jul 1999</p> 1334<p>It is not clear which functions are to be considered unformatted 1335input functions. As written, it seems that all functions in 27.6.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream.unformatted"> [lib.istream.unformatted]</a> are unformatted input functions. However, it does not 1336really make much sense to construct a sentry object for 1337<tt>gcount()</tt>, <tt>sync()</tt>, ... Also it is unclear what 1338happens to the <tt>gcount()</tt> if eg. <tt>gcount()</tt>, 1339<tt>putback()</tt>, <tt>unget()</tt>, or <tt>sync()</tt> is called: 1340These functions don't extract characters, some of them even 1341"unextract" a character. Should this still be reflected in 1342<tt>gcount()</tt>? Of course, it could be read as if after a call to 1343<tt>gcount()</tt> <tt>gcount()</tt> return <tt>0</tt> (the last 1344unformatted input function, <tt>gcount()</tt>, didn't extract any 1345character) and after a call to <tt>putback()</tt> <tt>gcount()</tt> 1346returns <tt>-1</tt> (the last unformatted input function 1347<tt>putback()</tt> did "extract" back into the 1348stream). Correspondingly for <tt>unget()</tt>. Is this what is 1349intended? If so, this should be clarified. Otherwise, a corresponding 1350clarification should be used.</p> 1351<p><b>Proposed resolution:</b></p> 1352<p><b>Rationale:</b></p> 1353<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#60">60</a>.</p> 1354<hr> 1355<a name="166"><h3>166. Really "formatted output functions"?</h3></a><p><b>Section:</b> 27.6.2.5.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ostream.inserters"> [lib.ostream.inserters]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dietmar K�hl <b>Date:</b> 20 Jul 1999</p> 1356<p>From 27.6.2.5.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ostream.formatted.reqmts"> [lib.ostream.formatted.reqmts]</a> it appears that all the functions 1357defined in 27.6.2.5.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ostream.inserters"> [lib.ostream.inserters]</a> have to construct a 1358<tt>sentry</tt> object. Is this really intended?</p> 1359 1360<p>This is basically the same problem as issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#162">162</a> but 1361for output instead of input.</p> 1362<p><b>Proposed resolution:</b></p> 1363<p><b>Rationale:</b></p> 1364<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#60">60</a>.</p> 1365<hr> 1366<a name="177"><h3>177. Complex operators cannot be explicitly instantiated</h3></a><p><b>Section:</b> 26.3.6 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.ops"> [lib.complex.ops]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 2 Jul 1999</p> 1367<p>A user who tries to explicitly instantiate a complex non-member operator will 1368get compilation errors. Below is a simplified example of the reason why. The 1369problem is that iterator_traits cannot be instantiated on a non-pointer type 1370like float, yet when the compiler is trying to decide which operator+ needs to 1371be instantiated it must instantiate the declaration to figure out the first 1372argument type of a reverse_iterator operator.</p> 1373<pre>namespace std { 1374template <class Iterator> 1375struct iterator_traits 1376{ 1377 typedef typename Iterator::value_type value_type; 1378}; 1379 1380template <class T> class reverse_iterator; 1381 1382// reverse_iterator operator+ 1383template <class T> 1384reverse_iterator<T> operator+ 1385(typename iterator_traits<T>::difference_type, const reverse_iterator<T>&); 1386 1387template <class T> struct complex {}; 1388 1389// complex operator + 1390template <class T> 1391complex<T> operator+ (const T& lhs, const complex<T>& rhs) 1392{ return complex<T>();} 1393} 1394 1395// request for explicit instantiation 1396template std::complex<float> std::operator+<float>(const float&, 1397 const std::complex<float>&);</pre> 1398<p>See also c++-stdlib reflector messages: lib-6814, 6815, 6816.</p> 1399<p><b>Proposed resolution:</b></p> 1400<p><b>Rationale:</b></p> 1401<p>Implementors can make minor changes and the example will 1402work. Users are not affected in any case.</p> <p>According to John 1403Spicer, It is possible to explicitly instantiate these operators using 1404different syntax: change "std::operator+<float>" to 1405"std::operator+".</p> 1406 1407<p>The proposed resolution of issue 120 is that users will not be able 1408to explicitly instantiate standard library templates. If that 1409resolution is accepted then library implementors will be the only ones 1410that will be affected by this problem, and they must use the indicated 1411syntax.</p> 1412<hr> 1413<a name="178"><h3>178. Should clog and cerr initially be tied to cout?</h3></a><p><b>Section:</b> 27.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.narrow.stream.objects"> [lib.narrow.stream.objects]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 2 Jul 1999</p> 1414<p> 1415Section 27.3.1 says "After the object cerr is initialized, 1416cerr.flags() & unitbuf is nonzero. Its state is otherwise the same as 1417required for ios_base::init (lib.basic.ios.cons). It doesn't say 1418anything about the the state of clog. So this means that calling 1419cerr.tie() and clog.tie() should return 0 (see Table 89 for 1420ios_base::init effects). 1421</p> 1422<p> 1423Neither of the popular standard library implementations 1424that I tried does this, they both tie cerr and clog 1425to &cout. I would think that would be what users expect. 1426</p> 1427<p><b>Proposed resolution:</b></p> 1428<p><b>Rationale:</b></p> 1429<p>The standard is clear as written.</p> 1430<p>27.3.1/5 says that "After the object cerr is initialized, cerr.flags() 1431& unitbuf is nonzero. Its state is otherwise the same as required for 1432ios_base::init (27.4.4.1)." Table 89 in 27.4.4.1, which gives the 1433postconditions of basic_ios::init(), says that tie() is 0. (Other issues correct 1434ios_base::init to basic_ios::init().)</p> 1435<hr> 1436<a name="180"><h3>180. Container member iterator arguments constness has unintended consequences</h3></a><p><b>Section:</b> 23 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.containers"> [lib.containers]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Dave Abrahams <b>Date:</b> 1 Jul 1999</p> 1437<p>It is the constness of the container which should control whether 1438it can be modified through a member function such as erase(), not the 1439constness of the iterators. The iterators only serve to give 1440positioning information.</p> 1441 1442<p>Here's a simple and typical example problem which is currently very 1443difficult or impossible to solve without the change proposed 1444below.</p> 1445 1446<p>Wrap a standard container C in a class W which allows clients to 1447find and read (but not modify) a subrange of (C.begin(), C.end()]. The 1448only modification clients are allowed to make to elements in this 1449subrange is to erase them from C through the use of a member function 1450of W.</p> 1451<p><b>Proposed resolution:</b></p> 1452<p>Change all non-const iterator parameters of standard library 1453container member functions to accept const_iterator parameters. 1454Note that this change applies to all library clauses, including 1455strings.</p> 1456 1457<p>For example, in 21.3.5.5 change:<br> 1458<br> 1459 <tt>iterator erase(iterator p);</tt><br> 1460<br> 1461to:<br> 1462 <tt>iterator erase(const_iterator p);</tt> 1463</p> 1464<p><b>Rationale:</b></p> 1465<p>The issue was discussed at length. It was generally agreed that 1) 1466There is no major technical argument against the change (although 1467there is a minor argument that some obscure programs may break), and 14682) Such a change would not break const correctness. The concerns about 1469making the change were 1) it is user detectable (although only in 1470boundary cases), 2) it changes a large number of signatures, and 3) it 1471seems more of a design issue that an out-and-out defect.</p> 1472 1473<p>The LWG believes that this issue should be considered as part of a 1474general review of const issues for the next revision of the 1475standard. Also see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#200">200</a>.</p> 1476<hr> 1477<a name="188"><h3>188. valarray helpers missing augmented assignment operators</h3></a><p><b>Section:</b> 26.5.2.6 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.valarray.cassign"> [lib.valarray.cassign]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Gabriel Dos Reis <b>Date:</b> 15 Aug 1999</p> 1478<p>26.5.2.6 defines augmented assignment operators 1479valarray<T>::op=(const T&), but fails to provide 1480corresponding versions for the helper classes. Thus making the 1481following illegal:</p> 1482<blockquote> 1483<pre>#include <valarray> 1484 1485int main() 1486{ 1487std::valarray<double> v(3.14, 1999); 1488 1489v[99] *= 2.0; // Ok 1490 1491std::slice s(0, 50, 2); 1492 1493v[s] *= 2.0; // ERROR 1494}</pre> 1495</blockquote> 1496<p>I can't understand the intent of that omission. It makes the 1497valarray library less intuitive and less useful.</p> 1498<p><b>Proposed resolution:</b></p> 1499<p><b>Rationale:</b></p> 1500<p>Although perhaps an unfortunate 1501design decision, the omission is not a defect in the current 1502standard. A future standard may wish to add the missing 1503operators.</p> 1504<hr> 1505<a name="190"><h3>190. min() and max() functions should be std::binary_functions</h3></a><p><b>Section:</b> 25.3.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.min.max"> [lib.alg.min.max]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Mark Rintoul <b>Date:</b> 26 Aug 1999</p> 1506<p>Both std::min and std::max are defined as template functions. This 1507is very different than the definition of std::plus (and similar 1508structs) which are defined as function objects which inherit 1509std::binary_function.<br> 1510<br> 1511 This lack of inheritance leaves std::min and std::max somewhat useless in standard library algorithms which require 1512a function object that inherits std::binary_function.</p> 1513<p><b>Proposed resolution:</b></p> 1514<p><b>Rationale:</b></p> 1515<p>Although perhaps an unfortunate design decision, the omission is not a defect 1516in the current standard. A future standard may wish to consider additional 1517function objects.</p> 1518<hr> 1519<a name="191"><h3>191. Unclear complexity for algorithms such as binary search</h3></a><p><b>Section:</b> 25.3.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.binary.search"> [lib.alg.binary.search]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 10 Oct 1999</p> 1520<p>The complexity of binary_search() is stated as "At most 1521log(last-first) + 2 comparisons", which seems to say that the 1522algorithm has logarithmic complexity. However, this algorithms is 1523defined for forward iterators. And for forward iterators, the need to 1524step element-by-element results into linear complexity. But such a 1525statement is missing in the standard. The same applies to 1526lower_bound(), upper_bound(), and equal_range(). <br> 1527<br> 1528However, strictly speaking the standard contains no bug here. So this 1529might considered to be a clarification or improvement. 1530</p> 1531<p><b>Proposed resolution:</b></p> 1532<p><b>Rationale:</b></p> 1533<p>The complexity is expressed in terms of comparisons, and that 1534complexity can be met even if the number of iterators accessed is 1535linear. Paragraph 1 already says exactly what happens to 1536iterators.</p> 1537<hr> 1538<a name="192"><h3>192. a.insert(p,t) is inefficient and overconstrained</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Ed Brey <b>Date:</b> 6 Jun 1999</p> 1539<p>As defined in 23.1.2, paragraph 7 (table 69), a.insert(p,t) suffers from 1540several problems:</p> 1541<table border="1" cellpadding="5"> 1542 <tbody><tr> 1543 <td><b>expression</b></td> 1544 <td><b>return type</b></td> 1545 <td><b>pre/post-condition</b></td> 1546 <td><b>complexity</b></td> 1547 </tr> 1548 <tr> 1549 <td><tt>a.insert(p,t)</tt></td> 1550 <td><tt>iterator</tt></td> 1551 <td>inserts t if and only if there is no element with key equivalent to the key of 1552 t in containers with unique keys; always inserts t in containers with equivalent 1553 keys. always returns the iterator pointing to the element with key equivalent to 1554 the key of t . iterator p is a hint pointing to where the insert should start to search.</td> 1555 <td>logarithmic in general, but amortized constant if t is inserted right after p .</td> 1556 </tr> 1557</tbody></table> 1558<p>1. For a container with unique keys, only logarithmic complexity is 1559guaranteed if no element is inserted, even though constant complexity is always 1560possible if p points to an element equivalent to t.</p> 1561<p>2. For a container with equivalent keys, the amortized constant complexity 1562guarantee is only useful if no key equivalent to t exists in the container. 1563Otherwise, the insertion could occur in one of multiple locations, at least one 1564of which would not be right after p.</p> 1565<p>3. By guaranteeing amortized constant complexity only when t is inserted 1566after p, it is impossible to guarantee constant complexity if t is inserted at 1567the beginning of the container. Such a problem would not exist if amortized 1568constant complexity was guaranteed if t is inserted before p, since there is 1569always some p immediately before which an insert can take place.</p> 1570<p>4. For a container with equivalent keys, p does not allow specification of 1571where to insert the element, but rather only acts as a hint for improving 1572performance. This negates the added functionality that p would provide if it 1573specified where within a sequence of equivalent keys the insertion should occur. 1574Specifying the insert location provides more control to the user, while 1575providing no disadvantage to the container implementation.</p> 1576<p><b>Proposed resolution:</b></p> 1577<p>In 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> paragraph 7, replace the row in table 69 1578for a.insert(p,t) with the following two rows:</p> 1579<table border="1" cellpadding="5"> 1580 <tbody><tr> 1581 <td><b>expression</b></td> 1582 <td><b>return type</b></td> 1583 <td><b>pre/post-condition</b></td> 1584 <td><b>complexity</b></td> 1585 </tr> 1586 <tr> 1587 <td><tt>a_uniq.insert(p,t)</tt></td> 1588 <td><tt>iterator</tt></td> 1589 <td>inserts t if and only if there is no element with key equivalent to the 1590 key of t. returns the iterator pointing to the element with key equivalent 1591 to the key of t.</td> 1592 <td>logarithmic in general, but amortized constant if t is inserted right 1593 before p or p points to an element with key equivalent to t.</td> 1594 </tr> 1595 <tr> 1596 <td><tt>a_eq.insert(p,t)</tt></td> 1597 <td><tt>iterator</tt></td> 1598 <td>inserts t and returns the iterator pointing to the newly inserted 1599 element. t is inserted right before p if doing so preserves the container 1600 ordering.</td> 1601 <td>logarithmic in general, but amortized constant if t is inserted right 1602 before p.</td> 1603 </tr> 1604</tbody></table> 1605 1606<p><b>Rationale:</b></p> 1607<p>Too big a change. Furthermore, implementors report checking 1608both before p and after p, and don't want to change this behavior.</p> 1609<hr> 1610<a name="194"><h3>194. rdbuf() functions poorly specified</h3></a><p><b>Section:</b> 27.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ios"> [lib.ios]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Steve Clamage <b>Date:</b> 7 Sep 1999</p> 1611<p>In classic iostreams, base class ios had an rdbuf function that returned a 1612pointer to the associated streambuf. Each derived class had its own rdbuf 1613function that returned a pointer of a type reflecting the actual type derived 1614from streambuf. Because in ARM C++, virtual function overrides had to have the 1615same return type, rdbuf could not be virtual.</p> 1616<p>In standard iostreams, we retain the non-virtual rdbuf function design, and 1617in addition have an overloaded rdbuf function that sets the buffer pointer. 1618There is no need for the second function to be virtual nor to be implemented in 1619derived classes.</p> 1620<p>Minor question: Was there a specific reason not to make the original rdbuf 1621function virtual?</p> 1622<p>Major problem: Friendly compilers warn about functions in derived classes 1623that hide base-class overloads. Any standard implementation of iostreams will 1624result in such a warning on each of the iostream classes, because of the 1625ill-considered decision to overload rdbuf only in a base class.</p> 1626<p>In addition, users of the second rdbuf function must use explicit 1627qualification or a cast to call it from derived classes. An explicit 1628qualification or cast to basic_ios would prevent access to any later overriding 1629version if there was one.</p> 1630<p>What I'd like to do in an implementation is add a using- declaration for the 1631second rdbuf function in each derived class. It would eliminate warnings about 1632hiding functions, and would enable access without using explicit qualification. 1633Such a change I don't think would change the behavior of any valid program, but 1634would allow invalid programs to compile:</p> 1635<blockquote> 1636 <pre> filebuf mybuf; 1637 fstream f; 1638 f.rdbuf(mybuf); // should be an error, no visible rdbuf</pre> 1639</blockquote> 1640<p>I'd like to suggest this problem as a defect, with the proposed resolution to 1641require the equivalent of a using-declaration for the rdbuf function that is not 1642replaced in a later derived class. We could discuss whether replacing the 1643function should be allowed.</p> 1644<p><b>Proposed resolution:</b></p> 1645<p><b>Rationale:</b></p> 1646<p>For historical reasons, the standard is correct as written. There is a subtle difference between the base 1647class <tt> rdbuf()</tt> and derived class <tt>rdbuf()</tt>. The derived 1648class <tt> rdbuf()</tt> always returns the original streambuf, whereas the base class 1649<tt> rdbuf()</tt> will return the "current streambuf" if that has been changed by the variant you mention.</p> 1650 1651<p>Permission is not required to add such an extension. See 165217.4.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.member.functions"> [lib.member.functions]</a>.</p> 1653<hr> 1654<a name="196"><h3>196. Placement new example has alignment problems</h3></a><p><b>Section:</b> 18.5.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.new.delete.placement"> [lib.new.delete.placement]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Herb Sutter <b>Date:</b> 15 Dec 1998</p> 1655<p>The example in 18.5.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.new.delete.placement"> [lib.new.delete.placement]</a> paragraph 4 reads: </p> 1656 1657<blockquote> 1658 1659<p>[Example: This can be useful for constructing an object at a known address:<br> 1660<br> 1661<tt> char place[sizeof(Something)];<br> 1662 Something* p = new (place) Something();<br> 1663<br> 1664</tt>end example] </p> 1665 1666</blockquote> 1667 1668<p>This example has potential alignment problems. </p> 1669<p><b>Proposed resolution:</b></p> 1670<p><b>Rationale:</b></p> 1671<p>Duplicate: see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#114">114</a>.</p> 1672<hr> 1673<a name="197"><h3>197. max_size() underspecified</h3></a><p><b>Section:</b> 20.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.default.con.req"> [lib.default.con.req]</a>, 23.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.requirements"> [lib.container.requirements]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Andy Sawyer <b>Date:</b> 21 Oct 1999</p> 1674<p>Must the value returned by max_size() be unchanged from call to call? </p> 1675 1676<p>Must the value returned from max_size() be meaningful? </p> 1677 1678<p>Possible meanings identified in lib-6827: </p> 1679 1680<p>1) The largest container the implementation can support given "best 1681case" conditions - i.e. assume the run-time platform is "configured to 1682the max", and no overhead from the program itself. This may possibly 1683be determined at the point the library is written, but certainly no 1684later than compile time.<br> 1685<br> 16862) The largest container the program could create, given "best case" 1687conditions - i.e. same platform assumptions as (1), but take into 1688account any overhead for executing the program itself. (or, roughly 1689"storage=storage-sizeof(program)"). This does NOT include any resource 1690allocated by the program. This may (or may not) be determinable at 1691compile time.<br> 1692<br> 16933) The largest container the current execution of the program could 1694create, given knowledge of the actual run-time platform, but again, 1695not taking into account any currently allocated resource. This is 1696probably best determined at program start-up.<br> 1697<br> 16984) The largest container the current execution program could create at 1699the point max_size() is called (or more correctly at the point 1700max_size() returns :-), given it's current environment (i.e. taking 1701into account the actual currently available resources). This, 1702obviously, has to be determined dynamically each time max_size() is 1703called. </p> 1704<p><b>Proposed resolution:</b></p> 1705<p><b>Rationale:</b></p> 1706<p>max_size() isn't useful for very many things, and the existing 1707 wording is sufficiently clear for the few cases that max_size() can 1708 be used for. None of the attempts to change the existing wording 1709 were an improvement.</p> 1710 1711<p>It is clear to the LWG that the value returned by max_size() can't 1712 change from call to call.</p> 1713 1714<hr> 1715<a name="203"><h3>203. basic_istream::sentry::sentry() is uninstantiable with ctype<user-defined type></h3></a><p><b>Section:</b> 27.6.1.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream::sentry"> [lib.istream::sentry]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt McClure and Dietmar K�hl <b>Date:</b> 1 Jan 2000</p> 1716<p>27.6.1.1.2 Paragraph 4 states:</p> 1717<blockquote> 1718 <p>To decide if the character c is a whitespace character, the constructor 1719 performs ''as if'' it executes the following code fragment: </p> 1720 <pre>const ctype<charT>& ctype = use_facet<ctype<charT> >(is.getloc()); 1721if (ctype.is(ctype.space,c)!=0) 1722// c is a whitespace character.</pre> 1723</blockquote> 1724 1725<p> But Table 51 in 22.1.1.1.1 only requires an implementation to 1726provide specializations for ctype<char> and 1727ctype<wchar_t>. If sentry's constructor is implemented using 1728ctype, it will be uninstantiable for a user-defined character type 1729charT, unless the implementation has provided non-working (since it 1730would be impossible to define a correct ctype<charT> specialization 1731for an arbitrary charT) definitions of ctype's virtual member 1732functions.</p> 1733 1734<p> 1735It seems the intent the standard is that sentry should behave, in 1736every respect, not just during execution, as if it were implemented 1737using ctype, with the burden of providing a ctype specialization 1738falling on the user. But as it is written, nothing requires the 1739translation of sentry's constructor to behave as if it used the above 1740code, and it would seem therefore, that sentry's constructor should be 1741instantiable for all character types. 1742</p> 1743 1744<p> 1745Note: If I have misinterpreted the intent of the standard with 1746respect to sentry's constructor's instantiability, then a note should 1747be added to the following effect: 1748</p> 1749 1750<blockquote> 1751An implementation is forbidden from using the above code if it renders 1752the constructor uninstantiable for an otherwise valid character 1753type. 1754</blockquote> 1755 1756<p>In any event, some clarification is needed.</p> 1757 1758<p><b>Proposed resolution:</b></p> 1759<p><b>Rationale:</b></p> 1760<p>It is possible but not easy to instantiate on types other than char 1761or wchar_t; many things have to be done first. That is by intention 1762and is not a defect.</p> 1763<hr> 1764<a name="204"><h3>204. distance(first, last) when "last" is before "first"</h3></a><p><b>Section:</b> 24.3.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.iterator.operations"> [lib.iterator.operations]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Rintala Matti <b>Date:</b> 28 Jan 2000</p> 1765<p>Section 24.3.4 describes the function distance(first, last) (where first and 1766last are iterators) which calculates "the number of increments or 1767decrements needed to get from 'first' to 'last'".</p> 1768<p>The function should work for forward, bidirectional and random access 1769iterators, and there is a requirement 24.3.4.5 which states that "'last' 1770must be reachable from 'first'".</p> 1771<p>With random access iterators the function is easy to implement as "last 1772- first".</p> 1773<p>With forward iterators it's clear that 'first' must point to a place before 1774'last', because otherwise 'last' would not be reachable from 'first'.</p> 1775<p>But what about bidirectional iterators? There 'last' is reachable from 1776'first' with the -- operator even if 'last' points to an earlier position than 1777'first'. However, I cannot see how the distance() function could be implemented 1778if the implementation does not know which of the iterators points to an earlier 1779position (you cannot use ++ or -- on either iterator if you don't know which 1780direction is the "safe way to travel").</p> 1781<p>The paragraph 24.3.4.1 states that "for ... bidirectional iterators they 1782use ++ to provide linear time implementations". However, the ++ operator is 1783not mentioned in the reachability requirement. Furthermore 24.3.4.4 explicitly 1784mentions that distance() returns the number of increments _or decrements_, 1785suggesting that it could return a negative number also for bidirectional 1786iterators when 'last' points to a position before 'first'.</p> 1787<p>Is a further requirement is needed to state that for forward and 1788bidirectional iterators "'last' must be reachable from 'first' using the ++ 1789operator". Maybe this requirement might also apply to random access 1790iterators so that distance() would work the same way for every iterator 1791category?</p> 1792<p><b>Proposed resolution:</b></p> 1793<p><b>Rationale:</b></p> 1794<p>"Reachable" is defined in the standard in 24.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.iterator.requirements"> [lib.iterator.requirements]</a> paragraph 6. 1795The definition is only in terms of operator++(). The LWG sees no defect in 1796the standard.</p> 1797<hr> 1798<a name="205"><h3>205. numeric_limits unclear on how to determine floating point types</h3></a><p><b>Section:</b> 18.2.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.numeric.limits.members"> [lib.numeric.limits.members]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Steve Cleary <b>Date:</b> 28 Jan 2000</p> 1799<p>In several places in 18.2.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.numeric.limits.members"> [lib.numeric.limits.members]</a>, a member is 1800described as "Meaningful for all floating point types." 1801However, no clear method of determining a floating point type is 1802provided.</p> 1803 1804<p>In 18.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.numeric.special"> [lib.numeric.special]</a>, paragraph 1 states ". . . (for 1805example, epsilon() is only meaningful if is_integer is 1806false). . ." which suggests that a type is a floating point type 1807if is_specialized is true and is_integer is false; however, this is 1808unclear.</p> 1809 1810<p>When clarifying this, please keep in mind this need of users: what 1811exactly is the definition of floating point? Would a fixed point or 1812rational representation be considered one? I guess my statement here 1813is that there could also be types that are neither integer or 1814(strictly) floating point.</p> 1815<p><b>Proposed resolution:</b></p> 1816<p><b>Rationale:</b></p> 1817<p>It is up to the implementor of a user define type to decide if it is a 1818floating point type.</p> 1819<hr> 1820<a name="207"><h3>207. ctype<char> members return clause incomplete</h3></a><p><b>Section:</b> 22.2.1.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.char.members"> [lib.facet.ctype.char.members]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Robert Klarer <b>Date:</b> 2 Nov 1999</p> 1821<p> 1822The <tt>widen</tt> and <tt>narrow</tt> member functions are described 1823in 22.2.1.3.2, paragraphs 9-11. In each case we have two overloaded 1824signatures followed by a <b>Returns</b> clause. The <b>Returns</b> 1825clause only describes one of the overloads. 1826</p> 1827<p><b>Proposed resolution:</b></p> 1828<p>Change the returns clause in 22.2.1.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.char.members"> [lib.facet.ctype.char.members]</a> 1829paragraph 10 from:</p> 1830<p> Returns: do_widen(low, high, to).</p> 1831 1832<p>to:</p> 1833<p> Returns: do_widen(c) or do_widen(low, high, to), 1834respectively.</p> 1835 1836<p>Change the returns clause in 22.2.1.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.char.members"> [lib.facet.ctype.char.members]</a> paragraph 11 1837from:</p> 1838<p> Returns: do_narrow(low, high, to).</p> 1839 1840<p>to:</p> 1841<p> Returns: do_narrow(c) or do_narrow(low, high, to), 1842respectively.</p> 1843<p><b>Rationale:</b></p> 1844<p>Subsumed by issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#153">153</a>, which addresses the same 1845paragraphs.</p> 1846<hr> 1847<a name="213"><h3>213. Math function overloads ambiguous</h3></a><p><b>Section:</b> 26.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.numarray"> [lib.numarray]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Nico Josuttis <b>Date:</b> 26 Feb 2000</p> 1848<p>Due to the additional overloaded versions of numeric functions for 1849float and long double according to Section 26.5, calls such as int x; 1850std::pow (x, 4) are ambiguous now in a standard conforming 1851implementation. Current implementations solve this problem very 1852different (overload for all types, don't overload for float and long 1853double, use preprocessor, follow the standard and get 1854ambiguities).</p> <p>This behavior should be standardized or at least 1855identified as implementation defined.</p> 1856<p><b>Proposed resolution:</b></p> 1857<p><b>Rationale:</b></p> 1858<p>These math issues are an 1859understood and accepted consequence of the design. They have 1860been discussed several times in the past. Users must write casts 1861or write floating point expressions as arguments.</p> 1862<hr> 1863<a name="215"><h3>215. Can a map's key_type be const?</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 29 Feb 2000</p> 1864<p>A user noticed that this doesn't compile with the Rogue Wave library because 1865the rb_tree class declares a key_allocator, and allocator<const int> is 1866not legal, I think:</p> 1867<blockquote> 1868 <pre>map < const int, ... > // legal?</pre> 1869</blockquote> 1870<p>which made me wonder whether it is legal for a map's key_type to be const. In 1871email from Matt Austern he said:</p> 1872<blockquote> 1873<p>I'm not sure whether it's legal to declare a map with a const key type. I 1874hadn't thought about that question until a couple weeks ago. My intuitive 1875feeling is that it ought not to be allowed, and that the standard ought to say 1876so. It does turn out to work in SGI's library, though, and someone in the 1877compiler group even used it. Perhaps this deserves to be written up as an issue 1878too.</p> 1879</blockquote> 1880<p><b>Proposed resolution:</b></p> 1881<p><b>Rationale:</b></p> 1882<p>The "key is assignable" requirement from table 69 in 188323.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> already implies the key cannot be const.</p> 1884<hr> 1885<a name="216"><h3>216. setbase manipulator description flawed</h3></a><p><b>Section:</b> 27.6.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.std.manip"> [lib.std.manip]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Hyman Rosen <b>Date:</b> 29 Feb 2000</p> 1886<p>27.6.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.std.manip"> [lib.std.manip]</a> paragraph 5 says:</p> 1887<blockquote> 1888<pre>smanip setbase(int base);</pre> 1889<p> Returns: An object s of unspecified type such that if out is an 1890(instance of) basic_ostream then the expression out<<s behaves 1891as if f(s) were called, in is an (instance of) basic_istream then the 1892expression in>>s behaves as if f(s) were called. Where f can be 1893defined as:</p> 1894<pre>ios_base& f(ios_base& str, int base) 1895{ 1896 // set basefield 1897 str.setf(n == 8 ? ios_base::oct : 1898 n == 10 ? ios_base::dec : 1899 n == 16 ? ios_base::hex : 1900 ios_base::fmtflags(0), ios_base::basefield); 1901 return str; 1902}</pre> 1903</blockquote> 1904<p>There are two problems here. First, f takes two parameters, so the 1905description needs to say that out<<s and in>>s behave as if f(s,base) 1906had been called. Second, f is has a parameter named base, but is written as if 1907the parameter was named n.</p> 1908<p>Actually, there's a third problem. The paragraph has grammatical errors. 1909There needs to be an "and" after the first comma, and the "Where 1910f" sentence fragment needs to be merged into its preceding sentence. You 1911may also want to format the function a little better. The formatting above is 1912more-or-less what the Standard contains.</p> 1913<p><b>Proposed resolution:</b></p> 1914<p><b>Rationale:</b></p> 1915<p>The resolution of this defect is subsumed by the proposed resolution for 1916issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#193">193</a>.</p> 1917 1918<p><i>[Tokyo: The LWG agrees that this is a defect and notes that it 1919occurs additional places in the section, all requiring fixes.]</i></p> 1920<hr> 1921<a name="218"><h3>218. Algorithms do not use binary predicate objects for default comparisons</h3></a><p><b>Section:</b> 25.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.sorting"> [lib.alg.sorting]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Pablo Halpern <b>Date:</b> 6 Mar 2000</p> 1922<p>Many of the algorithms take an argument, pred, of template parameter type 1923BinaryPredicate or an argument comp of template parameter type Compare. These 1924algorithms usually have an overloaded version that does not take the predicate 1925argument. In these cases pred is usually replaced by the use of operator== and 1926comp is replaced by the use of operator<.</p> 1927<p>This use of hard-coded operators is inconsistent with other parts of the 1928library, particularly the containers library, where equality is established 1929using equal_to<> and ordering is established using less<>. Worse, 1930the use of operator<, would cause the following innocent-looking code to have 1931undefined behavior:</p> 1932<blockquote> 1933 <pre>vector<string*> vec; 1934sort(vec.begin(), vec.end());</pre> 1935</blockquote> 1936<p>The use of operator< is not defined for pointers to unrelated objects. If 1937std::sort used less<> to compare elements, then the above code would be 1938well-defined, since less<> is explicitly specialized to produce a total 1939ordering of pointers.</p> 1940<p><b>Proposed resolution:</b></p> 1941<p><b>Rationale:</b></p> 1942<p>This use of operator== and operator< was a very deliberate, conscious, and 1943explicitly made design decision; these operators are often more efficient. The 1944predicate forms are available for users who don't want to rely on operator== and 1945operator<.</p> 1946<hr> 1947<a name="219"><h3>219. find algorithm missing version that takes a binary predicate argument</h3></a><p><b>Section:</b> 25.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.find"> [lib.alg.find]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Pablo Halpern <b>Date:</b> 6 Mar 2000</p> 1948<p>The find function always searches for a value using operator== to compare the 1949value argument to each element in the input iterator range. This is inconsistent 1950with other find-related functions such as find_end and find_first_of, which 1951allow the caller to specify a binary predicate object to be used for determining 1952equality. The fact that this can be accomplished using a combination of find_if 1953and bind_1st or bind_2nd does not negate the desirability of a consistent, 1954simple, alternative interface to find.</p> 1955<p><b>Proposed resolution:</b></p> 1956<blockquote> 1957<p>In section 25.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.find"> [lib.alg.find]</a>, add a second prototype for find 1958(between the existing prototype and the prototype for find_if), as 1959follows:</p> 1960<pre> template<class InputIterator, class T, class BinaryPredicate> 1961 InputIterator find(InputIterator first, InputIterator last, 1962 const T& value, BinaryPredicate bin_pred);</pre> 1963<p>Change the description of the return from:</p> 1964<blockquote> 1965 <p>Returns: The first iterator i in the range [first, last) for which the following corresponding 1966 conditions hold: *i == value, pred(*i) != false. Returns last if no such iterator is found.</p> 1967</blockquote> 1968<p> to:</p> 1969<blockquote> 1970 <p>Returns: The first iterator i in the range [first, last) for which the following 1971 corresponding condition holds: *i == value, bin_pred(*i,value) != false, pred(*) 1972 != false. Return last if no such iterator is found.</p> 1973</blockquote> 1974</blockquote> 1975<p><b>Rationale:</b></p> 1976<p>This is request for a pure extension, so it is not a defect in the 1977current standard. As the submitter pointed out, "this can 1978be accomplished using a combination of find_if and bind_1st or 1979bind_2nd".</p> 1980<hr> 1981<a name="236"><h3>236. ctype<char>::is() member modifies facet</h3></a><p><b>Section:</b> 22.2.1.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.char.members"> [lib.facet.ctype.char.members]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dietmar K�hl <b>Date:</b> 24 Apr 2000</p> 1982<p>The description of the <tt>is()</tt> member in paragraph 4 of 22.2.1.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.ctype.char.members"> [lib.facet.ctype.char.members]</a> is broken: According to this description, the 1983second form of the <tt>is()</tt> method modifies the masks in the 1984<tt>ctype</tt> object. The correct semantics if, of course, to obtain 1985an array of masks. The corresponding method in the general case, 1986ie. the <tt>do_is()</tt> method as described in 22.2.1.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.ctype.virtuals"> [lib.locale.ctype.virtuals]</a> paragraph 1 does the right thing.</p> 1987<p><b>Proposed resolution:</b></p> 1988 <p>Change paragraph 4 from</p> 1989 <blockquote> 1990 The second form, for all *p in the range [low, high), assigns 1991 vec[p-low] to table()[(unsigned char)*p]. 1992 </blockquote> 1993 <p>to become</p> 1994 <blockquote> 1995 The second form, for all *p in the range [low, high), assigns 1996 table()[(unsigned char)*p] to vec[p-low]. 1997 </blockquote> 1998<p><b>Rationale:</b></p> 1999<p>Duplicate. See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#28">28</a>.</p> 2000<hr> 2001<a name="244"><h3>244. Must <tt>find</tt>'s third argument be CopyConstructible?</h3></a><p><b>Section:</b> 25.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.find"> [lib.alg.find]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Andrew Koenig <b>Date:</b> 02 May 2000</p> 2002<p>Is the following implementation of <tt>find</tt> acceptable?</p> 2003 2004<pre> template<class Iter, class X> 2005 Iter find(Iter begin, Iter end, const X& x) 2006 { 2007 X x1 = x; // this is the crucial statement 2008 while (begin != end && *begin != x1) 2009 ++begin; 2010 return begin; 2011 } 2012</pre> 2013 2014<p>If the answer is yes, then it is implementation-dependent as to 2015whether the following fragment is well formed:</p> 2016 2017<pre> vector<string> v; 2018 2019 find(v.begin(), v.end(), "foo"); 2020</pre> 2021 2022<p>At issue is whether there is a requirement that the third argument 2023of find be CopyConstructible. There may be no problem here, but 2024analysis is necessary.</p> 2025<p><b>Proposed resolution:</b></p> 2026<p><b>Rationale:</b></p> 2027<p>There is no indication in the standard that find's third argument 2028is required to be Copy Constructible. The LWG believes that no such 2029requirement was intended. As noted above, there are times when a user 2030might reasonably pass an argument that is not Copy Constructible.</p> 2031<hr> 2032<a name="245"><h3>245. Which operations on <tt>istream_iterator</tt> trigger input operations?</h3></a><p><b>Section:</b> 24.5.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.istream.iterator"> [lib.istream.iterator]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Andrew Koenig <b>Date:</b> 02 May 2000</p> 2033<p>I do not think the standard specifies what operation(s) on istream 2034iterators trigger input operations. So, for example:</p> 2035 2036<pre> istream_iterator<int> i(cin); 2037 2038 int n = *i++; 2039</pre> 2040 2041<p>I do not think it is specified how many integers have been read 2042from cin. The number must be at least 1, of course, but can it be 2? 2043More?</p> 2044<p><b>Proposed resolution:</b></p> 2045<p><b>Rationale:</b></p> 2046<p>The standard is clear as written: the stream is read every time 2047operator++ is called, and it is also read either when the iterator is 2048constructed or when operator* is called for the first time. In the 2049example above, exactly two integers are read from cin.</p> 2050 2051<p>There may be a problem with the interaction between istream_iterator 2052and some STL algorithms, such as find. There are no guarantees about 2053how many times find may invoke operator++.</p> 2054<hr> 2055<a name="246"><h3>246. <tt>a.insert(p,t)</tt> is incorrectly specified</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Mark Rodgers <b>Date:</b> 19 May 2000</p> 2056<p>Closed issue 192 raised several problems with the specification of 2057this function, but was rejected as Not A Defect because it was too big 2058a change with unacceptable impacts on existing implementations. 2059However, issues remain that could be addressed with a smaller change 2060and with little or no consequent impact.</p> 2061 2062<ol> 2063 <li> 2064<p> The specification is inconsistent with the original 2065 proposal and with several implementations.</p> 2066 2067 <p>The initial implementation by Hewlett Packard only ever looked 2068 immediately <i>before</i> p, and I do not believe there was any 2069 intention to standardize anything other than this behavior. 2070 Consequently, current implementations by several leading 2071 implementors also look immediately before p, and will only insert 2072 after p in logarithmic time. I am only aware of one implementation 2073 that does actually look after p, and it looks before p as well. It 2074 is therefore doubtful that existing code would be relying on the 2075 behavior defined in the standard, and it would seem that fixing 2076 this defect as proposed below would standardize existing 2077 practice.</p> 2078</li> 2079 2080 <li> 2081<p> 2082 The specification is inconsistent with insertion for sequence 2083 containers.</p> 2084 2085 <p>This is difficult and confusing to teach to newcomers. All 2086 insert operations that specify an iterator as an insertion location 2087 should have a consistent meaning for the location represented by 2088 that iterator.</p> 2089</li> 2090 2091 <li> 2092<p> As specified, there is no way to hint that the insertion 2093 should occur at the beginning of the container, and the way to hint 2094 that it should occur at the end is long winded and unnatural.</p> 2095 2096 <p>For a container containing n elements, there are n+1 possible 2097 insertion locations and n+1 valid iterators. For there to be a 2098 one-to-one mapping between iterators and insertion locations, the 2099 iterator must represent an insertion location immediately before 2100 the iterator.</p> 2101</li> 2102 2103 <li> 2104<p> When appending sorted ranges using insert_iterators, 2105 insertions are guaranteed to be sub-optimal.</p> 2106 2107 <p>In such a situation, the optimum location for insertion is 2108 always immediately after the element previously inserted. The 2109 mechanics of the insert iterator guarantee that it will try and 2110 insert after the element after that, which will never be correct. 2111 However, if the container first tried to insert before the hint, 2112 all insertions would be performed in amortized constant 2113 time.</p> 2114</li> 2115</ol> 2116<p><b>Proposed resolution:</b></p> 2117<p>In 23.1.2 [lib.associative.reqmts] paragraph 7, table 69, make 2118the following changes in the row for a.insert(p,t):</p> 2119 2120<p><i>assertion/note pre/post condition:</i> 2121<br>Change the last sentence from</p> 2122 <blockquote> 2123 "iterator p is a hint pointing to where the insert should 2124 start to search." 2125 </blockquote> 2126<p>to</p> 2127 <blockquote> 2128 "iterator p is a hint indicating that immediately before p 2129 may be a correct location where the insertion could occur." 2130 </blockquote> 2131 2132<p><i>complexity:</i><br> 2133Change the words "right after" to "immediately before".</p> 2134<p><b>Rationale:</b></p> 2135<p>Duplicate; see issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#233">233</a>.</p> 2136<hr> 2137<a name="249"><h3>249. Return Type of <tt>auto_ptr::operator=</tt> 2138</h3></a><p><b>Section:</b> 20.4.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.meta.unary"> [lib.meta.unary]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Joseph Gottman <b>Date:</b> 30 Jun 2000</p> 2139<p>According to section 20.4.5, the function 2140<tt>auto_ptr::operator=()</tt> returns a reference to an auto_ptr. 2141The reason that <tt>operator=()</tt> usually returns a reference is to 2142facilitate code like</p> 2143 2144<pre> int x,y,z; 2145 x = y = z = 1; 2146</pre> 2147 2148<p>However, given analogous code for <tt>auto_ptr</tt>s,</p> 2149<pre> auto_ptr<int> x, y, z; 2150 z.reset(new int(1)); 2151 x = y = z; 2152</pre> 2153 2154<p>the result would be that <tt>z</tt> and <tt>y</tt> would both be set to 2155NULL, instead of all the <tt>auto_ptr</tt>s being set to the same value. 2156This makes such cascading assignments useless and counterintuitive for 2157<tt>auto_ptr</tt>s.</p> 2158<p><b>Proposed resolution:</b></p> 2159<p>Change <tt>auto_ptr::operator=()</tt> to return <tt>void</tt> instead 2160of an <tt>auto_ptr</tt> reference.</p> 2161<p><b>Rationale:</b></p> 2162<p>The return value has uses other than cascaded assignments: a user can 2163call an auto_ptr member function, pass the auto_ptr to a 2164function, etc. Removing the return value could break working user 2165code.</p> 2166<hr> 2167<a name="257"><h3>257. STL functional object and iterator inheritance.</h3></a><p><b>Section:</b> 20.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.tuple.tuple"> [lib.tuple.tuple]</a>, 24.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.iterator.basic"> [lib.iterator.basic]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Robert Dick <b>Date:</b> 17 Aug 2000</p> 2168<p> 2169According to the November 1997 Draft Standard, the results of deleting an 2170object of a derived class through a pointer to an object of its base class are 2171undefined if the base class has a non-virtual destructor. Therefore, it is 2172potentially dangerous to publicly inherit from such base classes. 2173</p> 2174 2175<p>Defect: 2176<br> 2177The STL design encourages users to publicly inherit from a number of classes 2178which do nothing but specify interfaces, and which contain non-virtual 2179destructors. 2180</p> 2181 2182<p>Attribution: 2183<br> 2184Wil Evers and William E. Kempf suggested this modification for functional 2185objects. 2186</p> 2187<p><b>Proposed resolution:</b></p> 2188<p> 2189When a base class in the standard library is useful only as an interface 2190specifier, i.e., when an object of the class will never be directly 2191instantiated, specify that the class contains a protected destructor. This 2192will prevent deletion through a pointer to the base class without performance, 2193or space penalties (on any implementation I'm aware of). 2194</p> 2195 2196<p> 2197As an example, replace... 2198</p> 2199 2200<pre> template <class Arg, class Result> 2201 struct unary_function { 2202 typedef Arg argument_type; 2203 typedef Result result_type; 2204 }; 2205</pre> 2206 2207<p> 2208... with... 2209</p> 2210 2211<pre> template <class Arg, class Result> 2212 struct unary_function { 2213 typedef Arg argument_type; 2214 typedef Result result_type; 2215 protected: 2216 ~unary_function() {} 2217 }; 2218</pre> 2219 2220<p> 2221Affected definitions: 2222<br> 2223 20.3.1 [lib.function.objects] -- unary_function, binary_function 2224 <br> 2225 24.3.2 [lib.iterator.basic] -- iterator 2226</p> 2227<p><b>Rationale:</b></p> 2228<p> 2229The standard is clear as written; this is a request for change, not a 2230defect in the strict sense. The LWG had several different objections 2231to the proposed change. One is that it would prevent users from 2232creating objects of type <tt>unary_function</tt> and 2233<tt>binary_function</tt>. Doing so can sometimes be legitimate, if users 2234want to pass temporaries as traits or tag types in generic code. 2235</p> 2236<hr> 2237<a name="267"><h3>267. interaction of strstreambuf::overflow() and seekoff()</h3></a><p><b>Section:</b> D.7.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/future.html#depr.strstreambuf.virtuals"> [depr.strstreambuf.virtuals]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 5 Oct 2000</p> 2238<p> 2239It appears that the interaction of the strstreambuf members overflow() 2240and seekoff() can lead to undefined behavior in cases where defined 2241behavior could reasonably be expected. The following program 2242demonstrates this behavior: 2243</p> 2244 2245<pre> #include <strstream> 2246 2247 int main () 2248 { 2249 std::strstreambuf sb; 2250 sb.sputc ('c'); 2251 2252 sb.pubseekoff (-1, std::ios::end, std::ios::in); 2253 return !('c' == sb.sgetc ()); 2254 } 2255</pre> 2256 2257<p> 2258D.7.1.1, p1 initializes strstreambuf with a call to basic_streambuf<>(), 2259which in turn sets all pointers to 0 in 27.5.2.1, p1. 2260</p> 2261 2262<p> 226327.5.2.2.5, p1 says that basic_streambuf<>::sputc(c) calls 2264overflow(traits::to_int_type(c)) if a write position isn't available (it 2265isn't due to the above). 2266</p> 2267 2268<p> 2269D.7.1.3, p3 says that strstreambuf::overflow(off, ..., ios::in) makes at 2270least one write position available (i.e., it allows the function to make 2271any positive number of write positions available). 2272</p> 2273 2274<p> 2275D.7.1.3, p13 computes newoff = seekhigh - eback(). In D.7.1, p4 we see 2276seekhigh = epptr() ? epptr() : egptr(), or seekhigh = epptr() in this 2277case. newoff is then epptr() - eback(). 2278</p> 2279 2280<p> 2281D.7.1.4, p14 sets gptr() so that gptr() == eback() + newoff + off, or 2282gptr() == epptr() + off holds. 2283</p> 2284 2285<p> 2286If strstreambuf::overflow() made exactly one write position available 2287then gptr() will be set to just before epptr(), and the program will 2288return 0. Buf if the function made more than one write position 2289available, epptr() and gptr() will both point past pptr() and the 2290behavior of the program is undefined. 2291</p> 2292<p><b>Proposed resolution:</b></p> 2293 2294 2295 <p>Change the last sentence of D.7.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/future.html#depr.strstreambuf"> [depr.strstreambuf]</a> paragraph 4 from</p> 2296 2297 <blockquote> 2298 Otherwise, seeklow equals gbeg and seekhigh is either pend, if 2299 pend is not a null pointer, or gend. 2300 </blockquote> 2301 2302 <p>to become</p> 2303 2304 <blockquote> 2305 Otherwise, seeklow equals gbeg and seekhigh is either gend if 2306 0 == pptr(), or pbase() + max where max is the maximum value of 2307 pptr() - pbase() ever reached for this stream. 2308 </blockquote> 2309 2310<p><i>[ 2311 pre-Copenhagen: Dietmar provided wording for proposed resolution. 2312]</i></p> 2313 2314<p><i>[ 2315 post-Copenhagen: Fixed a typo: proposed resolution said to fix 2316 4.7.1, not D.7.1. 2317]</i></p> 2318 2319<p><b>Rationale:</b></p> 2320<p>This is related to issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#65">65</a>: it's not clear what it 2321means to seek beyond the current area. Without resolving issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#65">65</a> we can't resolve this. As with issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#65">65</a>, 2322the library working group does not wish to invest time nailing down 2323corner cases in a deprecated feature.</p> 2324<hr> 2325<a name="269"><h3>269. cstdarg and unnamed parameters</h3></a><p><b>Section:</b> 18.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.support.exception"> [lib.support.exception]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> J. Stephen Adamczyk <b>Date:</b> 10 Oct 2000</p> 2326<p> 2327One of our customers asks whether this is valid C++: 2328</p> 2329 2330<pre> #include <cstdarg> 2331 2332 void bar(const char *, va_list); 2333 2334 void 2335 foo(const char *file, const char *, ...) 2336 { 2337 va_list ap; 2338 va_start(ap, file); 2339 bar(file, ap); 2340 va_end(ap); 2341 } 2342</pre> 2343 2344<p> 2345The issue being whether it is valid to use cstdarg when the final 2346parameter before the "..." is unnamed. cstdarg is, as far 2347as I can tell, inherited verbatim from the C standard. and the 2348definition there (7.8.1.1 in the ISO C89 standard) refers to "the 2349identifier of the rightmost parameter". What happens when there 2350is no such identifier? 2351</p> 2352 2353<p> 2354My personal opinion is that this should be allowed, but some tweak 2355might be required in the C++ standard. 2356</p> 2357<p><b>Proposed resolution:</b></p> 2358<p><b>Rationale:</b></p> 2359<p> 2360Not a defect, the C and C++ standards are clear. It is impossible to 2361use varargs if the parameter immediately before "..." has no 2362name, because that is the parameter that must be passed to va_start. 2363The example given above is broken, because va_start is being passed 2364the wrong parameter. 2365</p> 2366 2367<p> 2368There is no support for extending varargs to provide additional 2369functionality beyond what's currently there. For reasons of C/C++ 2370compatibility, it is especially important not to make gratuitous 2371changes in this part of the C++ standard. The C committee has already 2372been requested not to touch this part of the C standard unless 2373necessary. 2374</p> 2375<hr> 2376<a name="277"><h3>277. Normative encouragement in allocator requirements unclear</h3></a><p><b>Section:</b> 20.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.default.con.req"> [lib.default.con.req]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 07 Nov 2000</p> 2377<p> 2378In 20.1.5, paragraph 5, the standard says that "Implementors are 2379encouraged to supply libraries that can accept allocators that 2380encapsulate more general memory models and that support non-equal 2381instances." This is intended as normative encouragement to 2382standard library implementors. However, it is possible to interpret 2383this sentence as applying to nonstandard third-party libraries. 2384</p> 2385<p><b>Proposed resolution:</b></p> 2386<p> 2387In 20.1.5, paragraph 5, change "Implementors" to 2388"Implementors of the library described in this International 2389Standard". 2390</p> 2391<p><b>Rationale:</b></p> 2392<p>The LWG believes the normative encouragement is already 2393sufficiently clear, and that there are no important consequences 2394even if it is misunderstood.</p> 2395<hr> 2396<a name="279"><h3>279. const and non-const iterators should have equivalent typedefs</h3></a><p><b>Section:</b> 23.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.requirements"> [lib.container.requirements]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Steve Cleary <b>Date:</b> 27 Nov 2000</p> 2397 2398<p> 2399This came from an email from Steve Cleary to Fergus in reference to 2400issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#179">179</a>. The library working group briefly discussed 2401this in Toronto and believes it should be a separate issue. 2402</p> 2403 2404<p> 2405Steve said: "We may want to state that the const/non-const iterators must have 2406the same difference type, size_type, and category." 2407</p> 2408 2409<p> 2410(Comment from Judy) 2411I'm not sure if the above sentence should be true for all 2412const and non-const iterators in a particular container, or if it means 2413the container's iterator can't be compared with the container's 2414const_iterator unless the above it true. I suspect the former. 2415</p> 2416<p><b>Proposed resolution:</b></p> 2417<p> 2418In <b>Section:</b> 23.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.container.requirements"> [lib.container.requirements]</a>, 2419table 65, in the assertion/note pre/post condition for X::const_iterator, 2420add the following: 2421</p> 2422 2423<blockquote> 2424<p> 2425typeid(X::const_iterator::difference_type) == typeid(X::iterator::difference_type) 2426</p> 2427 2428<p> 2429typeid(X::const_iterator::size_type) == typeid(X::iterator::size_type) 2430</p> 2431 2432<p> 2433typeid(X::const_iterator::category) == typeid(X::iterator::category) 2434</p> 2435</blockquote> 2436<p><b>Rationale:</b></p> 2437<p>Going through the types one by one: Iterators don't have a 2438<tt>size_type</tt>. We already know that the difference types are 2439identical, because the container requirements already say that the 2440difference types of both X::iterator and X::const_iterator are both 2441X::difference_type. The standard does not require that X::iterator 2442and X::const_iterator have the same iterator category, but the LWG 2443does not see this as a defect: it's possible to imagine cases in which 2444it would be useful for the categories to be different.</p> 2445 2446<p>It may be desirable to require X::iterator and X::const_iterator to 2447have the same value type, but that is a new issue. (Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#322">322</a>.)</p> 2448 2449<hr> 2450<a name="287"><h3>287. conflicting ios_base fmtflags</h3></a><p><b>Section:</b> 27.4.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.fmtflags.state"> [lib.fmtflags.state]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 30 Dec 2000</p> 2451<p> 2452The Effects clause for ios_base::setf(fmtflags fmtfl) says 2453"Sets fmtfl in flags()". What happens if the user first calls 2454ios_base::scientific and then calls ios_base::fixed or vice-versa? 2455This is an issue for all of the conflicting flags, i.e. ios_base::left 2456and ios_base::right or ios_base::dec, ios_base::hex and ios_base::oct. 2457</p> 2458 2459<p> 2460I see three possible solutions: 2461</p> 2462 2463<ol> 2464<li>Set ios_base::failbit whenever the user specifies a conflicting 2465flag with one previously explicitly set. If the constructor is 2466supposed to set ios_base::dec (see discussion below), then 2467the user setting hex or oct format after construction will not 2468set failbit. </li> 2469<li>The last call to setf "wins", i.e. it clears any conflicting 2470previous setting.</li> 2471<li>All the flags that the user specifies are set, but when actually 2472interpreting them, fixed always override scientific, right always 2473overrides left, dec overrides hex which overrides oct.</li> 2474</ol> 2475 2476<p> 2477Most existing implementations that I tried seem to conform to resolution #3, 2478except that when using the iomanip manipulator hex or oct then that always 2479overrides dec, but calling setf(ios_base::hex) doesn't. 2480</p> 2481 2482<p> 2483There is a sort of related issue, which is that although the ios_base 2484constructor says that each ios_base member has an indeterminate value 2485after construction, all the existing implementations I tried explicitly set 2486ios_base::dec. 2487</p> 2488<p><b>Proposed resolution:</b></p> 2489<p><b>Rationale:</b></p> 2490<p> 2491<tt>adjustfield</tt>, <tt>basefield</tt>, and <tt>floatfield</tt> 2492are each multi-bit fields. It is possible to set multiple bits within 2493each of those fields. (For example, <tt>dec</tt> and 2494<tt>oct</tt>). These fields are used by locale facets. The LWG 2495reviewed the way in which each of those three fields is used, and 2496believes that in each case the behavior is well defined for any 2497possible combination of bits. See for example Table 58, in 22.2.2.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.num.put.virtuals"> [lib.facet.num.put.virtuals]</a>, noting the requirement in paragraph 6 of that 2498section. 2499</p> 2500<p> 2501Users are advised to use manipulators, or else use the two-argument 2502version of <tt>setf</tt>, to avoid unexpected behavior. 2503</p> 2504<hr> 2505<a name="289"><h3>289. <cmath> requirements missing C float and long double versions</h3></a><p><b>Section:</b> 26.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.numarray"> [lib.numarray]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 30 Dec 2000</p> 2506<p> 2507 In ISO/IEC 9899:1990 Programming Languages C we find the following 2508 concerning <math.h>: 2509</p> 2510 2511<blockquote> 2512 7.13.4 Mathematics <math.h> 2513 <br> 2514 The names of all existing functions declared in the <math.h> 2515 header, suffixed with f or l, are reserved respectively for 2516 corresponding functions with float and long double arguments 2517 are return values. 2518</blockquote> 2519 2520<p> 2521 For example, <tt>float sinf(float)</tt> 2522 is reserved. 2523</p> 2524 2525<p> 2526 In the C99 standard, <math.h> must contain declarations 2527 for these functions. 2528</p> 2529 2530<p> 2531So, is it acceptable for an implementor to add these prototypes to the 2532C++ versions of the math headers? Are they required? 2533</p> 2534<p><b>Proposed resolution:</b></p> 2535<p> 2536Add these Functions to Table 80, section 26.5 and to Table 99, 2537section C.2: 2538</p> 2539 2540<pre> acosf asinf atanf atan2f ceilf cosf coshf 2541 expf fabsf floorf fmodf frexpf ldexpf 2542 logf log10f modff powf sinf sinhf sqrtf 2543 tanf tanhf 2544 acosl asinl atanl atan2l ceill cosl coshl 2545 expl fabsl floorl fmodl frexpl ldexpl 2546 logl log10l modfl powl sinl sinhl sqrtl 2547 tanl tanhl 2548</pre> 2549 2550<p> 2551There should probably be a note saying that these functions 2552are optional and, if supplied, should match the description in 2553the 1999 version of the C standard. In the next round 2554of C++ standardization they can then become mandatory. 2555</p> 2556<p><b>Rationale:</b></p> 2557<p>The C90 standard, as amended, already permits (but does not 2558require) these functions, and the C++ standard incorporates the 2559C90 standard by reference. C99 is not an issue, because it is 2560never referred to by the C++ standard.</p> 2561<hr> 2562<a name="293"><h3>293. Order of execution in transform algorithm</h3></a><p><b>Section:</b> 25.2.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.transform"> [lib.alg.transform]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Angelika Langer <b>Date:</b> 04 Jan 2001</p> 2563<p>This issue is related to issue 242. In case that the resolution 2564proposed for issue 242 is accepted, we have have the following 2565situation: The 4 numeric algorithms (accumulate and consorts) as well 2566as transform would allow a certain category of side effects. The 2567numeric algorithms specify that they invoke the functor "for 2568every iterator i in the range [first, last) in order". transform, 2569in contrast, would not give any guarantee regarding order of 2570invocation of the functor, which means that the functor can be invoked 2571in any arbitrary order. 2572</p> 2573 2574<p>Why would that be a problem? Consider an example: say the 2575transformator that is a simple enumerator ( or more generally 2576speaking, "is order-sensitive" ). Since a standard 2577compliant implementation of transform is free to invoke the enumerator 2578in no definite order, the result could be a garbled enumeration. 2579Strictly speaking this is not a problem, but it is certainly at odds 2580with the prevalent understanding of transform as an algorithms that 2581assigns "a new _corresponding_ value" to the output 2582elements. 2583</p> 2584 2585<p>All implementations that I know of invoke the transformator in 2586definite order, namely starting from first and proceeding to last - 25871. Unless there is an optimization conceivable that takes advantage of 2588the indefinite order I would suggest to specify the order, because it 2589eliminate the uncertainty that users would otherwise have regarding 2590the order of execution of their potentially order-sensitive function 2591objects. 2592</p> 2593<p><b>Proposed resolution:</b></p> 2594<p>In section 25.2.3 - Transform [lib.alg.transform] change:</p> 2595<blockquote> 2596-1- Effects: Assigns through every iterator i in the range [result, 2597result + (last1 - first1)) a new corresponding 2598value equal to op(*(first1 + (i - result)) or binary_op(*(first1 + 2599(i - result), *(first2 + (i - result))). 2600</blockquote> 2601<p>to:</p> 2602<blockquote> 2603-1- Effects: Computes values by invoking the operation op or binary_op 2604for every iterator in the range [first1, last1) in order. Assigns through 2605every iterator i in the range [result, result + (last1 - first1)) a new 2606corresponding 2607value equal to op(*(first1 + (i - result)) or binary_op(*(first1 + 2608(i - result), *(first2 + (i - result))). 2609</blockquote> 2610<p><b>Rationale:</b></p> 2611<p>For Input Iterators an order is already guaranteed, because 2612only one order is possible. If a user who passes a Forward 2613Iterator to one of these algorithms really needs a specific 2614order of execution, it's possible to achieve that effect by 2615wrapping it in an Input Iterator adaptor.</p> 2616<hr> 2617<a name="296"><h3>296. Missing descriptions and requirements of pair operators</h3></a><p><b>Section:</b> 20.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.pairs"> [lib.pairs]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 14 Jan 2001</p> 2618<p>The synopsis of the header <tt><utility></tt> in 20.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.utility"> [lib.utility]</a> 2619lists the complete set of equality and relational operators for <tt>pair</tt> 2620but the section describing the template and the operators only describes 2621<tt>operator==()</tt> and <tt>operator<()</tt>, and it fails to mention 2622any requirements on the template arguments. The remaining operators are 2623not mentioned at all. 2624</p> 2625<p><b>Proposed resolution:</b></p> 2626<p><b>Rationale:</b></p> 2627<p>20.2.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.operators"> [lib.operators]</a> paragraph 10 already specifies the semantics. 2628That paragraph says that, if declarations of operator!=, operator>, 2629operator<=, and operator>= appear without definitions, they are 2630defined as specified in 20.2.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.operators"> [lib.operators]</a>. There should be no user 2631confusion, since that paragraph happens to immediately precede the 2632specification of <tt>pair</tt>.</p> 2633<hr> 2634<a name="302"><h3>302. Need error indication from codecvt<>::do_length</h3></a><p><b>Section:</b> 22.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt.byname"> [lib.locale.codecvt.byname]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Gregory Bumgardner <b>Date:</b> 25 Jan 2001</p> 2635<p> 2636The effects of <tt>codecvt<>::do_length()</tt> are described in 263722.2.1.5.2, paragraph 10. As implied by that paragraph, and clarified 2638in issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#75">75</a>, <tt>codecvt<>::do_length()</tt> must 2639process the source data and update the <tt>stateT</tt> argument just 2640as if the data had been processed by <tt>codecvt<>::in()</tt>. 2641However, the standard does not specify how <tt>do_length()</tt> would 2642report a translation failure, should the source sequence contain 2643untranslatable or illegal character sequences. 2644</p> 2645 2646<p> 2647The other conversion methods return an "error" result value 2648to indicate that an untranslatable character has been encountered, but 2649<tt>do_length()</tt> already has a return value (the number of source 2650characters that have been processed by the method). 2651</p> 2652<p><b>Proposed resolution:</b></p> 2653<p> 2654This issue cannot be resolved without modifying the interface. An exception 2655cannot be used, as there would be no way to determine how many characters 2656have been processed and the state object would be left in an indeterminate 2657state. 2658</p> 2659 2660<p> 2661A source compatible solution involves adding a fifth argument to length() 2662and do_length() that could be used to return position of the offending 2663character sequence. This argument would have a default value that would 2664allow it to be ignored: 2665</p> 2666 2667<pre> int length(stateT& state, 2668 const externT* from, 2669 const externT* from_end, 2670 size_t max, 2671 const externT** from_next = 0); 2672 2673 virtual 2674 int do_length(stateT& state, 2675 const externT* from, 2676 const externT* from_end, 2677 size_t max, 2678 const externT** from_next); 2679</pre> 2680 2681<p> 2682Then an exception could be used to report any translation errors and 2683the from_next argument, if used, could then be used to retrieve the 2684location of the offending character sequence. 2685</p> 2686<p><b>Rationale:</b></p> 2687<p>The standard is already clear: the return value is the number of 2688"valid complete characters". If it encounters an invalid sequence of 2689external characters, it stops.</p> 2690<hr> 2691<a name="304"><h3>304. Must <tt>*a</tt> return an lvalue when <tt>a</tt> is an input iterator?</h3></a><p><b>Section:</b> 24.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.iterator.requirements"> [lib.iterator.requirements]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Dave Abrahams <b>Date:</b> 5 Feb 2001</p> 2692<p> 2693We all "know" that input iterators are allowed to produce 2694values when dereferenced of which there is no other in-memory copy. 2695</p> 2696 2697<p> 2698But: Table 72, with a careful reading, seems to imply that this can only be 2699the case if the value_type has no members (e.g. is a built-in type). 2700</p> 2701 2702<p>The problem occurs in the following entry:</p> 2703 2704<pre> a->m pre: (*a).m is well-defined 2705 Equivalent to (*a).m 2706</pre> 2707 2708<p> 2709<tt>*a.m</tt> can be well-defined if <tt>*a</tt> is not a reference 2710type, but since <tt>operator->()</tt> must return a pointer for 2711<tt>a->m</tt> to be well-formed, it needs something to return a 2712pointer <i>to</i>. This seems to indicate that <tt>*a</tt> must be 2713buffered somewhere to make a legal input iterator. 2714</p> 2715 2716<p>I don't think this was intentional.</p> 2717<p><b>Proposed resolution:</b></p> 2718<p><b>Rationale:</b></p> 2719<p>The current standard is clear and consistent. Input iterators that 2720 return rvalues are in fact implementable. They may in some cases 2721 require extra work, but it is still possible to define an operator-> 2722 in such cases: it doesn't have to return a T*, but may return a 2723 proxy type. No change to the standard is justified.</p> 2724<hr> 2725<a name="313"><h3>313. set_terminate and set_unexpected question</h3></a><p><b>Section:</b> 18.7.3.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.terminate"> [lib.terminate]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Judy Ward <b>Date:</b> 3 Apr 2001</p> 2726<p> 2727According to section 18.7.3.3 of the standard, std::terminate() is 2728supposed to call the terminate_handler in effect immediately after 2729evaluating the throw expression. 2730</p> 2731 2732<p> 2733Question: what if the terminate_handler in effect is itself 2734std::terminate? 2735</p> 2736 2737<p>For example:</p> 2738 2739<pre> #include <exception> 2740 2741 int main () { 2742 std::set_terminate(std::terminate); 2743 throw 5; 2744 return 0; 2745 } 2746</pre> 2747 2748<p> 2749Is the implementation allowed to go into an infinite loop? 2750</p> 2751 2752<p> 2753I think the same issue applies to std::set_unexpected. 2754</p> 2755<p><b>Proposed resolution:</b></p> 2756<p><b>Rationale:</b></p> 2757<p>Infinite recursion is to be expected: users who set the terminate 2758handler to <tt>terminate</tt> are explicitly asking for <tt>terminate</tt> 2759to call itself.</p> 2760<hr> 2761<a name="314"><h3>314. Is the stack unwound when terminate() is called?</h3></a><p><b>Section:</b> 18.7.3.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.terminate"> [lib.terminate]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Detlef Vollmann <b>Date:</b> 11 Apr 2001</p> 2762 2763<p> 2764The standard appears to contradict itself about whether the stack is 2765unwound when the implementation calls terminate(). 2766</p> 2767 2768<p>From 18.7.3.3p2:</p> 2769<blockquote> 2770 Calls the terminate_handler function in effect immediately 2771 after evaluating the throw-expression (lib.terminate.handler), 2772 if called by the implementation [...] 2773</blockquote> 2774 2775<p>So the stack is guaranteed not to be unwound.</p> 2776 2777<p>But from 15.3p9:</p> 2778<blockquote> 2779 [...]whether or not the stack is unwound before this call 2780 to terminate() is implementation-defined (except.terminate). 2781</blockquote> 2782 2783<p> 2784And 15.5.1 actually defines that in most cases the stack is unwound. 2785</p> 2786<p><b>Proposed resolution:</b></p> 2787<p><b>Rationale:</b></p> 2788<p>There is definitely no contradiction between the core and library 2789clauses; nothing in the core clauses says that stack unwinding happens 2790after <tt>terminate</tt> is called. 18.7.3.3p2 does not say anything 2791about when terminate() is called; it merely specifies which 2792<tt>terminate_handler</tt> is used.</p> 2793<hr> 2794<a name="323"><h3>323. abs() overloads in different headers</h3></a><p><b>Section:</b> 26.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.numarray"> [lib.numarray]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Dave Abrahams <b>Date:</b> 4 June 2001</p> 2795<p>Currently the standard mandates the following overloads of 2796abs():</p> 2797 2798<pre> abs(long), abs(int) in <cstdlib> 2799 2800 abs(float), abs(double), abs(long double) in <cmath> 2801 2802 template<class T> T abs(const complex<T>&) in <complex> 2803 2804 template<class T> valarray<T> abs(const valarray<T>&); in <valarray> 2805</pre> 2806 2807<p> 2808The problem is that having only some overloads visible of a function 2809that works on "implicitly inter-convertible" types is dangerous in 2810practice. The headers that get included at any point in a translation 2811unit can change unpredictably during program 2812development/maintenance. The wrong overload might be unintentionally 2813selected. 2814</p> 2815 2816<p> 2817Currently, there is nothing that mandates the simultaneous visibility 2818of these overloads. Indeed, some vendors have begun fastidiously 2819reducing dependencies among their (public) headers as a QOI issue: it 2820helps people to write portable code by refusing to compile unless all 2821the correct headers are #included. 2822</p> 2823 2824<p>The same issue may exist for other functions in the library.</p> 2825 2826<p>Redmond: PJP reports that C99 adds two new kinds of abs: complex, 2827and int_max_abs.</p> 2828 2829<p>Related issue: <font color="red">343</font>.</p> 2830 2831<p><b>Proposed resolution:</b></p> 2832<p><b>Rationale:</b></p> 2833<p>The programs that could potentially be broken by this situation are 2834 already fragile, and somewhat contrived: For example, a user-defined 2835 class that has conversion overloads both to <tt>long</tt> and 2836 to <tt>float</tt>. If <tt>x</tt> is a value of such a class, then 2837 <tt>abs(x)</tt> would give the <tt>long</tt> version if the user 2838 included <cstdlib>, the <tt>float</tt> version if the user 2839 included <cmath>, and would be diagnosed as ambiguous at 2840 compile time if the user included both headers. The LWG couldn't 2841 find an example of a program whose meaning would be changed (as 2842 opposed to changing it from well-formed to ill-formed) simply by 2843 adding another standard header.</p> 2844 2845<p>Since the harm seems minimal, and there don't seem to be any simple 2846 and noninvasive solutions, this is being closed as NAD. It is 2847 marked as "Future" for two reasons. First, it might be useful to 2848 define an <tt><all></tt> header that would include all 2849 Standard Library headers. Second, we should at least make sure that 2850 future library extensions don't make this problem worse.</p> 2851<hr> 2852<a name="326"><h3>326. Missing typedef in moneypunct_byname</h3></a><p><b>Section:</b> 22.2.6.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.moneypunct.byname"> [lib.locale.moneypunct.byname]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 05 Jul 2001</p> 2853<p>The definition of the moneypunct facet contains the typedefs char_type 2854and string_type. Only one of these names, string_type, is defined in 2855the derived facet, moneypunct_byname.</p> 2856<p><b>Proposed resolution:</b></p> 2857<p>For consistency with the numpunct facet, add a typedef for 2858char_type to the definition of the moneypunct_byname facet in 285922.2.6.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.moneypunct.byname"> [lib.locale.moneypunct.byname]</a>.</p> 2860<p><b>Rationale:</b></p> 2861<p>The absence of the typedef is irrelevant. Users can still access 2862the typedef, because it is inherited from the base class.</p> 2863<hr> 2864<a name="330"><h3>330. Misleading "exposition only" value in class locale definition</h3></a><p><b>Section:</b> 22.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale"> [lib.locale]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 15 Jul 2001</p> 2865<p> 2866The "exposition only" value of the std::locale::none constant shown in 2867the definition of class locale is misleading in that it on many 2868systems conflicts with the value assigned to one if the LC_XXX 2869constants (specifically, LC_COLLATE on AIX, LC_ALL on HP-UX, LC_CTYPE 2870on Linux and SunOS). This causes incorrect behavior when such a 2871constant is passed to one of the locale member functions that accept a 2872locale::category argument and interpret it as either the C LC_XXX 2873constant or a bitmap of locale::category values. At least three major 2874implementations adopt the suggested value without a change and 2875consequently suffer from this problem. 2876</p> 2877 2878<p> 2879For instance, the following code will (presumably) incorrectly copy facets 2880belonging to the collate category from the German locale on AIX: 2881</p> 2882 2883<pre> std::locale l (std::locale ("C"), "de_DE", std::locale::none); 2884</pre> 2885<p><b>Proposed resolution:</b></p> 2886<p><b>Rationale:</b></p> 2887<p>The LWG agrees that it may be difficult to implement locale member 2888functions in such a way that they can take either <tt>category</tt> 2889arguments or the LC_ constants defined in <cctype>. In light of 2890this requirement (22.1.1.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.category"> [lib.locale.category]</a>, paragraph 2), and in light 2891of the requirement in the preceding paragraph that it is possible to 2892combine <tt>category</tt> bitmask elements with bitwise operations, 2893defining the <tt>category</tt> elements is delicate, 2894particularly if an implementor is constrained to work with a 2895preexisting C library. (Just using the existing LC_ constants would 2896not work in general.) There's no set of "exposition only" values that 2897could give library implementors proper guidance in such a delicate 2898matter. The non-normative example we're giving is no worse than 2899any other choice would be.</p> 2900 2901<p>See issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#347">347</a>.</p> 2902<hr> 2903<a name="332"><h3>332. Consider adding increment and decrement operators to std::fpos< T > </h3></a><p><b>Section:</b> 27.4.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.fpos"> [lib.fpos]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> PremAnand M. Rao <b>Date:</b> 27 Aug 2001</p> 2904<p> 2905Increment and decrement operators are missing from 2906Table 88 -- Position type requirements in 27.4.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.fpos"> [lib.fpos]</a>. 2907</p> 2908<p><b>Proposed resolution:</b></p> 2909<p> 2910Table 88 (section 27.4.3) -- Position type requirements 2911be updated to include increment and decrement operators. 2912</p> 2913 2914<pre>expression return type operational note 2915 2916++p fpos& p += O(1) 2917p++ fpos { P tmp = p; 2918 ++p; 2919 return tmp; } 2920--p fpos& p -= O(1) 2921p-- fpos { P tmp = p; 2922 --p; 2923 return tmp; } 2924</pre> 2925 2926<p><b>Rationale:</b></p> 2927<p>The LWG believes this is a request for extension, not a defect 2928report. Additionally, nobody saw a clear need for this extension; 2929<tt>fpos</tt> is used only in very limited ways.</p> 2930<hr> 2931<a name="344"><h3>344. grouping + showbase</h3></a><p><b>Section:</b> 22.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.category.numeric"> [lib.category.numeric]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Howard Hinnant <b>Date:</b> 13 Oct 2001</p> 2932<p> 2933When both grouping and showbase are active and the basefield is octal, 2934does the leading 0 participate in the grouping or not? For example, 2935should one format as: 0,123,456 or 0123,456? 2936</p> 2937<p> 2938An analogy can be drawn with hexadecimal. It appears that 0x123,456 is 2939preferred over 0x,123,456. However, this analogy is not universally 2940accepted to apply to the octal base. The standard is not clear on how 2941to format (or parse) in this manner. 2942</p> 2943<p><b>Proposed resolution:</b></p> 2944<p> 2945Insert into 22.2.3.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.numpunct.virtuals"> [lib.facet.numpunct.virtuals]</a> paragraph 3, just before the last 2946sentence: 2947</p> 2948<blockquote> 2949The leading hexadecimal base specifier "0x" does not participate in 2950grouping. The leading '0' octal base specifier may participate in 2951grouping. It is unspecified if the leading '0' participates in 2952formatting octal numbers. In parsing octal numbers, the implementation 2953is encouraged to accept both the leading '0' participating in the 2954grouping, and not participating (e.g. 0123,456 or 0,123,456). 2955</blockquote> 2956<p><b>Rationale:</b></p> 2957<p> 2958The current behavior may be unspecified, but it's not clear that it 2959matters. This is an obscure corner case, since grouping is usually 2960intended for the benefit of humans and oct/hex prefixes are usually 2961intended for the benefit of machines. There is not a strong enough 2962consensus in the LWG for action. 2963</p> 2964<hr> 2965<a name="348"></a><h3><a name="348">348. Minor issue with std::pair operator<</a></h3><p><b>Section:</b> 20.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.pairs"> [lib.pairs]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Andy Sawyer <b>Date:</b> 23 Oct 2001</p> 2966<p> 2967The current wording of 20.2.2 [lib.pairs] p6 precludes the use of 2968operator< on any pair type which contains a pointer. 2969</p> 2970<p><b>Proposed resolution:</b></p> 2971<p>In 20.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.pairs"> [lib.pairs]</a> paragraph 6, replace:</p> 2972<pre> Returns: x.first < y.first || (!(y.first < x.first) && x.second < 2973 y.second). 2974</pre> 2975<p>With:</p> 2976<pre> Returns: std::less<T1>()( x.first, y.first ) || 2977 (!std::less<T1>()( y.first, x.first) && 2978 std::less<T2>()( x.second, y.second ) ) 2979</pre> 2980 2981<p><b>Rationale:</b></p> 2982<p>This is an instance of a much more general problem. If we want 2983 operator< to translate to std::less for pairs of pointers, where 2984 do we draw the line? The same issue applies to individual 2985 pointers, smart pointer wrappers, std::vector<T*>, and so 2986 on.</p> 2987 2988<p>Andy Koenig suggests that the real issue here is that we aren't 2989 distinguishing adequately between two different orderings, a 2990 "useful ordering" and a "canonical ordering" that's used just 2991 because we sometimes need <i>some</i> ordering without caring much 2992 which ordering it is. Another example of the later is typeinfo's 2993 <tt>before</tt>.</p> 2994 2995<hr> 2996<a name="350"><h3>350. allocator<>::address</h3></a><p><b>Section:</b> 20.6.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.allocator.members"> [lib.allocator.members]</a>, 20.1.6 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.allocator.requirements"> [lib.allocator.requirements]</a>, 17.4.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.contents"> [lib.contents]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Nathan Myers <b>Date:</b> 25 Oct 2001</p> 2997<p>See c++std-lib-9006 and c++std-lib-9007. This issue is taken 2998verbatim from -9007.</p> 2999 3000<p> 3001The core language feature allowing definition of operator&() applied 3002to any non-builtin type makes that operator often unsafe to use in 3003implementing libraries, including the Standard Library. The result 3004is that many library facilities fail for legal user code, such as 3005the fragment</p> 3006<pre> class A { private: A* operator&(); }; 3007 std::vector<A> aa; 3008 3009 class B { }; 3010 B* operator&(B&) { return 0; } 3011 std::vector<B> ba; 3012</pre> 3013 3014<p> 3015In particular, the requirements table for Allocator (Table 32) specifies 3016no semantics at all for member address(), and allocator<>::address is 3017defined in terms of unadorned operator &. 3018</p> 3019 3020<p><b>Proposed resolution:</b></p> 3021<p> 3022In 20.6.1.1, Change the definition of allocator<>::address from:</p> 3023<blockquote> 3024 Returns: &x 3025</blockquote> 3026 3027<p>to:</p> 3028 3029<p> 3030 Returns: The value that the built in operator&(x) would return if not 3031 overloaded. 3032</p> 3033 3034<p> 3035In 20.1.6, Table 32, add to the Notes column of the a.address(r) and 3036a.address(s) lines, respectively: 3037</p> 3038 3039<pre> allocator<T>::address(r) 3040 allocator<T>::address(s) 3041</pre> 3042 3043<p>In addition, in clause 17.4.1.1, add a statement:</p> 3044 3045<blockquote> 3046 The Standard Library does not apply operator& to any type for which 3047 operator& may be overloaded. 3048</blockquote> 3049 3050<p><b>Rationale:</b></p> 3051<p>The LWG believes both examples are ill-formed. The contained type 3052is required to be CopyConstructible (20.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.copyconstructible"> [lib.copyconstructible]</a>), and that 3053includes the requirement that &t return the usual types and 3054values. Since allocators are intended to be used in conjunction with 3055containers, and since the CopyConstructible requirements appear to 3056have been written to deal with the concerns of this issue, the LWG 3057feels it is NAD unless someone can come up with a well-formed example 3058exhibiting a problem.</p> 3059 3060<p>It may well be that the CopyConstructible requirements are too 3061 restrictive and that either the container requirements or the 3062 CopyConstructive requirements should be relaxed, but that's a far 3063 larger issue. Marking this issue as "future" as a pointer to that 3064 larger issue.</p> 3065<hr> 3066<a name="351"><h3>351. unary_negate and binary_negate: struct or class?</h3></a><p><b>Section:</b> 20.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.tuple"> [lib.tuple]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Dale Riley <b>Date:</b> 12 Nov 2001</p> 3067<p> 3068In 20.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.tuple"> [lib.tuple]</a> the header <functional> synopsis declares 3069the unary_negate and binary_negate function objects as struct. 3070However in <font color="red">20.3.5</font> the unary_negate and binary_negate 3071function objects are defined as class. Given the context, they are 3072not "basic function objects" like negate, so this is either a typo or 3073an editorial oversight. 3074</p> 3075 3076<p><i>[Taken from comp.std.c++]</i></p> 3077<p><b>Proposed resolution:</b></p> 3078<p>Change the synopsis to reflect the useage in <font color="red">20.3.5</font></p> 3079 3080<p><i>[Cura�ao: Since the language permits "struct", the LWG 3081views this as NAD. They suggest, however, that the Project Editor 3082might wish to make the change as editorial.]</i></p> 3083 3084<hr> 3085<a name="353"><h3>353. <tt>std::pair</tt> missing template assignment</h3></a><p><b>Section:</b> 20.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.pairs"> [lib.pairs]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 2 Dec 2001</p> 3086<p> 3087The class template <tt>std::pair</tt> defines a template ctor (20.2.2, p4) but 3088no template assignment operator. This may lead to inefficient code since 3089assigning an object of <tt>pair<C, D></tt> to <tt>pair<A, B></tt> 3090where the types <tt>C</tt> and <tt>D</tt> are distinct from but convertible to 3091<tt>A</tt> and <tt>B</tt>, respectively, results in a call to the template copy 3092ctor to construct an unnamed temporary of type <tt>pair<A, B></tt> 3093followed by an ordinary (perhaps implicitly defined) assignment operator, 3094instead of just a straight assignment. 3095</p> 3096<p><b>Proposed resolution:</b></p> 3097<p> 3098Add the following declaration to the definition of <tt>std::pair</tt>: 3099</p> 3100<pre> template<class U, class V> 3101 pair& operator=(const pair<U, V> &p); 3102</pre> 3103<p> 3104And also add a paragraph describing the effects of the function template to the 3105end of 20.2.2: 3106</p> 3107<pre> template<class U, class V> 3108 pair& operator=(const pair<U, V> &p); 3109</pre> 3110<p> 3111 <b>Effects</b>: <tt>first = p.first;</tt> 3112 <tt>second = p.second;</tt> 3113 <b>Returns</b>: <tt>*this</tt> 3114</p> 3115 3116<p><i>[Cura�ao: There is no indication this is was anything other than 3117a design decision, and thus NAD. May be appropriate for a future 3118standard.]</i></p> 3119 3120<hr> 3121<a name="356"><h3>356. Meaning of ctype_base::mask enumerators</h3></a><p><b>Section:</b> 22.2.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.category.ctype"> [lib.category.ctype]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 23 Jan 2002</p> 3122 3123<p>What should the following program print?</p> 3124 3125<pre> #include <locale> 3126 #include <iostream> 3127 3128 class my_ctype : public std::ctype<char> 3129 { 3130 typedef std::ctype<char> base; 3131 public: 3132 my_ctype(std::size_t refs = 0) : base(my_table, false, refs) 3133 { 3134 std::copy(base::classic_table(), base::classic_table() + base::table_size, 3135 my_table); 3136 my_table[(unsigned char) '_'] = (base::mask) (base::print | base::space); 3137 } 3138 private: 3139 mask my_table[base::table_size]; 3140 }; 3141 3142 int main() 3143 { 3144 my_ctype ct; 3145 std::cout << "isspace: " << ct.is(std::ctype_base::space, '_') << " " 3146 << "isalpha: " << ct.is(std::ctype_base::alpha, '_') << std::endl; 3147 } 3148</pre> 3149 3150<p>The goal is to create a facet where '_' is treated as whitespace.</p> 3151 3152<p>On gcc 3.0, this program prints "isspace: 1 isalpha: 0". On 3153Microsoft C++ it prints "isspace: 1 isalpha: 1".</p> 3154 3155<p> 3156I believe that both implementations are legal, and the standard does not 3157give enough guidance for users to be able to use std::ctype's 3158protected interface portably.</p> 3159 3160<p> 3161The above program assumes that ctype_base::mask enumerators like 3162<tt>space</tt> and <tt>print</tt> are disjoint, and that the way to 3163say that a character is both a space and a printing character is to or 3164those two enumerators together. This is suggested by the "exposition 3165only" values in 22.2.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.category.ctype"> [lib.category.ctype]</a>, but it is nowhere specified in 3166normative text. An alternative interpretation is that the more 3167specific categories subsume the less specific. The above program 3168gives the results it does on the Microsoft compiler because, on that 3169compiler, <tt>print</tt> has all the bits set for each specific 3170printing character class. 3171</p> 3172 3173<p>From the point of view of std::ctype's public interface, there's no 3174important difference between these two techniques. From the point of 3175view of the protected interface, there is. If I'm defining a facet 3176that inherits from std::ctype<char>, I'm the one who defines the 3177value that table()['a'] returns. I need to know what combination of 3178mask values I should use. This isn't so very esoteric: it's exactly 3179why std::ctype has a protected interface. If we care about users 3180being able to write their own ctype facets, we have to give them a 3181portable way to do it. 3182</p> 3183 3184<p> 3185Related reflector messages: 3186lib-9224, lib-9226, lib-9229, lib-9270, lib-9272, lib-9273, lib-9274, 3187lib-9277, lib-9279. 3188</p> 3189 3190<p>Issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#339">339</a> is related, but not identical. The 3191proposed resolution if issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#339">339</a> says that 3192ctype_base::mask must be a bitmask type. It does not say that the 3193ctype_base::mask elements are bitmask elements, so it doesn't 3194directly affect this issue.</p> 3195 3196<p>More comments from Benjamin Kosnik, who believes that 3197that C99 compatibility essentially requires what we're 3198calling option 1 below.</p> 3199 3200<blockquote> 3201<pre>I think the C99 standard is clear, that isspace -> !isalpha. 3202-------- 3203 3204#include <locale> 3205#include <iostream> 3206 3207class my_ctype : public std::ctype<char> 3208{ 3209private: 3210 typedef std::ctype<char> base; 3211 mask my_table[base::table_size]; 3212 3213public: 3214 my_ctype(std::size_t refs = 0) : base(my_table, false, refs) 3215 { 3216 std::copy(base::classic_table(), base::classic_table() + base::table_size, 3217 my_table); 3218 mask both = base::print | base::space; 3219 my_table[static_cast<mask>('_')] = both; 3220 } 3221}; 3222 3223int main() 3224{ 3225 using namespace std; 3226 my_ctype ct; 3227 cout << "isspace: " << ct.is(ctype_base::space, '_') << endl; 3228 cout << "isprint: " << ct.is(ctype_base::print, '_') << endl; 3229 3230 // ISO C99, isalpha iff upper | lower set, and !space. 3231 // 7.5, p 193 3232 // -> looks like g++ behavior is correct. 3233 // 356 -> bitmask elements are required for ctype_base 3234 // 339 -> bitmask type required for mask 3235 cout << "isalpha: " << ct.is(ctype_base::alpha, '_') << endl; 3236} 3237</pre> 3238</blockquote> 3239 3240<p><b>Proposed resolution:</b></p> 3241<p>Informally, we have three choices:</p> 3242<ol> 3243<li>Require that the enumerators are disjoint (except for alnum and 3244graph)</li> 3245<li>Require that the enumerators are not disjoint, and specify which 3246of them subsume which others. (e.g. mandate that lower includes alpha 3247and print)</li> 3248<li>Explicitly leave this unspecified, which the result that the above 3249program is not portable.</li> 3250</ol> 3251 3252<p>Either of the first two options is just as good from the standpoint 3253of portability. Either one will require some implementations to 3254change.</p> 3255<p><b>Rationale:</b></p> 3256<p>The LWG agrees that this is a real ambiguity, and that both 3257interpretations are conforming under the existing standard. However, 3258there's no evidence that it's causing problems for real users. Users 3259who want to define ctype facets portably can test the ctype_base masks 3260to see which interpretation is being used.</p> 3261<hr> 3262<a name="357"><h3>357. <cmath> float functions cannot return HUGE_VAL</h3></a><p><b>Section:</b> 26.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.numarray"> [lib.numarray]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Ray Lischner <b>Date:</b> 26 Feb 2002</p> 3263<p> 3264The float versions of the math functions have no meaningful value to return 3265for a range error. The long double versions have a value they can return, 3266but it isn't necessarily the most reasonable value. 3267</p> 3268 3269<p> 3270Section 26.5 [lib.c.math], paragraph 5, says that C++ "adds float and long 3271double overloaded versions of these functions, with the same semantics," 3272referring to the math functions from the C90 standard. 3273</p> 3274 3275<p> 3276The C90 standard, in section 7.5.1, paragraph 3, says that functions return 3277"the value of the macro HUGE_VAL" when they encounter a range error. 3278Section 7.5, paragraph 2, defines HUGE_VAL as a macro that "expands to a 3279positive double expression, not necessarily representable as a float." 3280</p> 3281 3282<p> 3283Therefore, the float versions of the math functions have no way to 3284signal a range error. <i>[Cura�ao: The LWG notes that this isn't 3285strictly correct, since errno is set.]</i> The semantics require that they 3286return HUGE_VAL, but they cannot because HUGE_VAL might not be 3287representable as a float. 3288</p> 3289 3290<p> 3291The problem with long double functions is less severe because HUGE_VAL is 3292representable as a long double. On the other hand, it might not be a "huge" 3293long double value, and might fall well within the range of normal return 3294values for a long double function. Therefore, it does not make sense for a 3295long double function to return a double (HUGE_VAL) for a range error. 3296</p> 3297<p><b>Proposed resolution:</b></p> 3298<p>Cura�ao: C99 was faced with a similar problem, which they fixed by 3299adding HUGE_VALF and HUGE_VALL in addition to HUGE_VAL.</p> 3300 3301<p>C++ must also fix, but it should be done in the context of the 3302general C99 based changes to C++, not via DR. Thus the LWG in Cura�ao 3303felt the resolution should be NAD, FUTURE, but the issue is being held 3304open for one more meeting to ensure LWG members not present during the 3305discussion concur.</p> 3306<p><b>Rationale:</b></p> 3307<p>Will be fixed as part of more general work in the TR.</p> 3308<hr> 3309<a name="361"><h3>361. num_get<>::do_get (..., void*&) checks grouping</h3></a><p><b>Section:</b> 22.2.2.2.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.facet.num.put.virtuals"> [lib.facet.num.put.virtuals]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 12 Mar 2002</p> 3310<p> 331122.2.2.2.2, p12 specifies that <tt>thousands_sep</tt> is to be inserted only 3312for integral types (issue 282 suggests that this should be done for 3313all arithmetic types). 3314</p> 3315 3316<p> 331722.2.2.1.2, p12 requires that grouping be checked for all extractors 3318including that for <tt>void*</tt>. 3319</p> 3320 3321<p> 3322I don't think that's right. <tt>void*</tt> values should not be checked for 3323grouping, should they? (Although if they should, then <tt>num_put</tt> needs 3324to write them out, otherwise their extraction will fail.) 3325</p> 3326<p><b>Proposed resolution:</b></p> 3327<p> 3328Change the first sentence of 22.2.2.2.2, p12 from 3329</p> 3330<blockquote> 3331 Digit grouping is checked. That is, the positions of discarded 3332 separators is examined for consistency with 3333 use_facet<numpunct<charT> >(loc).grouping(). 3334 If they are not consistent then ios_base::failbit is assigned 3335 to err. 3336</blockquote> 3337 3338<p>to</p> 3339<blockquote> 3340 Except for conversions to void*, digit grouping is checked... 3341</blockquote> 3342 3343<p><b>Rationale:</b></p> 3344<p>This would be a change: as it stands, the standard clearly 3345 specifies that grouping applies to void*. A survey of existing 3346 practice shows that most existing implementations do that, as they 3347 should.</p> 3348<hr> 3349<a name="366"><h3>366. Excessive const-qualification</h3></a><p><b>Section:</b> 27 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.input.output"> [lib.input.output]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown, Marc Paterno <b>Date:</b> 10 May 2002</p> 3350<p> 3351The following member functions are declared const, yet return non-const 3352pointers. We believe they are should be changed, because they allow code 3353that may surprise the user. See document N1360 for details and 3354rationale. 3355</p> 3356 3357<p><i>[Santa Cruz: the real issue is that we've got const member 3358functions that return pointers to non-const, and N1360 proposes 3359replacing them by overloaded pairs. There isn't a consensus about 3360whether this is a real issue, since we've never said what our 3361constness policy is for iostreams. N1360 relies on a distinction 3362between physical constness and logical constness; that distinction, or 3363those terms, does not appear in the standard.]</i></p> 3364 3365<p><b>Proposed resolution:</b></p> 3366<p>In 27.4.4 and 27.4.4.2</p> 3367<p>Replace</p> 3368<pre> basic_ostream<charT,traits>* tie() const; 3369</pre> 3370<p>with</p> 3371<pre> basic_ostream<charT,traits>* tie(); 3372 const basic_ostream<charT,traits>* tie() const; 3373</pre> 3374 3375<p>and replace</p> 3376<pre> basic_streambuf<charT,traits>* rdbuf() const; 3377</pre> 3378<p>with</p> 3379<pre> basic_streambuf<charT,traits>* rdbuf(); 3380 const basic_streambuf<charT,traits>* rdbuf() const; 3381</pre> 3382 3383<p>In 27.5.2 and 27.5.2.3.1</p> 3384<p>Replace</p> 3385<pre> char_type* eback() const; 3386</pre> 3387<p>with</p> 3388<pre> char_type* eback(); 3389 const char_type* eback() const; 3390</pre> 3391 3392<p>Replace</p> 3393<pre> char_type gptr() const; 3394</pre> 3395<p>with</p> 3396<pre> char_type* gptr(); 3397 const char_type* gptr() const; 3398</pre> 3399 3400<p>Replace</p> 3401<pre> char_type* egptr() const; 3402</pre> 3403<p>with</p> 3404<pre> char_type* egptr(); 3405 const char_type* egptr() const; 3406</pre> 3407 3408<p>In 27.5.2 and 27.5.2.3.2</p> 3409<p>Replace</p> 3410<pre> char_type* pbase() const; 3411</pre> 3412<p>with</p> 3413<pre> char_type* pbase(); 3414 const char_type* pbase() const; 3415</pre> 3416 3417<p>Replace</p> 3418<pre> char_type* pptr() const; 3419</pre> 3420<p>with</p> 3421<pre> char_type* pptr(); 3422 const char_type* pptr() const; 3423</pre> 3424 3425<p>Replace</p> 3426<pre> char_type* epptr() const; 3427</pre> 3428<p>with</p> 3429<pre> char_type* epptr(); 3430 const char_type* epptr() const; 3431</pre> 3432 3433<p>In 27.7.2, 27.7.2.2, 27.7.3 27.7.3.2, 27.7.4, and 27.7.6</p> 3434<p>Replace</p> 3435<pre> basic_stringbuf<charT,traits,Allocator>* rdbuf() const; 3436</pre> 3437<p>with</p> 3438<pre> basic_stringbuf<charT,traits,Allocator>* rdbuf(); 3439 const basic_stringbuf<charT,traits,Allocator>* rdbuf() const; 3440</pre> 3441 3442<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> 3443<p>Replace</p> 3444<pre> basic_filebuf<charT,traits>* rdbuf() const; 3445</pre> 3446<p>with</p> 3447<pre> basic_filebuf<charT,traits>* rdbuf(); 3448 const basic_filebuf<charT,traits>* rdbuf() const; 3449</pre> 3450<p><b>Rationale:</b></p> 3451<p>The existing specification is a bit sloppy, but there's no 3452 particular reason to change this other than tidiness, and there are 3453 a number of ways in which streams might have been designed 3454 differently if we were starting today. There's no evidence that the 3455 existing constness policy is harming users. We might consider 3456 a different constness policy as part of a full stream redesign.</p> 3457<hr> 3458<a name="367"><h3>367. remove_copy/remove_copy_if and Input Iterators</h3></a><p><b>Section:</b> 25.2.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.remove"> [lib.alg.remove]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Anthony Williams <b>Date:</b> 13 May 2002</p> 3459<p> 3460remove_copy and remove_copy_if (25.2.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.remove"> [lib.alg.remove]</a>) permit their 3461input range to be marked with Input Iterators. However, since two 3462operations are required against the elements to copy (comparison and 3463assigment), when the input range uses Input Iterators, a temporary 3464copy must be taken to avoid dereferencing the iterator twice. This 3465therefore requires the value type of the InputIterator to be 3466CopyConstructible. If the iterators are at least Forward Iterators, 3467then the iterator can be dereferenced twice, or a reference to the 3468result maintained, so the temporary is not required. 3469</p> 3470<p><b>Proposed resolution:</b></p> 3471<p> 3472Add "If InputIterator does not meet the requirements of forward 3473iterator, then the value type of InputIterator must be copy 3474constructible. Otherwise copy constructible is not required." to 347525.2.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.remove"> [lib.alg.remove]</a> paragraph 6. 3476</p> 3477<p><b>Rationale:</b></p> 3478<p>The assumption is that an input iterator can't be dereferenced 3479 twice. There's no basis for that assumption in the Standard.</p> 3480<hr> 3481<a name="368"><h3>368. basic_string::replace has two "Throws" paragraphs</h3></a><p><b>Section:</b> 21.3.5.6 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::replace"> [lib.string::replace]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Beman Dawes <b>Date:</b> 3 Jun 2002</p> 3482<p> 348321.3.5.6 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::replace"> [lib.string::replace]</a> basic_string::replace, second 3484signature, given in paragraph 1, has two "Throws" paragraphs (3 and 34855). 3486</p> 3487 3488<p> 3489In addition, the second "Throws" paragraph (5) includes specification 3490(beginning with "Otherwise, the function replaces ...") that should be 3491part of the "Effects" paragraph. 3492</p> 3493<p><b>Proposed resolution:</b></p> 3494<p><b>Rationale:</b></p> 3495<p>This is editorial. Both "throws" statements are true. The bug is 3496 just that the second one should be a sentence, part of the "Effects" 3497 clause, not a separate "Throws". The project editor has been 3498 notified.</p> 3499<hr> 3500<a name="372"><h3>372. Inconsistent description of stdlib exceptions</h3></a><p><b>Section:</b> 17.4.4.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.res.on.exception.handling"> [lib.res.on.exception.handling]</a>, 18.6.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.type.info"> [lib.type.info]</a>, <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Randy Maddox <b>Date:</b> 22 Jul 2002</p> 3501 3502<p>Paragraph 3 under clause 17.4.4.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-intro.html#lib.res.on.exception.handling"> [lib.res.on.exception.handling]</a>, Restrictions on 3503Exception Handling, states that "Any other functions defined in the 3504C++ Standard Library that do not have an exception-specification may 3505throw implementation-defined exceptions unless otherwise specified." 3506This statement is followed by a reference to footnote 178 at the 3507bottom of that page which states, apparently in reference to the C++ 3508Standard Library, that "Library implementations are encouraged (but 3509not required) to report errors by throwing exceptions from (or derived 3510from) the standard exceptions."</p> 3511 3512<p>These statements appear to be in direct contradiction to clause 351318.6.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.type.info"> [lib.type.info]</a>, which states "The class exception defines the 3514base class for the types of objects thrown as exceptions by the C++ 3515Standard library components ...".</p> 3516 3517<p>Is this inconsistent?</p> 3518 3519<p><b>Proposed resolution:</b></p> 3520<p><b>Rationale:</b></p> 3521<p>Clause 17 is setting the overall library requirements, and it's 3522 clear and consistent. This sentence from Clause 18 is descriptive, 3523 not setting a requirement on any other class. 3524</p> 3525<hr> 3526<a name="374"><h3>374. moneypunct::frac_digits returns int not unsigned</h3></a><p><b>Section:</b> 22.2.6.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.moneypunct.members"> [lib.locale.moneypunct.members]</a>, 22.2.6.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.moneypunct.virtuals"> [lib.locale.moneypunct.virtuals]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Ray Lischner <b>Date:</b> 8 Aug 2002</p> 3527<p> 3528In section 22.2.6.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.moneypunct.members"> [lib.locale.moneypunct.members]</a>, frac_digits() returns type 3529"int". This implies that frac_digits() might return a negative value, 3530but a negative value is nonsensical. It should return "unsigned". 3531</p> 3532 3533<p> 3534Similarly, in section 22.2.6.3.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.moneypunct.virtuals"> [lib.locale.moneypunct.virtuals]</a>, do_frac_digits() 3535should return "unsigned". 3536</p> 3537 3538<p><b>Proposed resolution:</b></p> 3539<p><b>Rationale:</b></p> 3540<p>Regardless of whether the return value is int or unsigned, it's 3541always conceivable that frac_digits might return a nonsensical 3542value. (Is 4294967295 really any better than -1?) The clients of 3543moneypunct, the get and put facets, can and do perform range 3544checks.</p> 3545<hr> 3546<a name="377"><h3>377. basic_string::insert and length_error</h3></a><p><b>Section:</b> 21.3.5.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::insert"> [lib.string::insert]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Ray Lischner <b>Date:</b> 16 Aug 2002</p> 3547<p> 3548Section 21.3.5.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-strings.html#lib.string::insert"> [lib.string::insert]</a>, paragraph 4, contains the following, 3549"Then throws length_error if size() >= npos - rlen." 3550</p> 3551 3552<p> 3553Related to DR 83, this sentence should probably be removed. 3554</p> 3555<p><b>Proposed resolution:</b></p> 3556<p><b>Rationale:</b></p> 3557<p>This requirement is redundant but correct. No change is 3558needed.</p> 3559<hr> 3560<a name="378"><h3>378. locale immutability and locale::operator=()</h3></a><p><b>Section:</b> 22.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale"> [lib.locale]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 6 Sep 2002</p> 3561<p> 3562I think there is a problem with 22.1.1, p6 which says that 3563</p> 3564<pre> -6- An instance of locale is immutable; once a facet reference 3565 is obtained from it, that reference remains usable as long 3566 as the locale value itself exists. 3567</pre> 3568<p> 3569and 22.1.1.2, p4: 3570</p> 3571<pre> const locale& operator=(const locale& other) throw(); 3572 3573 -4- Effects: Creates a copy of other, replacing the current value. 3574</pre> 3575<p> 3576How can a reference to a facet obtained from a locale object remain 3577valid after an assignment that clearly must replace all the facets 3578in the locale object? Imagine a program such as this 3579</p> 3580<pre> std::locale loc ("de_DE"); 3581 const std::ctype<char> &r0 = std::use_facet<std::ctype<char> >(loc); 3582 loc = std::locale ("en_US"); 3583 const std::ctype<char> &r1 = std::use_facet<std::ctype<char> >(loc); 3584</pre> 3585<p> 3586Is r0 really supposed to be preserved and destroyed only when loc goes 3587out of scope? 3588</p> 3589<p><b>Proposed resolution:</b></p> 3590<p><i>[Summer '04 mid-meeting mailing: Martin and Dietmar believe this 3591 is a duplicate of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#31">31</a> and recommend that it be 3592 closed. 3593]</i></p> 3594 3595<hr> 3596<a name="388"><h3>388. Use of complex as a key in associative containers</h3></a><p><b>Section:</b> 26.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.cfenv"> [lib.cfenv]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Gabriel Dos Reis <b>Date:</b> 8 Nov 2002</p> 3597<p> 3598Practice with std::complex<> and the associative containers 3599occasionally reveals artificial and distracting issues with constructs 3600resembling: std::set<std::complex<double> > s; 3601</p> 3602 3603<p> 3604The main reason for the above to fail is the absence of an approriate 3605definition for std::less<std::complex<T> >. That in turn comes from 3606the definition of the primary template std::less<> in terms of 3607operator<. 3608</p> 3609 3610<p> 3611The usual argument goes as follows: Since there is no ordering over 3612the complex field compatible with field operations it makes little 3613sense to define a function operator< operating on the datatype 3614std::complex<T>. That is fine. However, that reasoning does not carry 3615over to std::less<T> which is used, among other things, by associative 3616containers as an ordering useful to meet complexity requirements. 3617</p> 3618 3619<p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#348">348</a>.</p> 3620 3621<p><b>Proposed resolution:</b></p> 3622<p>Informally: Add a specialization of std::less for std::complex.</p> 3623<p><b>Rationale:</b></p> 3624<p>Discussed in Santa Cruz. An overwhelming majority of the LWG 3625believes this should not be treated a DR: it's a request for a design 3626change, not a defect in the existing standard. Most people (10-3) 3627believed that we probably don't want this change, period: as with 3628issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#348">348</a>, it's hard to know where to draw the line. 3629The LWG noted that users who want to put objects into an associative 3630container for which <tt>operator<</tt> isn't defined can simply 3631provide their own comparison function object.</p> 3632<hr> 3633<a name="390"><h3>390. CopyConstructible requirements too strict</h3></a><p><b>Section:</b> 20.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.copyconstructible"> [lib.copyconstructible]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Future">Future</a> <b>Submitter:</b> Doug Gregor <b>Date:</b> 24 Oct 2002</p> 3634<p> 3635The CopyConstructible requirements in Table 30 state that for an 3636object t of type T (where T is CopyConstructible), the expression &t 3637returns the address of t (with type T*). This requirement is overly 3638strict, in that it disallows types that overload operator& to not 3639return a value of type T*. This occurs, for instance, in the <a href="http://www.boost.org/libs/lambda">Boost.Lambda</a> library, where 3640operator& is overloaded for a Boost.Lambda function object to return 3641another function object. 3642</p> 3643 3644<p>Example:</p> 3645 3646<pre> std::vector<int> u, v; 3647 int x; 3648 // ... 3649 std::transform(u.begin(), u.end(), std::back_inserter(v), _1 * x); 3650</pre> 3651 3652<p> 3653_1 * x returns an unnamed function object with operator& overloaded to 3654not return T* , therefore rendering the std::transform call ill-formed. 3655However, most standard library implementations will compile this code 3656properly, and the viability of such binder libraries is severely hindered 3657by the unnecessary restriction in the CopyConstructible requirements. 3658</p> 3659 3660<p> 3661For reference, the address of an object can be retrieved without using 3662the address-of operator with the following function template: 3663</p> 3664 3665<pre> template <typename T> T* addressof(T& v) 3666 { 3667 return reinterpret_cast<T*>( 3668 &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); 3669 } 3670</pre> 3671 3672<p> 3673Note: this relates directly to library issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#350">350</a>, which 3674will need to be reexamined if the CopyConstructible requirements 3675change. 3676</p> 3677<p><b>Proposed resolution:</b></p> 3678<p> 3679Remove the last two rows of Table 30, eliminating the requirements 3680that &t and &u return the address of t and u, respectively. 3681</p> 3682<p><b>Rationale:</b></p> 3683<p>This was a deliberate design decision. Perhaps it should be 3684 reconsidered for C++0x. </p> 3685<hr> 3686<a name="392"><h3>392. 'equivalence' for input iterators</h3></a><p><b>Section:</b> 24.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.input.iterators"> [lib.input.iterators]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Corwin Joy <b>Date:</b> 11 Dec 2002</p> 3687 3688<p> 3689In section 24.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.input.iterators"> [lib.input.iterators]</a> table 72 - 3690'Input Iterator Requirements' we have as a postcondition of *a: 3691"If a==b and (a, b) is in the domain of == then *a is equivalent to *b". 3692</p> 3693 3694<p> 3695In section 24.5.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.istreambuf.iterator::equal"> [lib.istreambuf.iterator::equal]</a> it states that 3696"istreambuf_iterator::equal returns true if and only if both iterators 3697are at end-of-stream, or neither is at end-of-stream, <i>regardless of 3698what streambuf object they use</i>." (My emphasis). 3699</p> 3700 3701<p> 3702The defect is that either 'equivalent' needs to be more precisely 3703defined or the conditions for equality in 24.5.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.istreambuf.iterator::equal"> [lib.istreambuf.iterator::equal]</a> 3704are incorrect. (Or both). 3705</p> 3706 3707<p>Consider the following example:</p> 3708<pre> #include <iostream> 3709 #include <fstream> 3710 #include <iterator> 3711 using namespace std; 3712 3713 int main() { 3714 ifstream file1("file1.txt"), file2("file2.txt"); 3715 istreambuf_iterator<char> f1(file1), f2(file2); 3716 cout << "f1 == f2 : " << boolalpha << (f1 == f2) << endl; 3717 cout << "f1 = " << *f1 << endl; 3718 cout << "f2 = " << *f2 << endl; 3719 return 0; 3720 } 3721</pre> 3722 3723<p>Now assuming that neither f1 or f2 are at the end-of-stream then 3724f1 == f2 by 24.5.3.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.istreambuf.iterator::equal"> [lib.istreambuf.iterator::equal]</a>.</p> 3725 3726<p>However, it is unlikely that *f1 will give the same value as *f2 except 3727by accident.</p> 3728 3729<p>So what does *f1 'equivalent' to *f2 mean? I think the standard should 3730be clearer on this point, or at least be explicit that this does not 3731mean that *f1 and *f2 are required to have the same value in the case 3732of input iterators.</p> 3733<p><b>Proposed resolution:</b></p> 3734<p><b>Rationale:</b></p> 3735<p>The two iterators aer not in the domain of ==</p> 3736<hr> 3737<a name="399"><h3>399. volations of unformatted input function requirements</h3></a><p><b>Section:</b> 27.6.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.istream.unformatted"> [lib.istream.unformatted]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 5 Jan 2003</p> 3738 <p> 3739The Effects clauses for the two functions below violate the 3740general requirements on unformatted input functions outlined 3741in 27.6.1.3: they do not begin by constructing a sentry object. 3742Instead, they begin by calling widen ('\n'), which may throw 3743an exception. The exception is then allowed to propagate from 3744the unformatted input function irrespective of the setting of 3745exceptions(). 3746 </p> 3747 <p> 3748Note that in light of 27.6.1.1, p3 and p4, the fact that the 3749functions allow exceptions thrown from widen() to propagate 3750may not strictly speaking be a defect (but the fact that the 3751functions do not start by constructing a sentry object still 3752is). However, since an exception thrown from ctype<charT> 3753::widen() during any other input operation (say, from within 3754a call to num_get<charT>::get()) will be caught and cause 3755badbit to be set, these two functions should not be treated 3756differently for the sake of consistency. 3757 </p> 3758 <p><b>Proposed resolution:</b></p> 3759<p><b>Rationale:</b></p> 3760<p> 3761Not a defect. The standard is consistent, and the behavior required 3762by the standard is unambiguous. Yes, it's theoretically possible for 3763widen to throw. (Not that this will happen for the default ctype 3764facet or for most real-world replacement ctype facets.) Users who 3765define ctype facets that can throw, and who care about this behavior, 3766can use alternative signatures that don't call widen. 3767</p> 3768<hr> 3769<a name="429"><h3>429. typo in basic_ios::clear(iostate)</h3></a><p><b>Section:</b> 27.4.4.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.iostate.flags"> [lib.iostate.flags]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 18 Sep 2003</p> 3770 <p> 3771 3772The Effects clause in 27.4.4.3, p5 describing the effects of a call to 3773the ios_base member function clear(iostate state) says that the function 3774only throws if the respective bits are already set prior to the function 3775call. That's obviously not the intent. If it was, a call to clear(badbit) 3776on an object for which (rdstate() == goodbit && exceptions() == badbit) 3777holds would not result in an exception being thrown. 3778 3779 </p> 3780 <p><b>Proposed resolution:</b></p> 3781 <p> 3782 3783The text ought to be changed from 3784<br> 3785 3786"If (rdstate() & exceptions()) == 0, returns. ..." 3787<br> 3788 3789to 3790<br> 3791 3792"If (state & exceptions()) == 0, returns. ..." 3793 </p> 3794<p><b>Rationale:</b></p> 3795<p>This is a duplicate of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#412">412</a>.</p> 3796<hr> 3797<a name="433"><h3>433. Contradiction in specification of unexpected()</h3></a><p><b>Section:</b> 18.7.2.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.unexpected"> [lib.unexpected]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Vyatcheslav Sysoltsev <b>Date:</b> 29 Sep 2003</p> 3798<p> 3799Clause 15.5.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/except.html#except.unexpected"> [except.unexpected]</a> paragraph 1 says that "void unexpected(); 3800is called (18.7.2) immediately after completing the stack unwinding 3801for the former function", but 18.7.2.4 (Effects) says that "void 3802unexpected(); . . . Calls the unexpected_handler function in effect 3803immediately after evaluating the throwexpression (18.7.2.2),". Isn't 3804here a contradiction: 15.5.2 requires stack have been unwound when in 3805void unexpected() and therefore in unexpected_handler but 18.7.2.4 3806claims that unexpected_handler is called "in effect immediately" after 3807evaluation of throw expression is finished, so there is no space left 3808for stack to be unwound therefore? I think the phrase "in effect 3809immediately" should be removed from the standard because it brings 3810ambiguity in understanding. 3811</p> 3812<p><b>Proposed resolution:</b></p> 3813<p><b>Rationale:</b></p> 3814<p>There is no contradiction. The phrase "in effect immediately" is 3815 just to clarify which handler is to be called.</p> 3816<hr> 3817<a name="437"><h3>437. Formatted output of function pointers is confusing</h3></a><p><b>Section:</b> 27.6.2.5.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.ostream.inserters.arithmetic"> [lib.ostream.inserters.arithmetic]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Ivan Godard <b>Date:</b> 24 Oct 2003</p> 3818<p> 3819Given: 3820</p> 3821<pre>void f(int) {} 3822void(*g)(int) = f; 3823cout << g; 3824</pre> 3825 3826<p> 3827(with the expected #include and usings), the value printed is a rather 3828surprising "true". Rather useless too. 3829</p> 3830 3831<p>The standard defines:</p> 3832 3833<pre>ostream& operator<<(ostream&, void*);</pre> 3834 3835<p>which picks up all data pointers and prints their hex value, but does 3836not pick up function pointers because there is no default conversion 3837from function pointer to void*. Absent that, we fall back to legacy 3838conversions from C and the function pointer is converted to bool. 3839</p> 3840 3841<p>There should be an analogous inserter that prints the address of a 3842 function pointer.</p> 3843<p><b>Proposed resolution:</b></p> 3844<p><b>Rationale:</b></p> 3845<p>This is indeed a wart, but there is no good way to solve it. C 3846 doesn't provide a portable way of outputting the address of a 3847 function point either.</p> 3848<hr> 3849<a name="439"><h3>439. Should facets be copyable?</h3></a><p><b>Section:</b> 22.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.categories"> [lib.locale.categories]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 2 Nov 2003</p> 3850<p>The following facets classes have no copy constructors described in 3851 the standard, which, according to the standard, means that they are 3852 supposed to use the compiler-generated defaults. Default copy 3853 behavior is probably inappropriate. We should either make these 3854 classes uncopyable or else specify exactly what their constructors do.</p> 3855 3856<p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#421">421</a>.</p> 3857 3858<pre> ctype_base 3859 ctype 3860 ctype_byname 3861 ctype<char> 3862 ctype_byname<char> 3863 codecvt_base 3864 codecvt 3865 codecvt_byname 3866 num_get 3867 num_put 3868 numpunct 3869 numpunct_byname 3870 collate 3871 collate_byname 3872 time_base 3873 time_get 3874 time_get_byname 3875 time_put 3876 time_put_byname 3877 money_get 3878 money_put 3879 money_base 3880 moneypunct 3881 moneypunct_byname 3882 messages_base 3883 messages 3884 messages_byname 3885</pre> 3886 3887<p><b>Proposed resolution:</b></p> 3888<p><b>Rationale:</b></p> 3889<p>The copy constructor in the base class is private.</p> 3890<hr> 3891<a name="440"></a><h3><a name="440">440. Should std::complex use unqualified transcendentals?</a></h3><p><b>Section:</b> 26.3.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.transcendentals"> [lib.complex.transcendentals]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 5 Nov 2003</p> 3892<p> 3893Operations like <tt>pow</tt> and <tt>exp</tt> on 3894<tt>complex<T></tt> are typically implemented in terms of 3895operations like <tt>sin</tt> and <tt>cos</tt> on <tt>T</tt>. 3896Should implementations write this as <tt>std::sin</tt>, or as plain 3897unqualified <tt>sin</tt>? 3898</p> 3899 3900<p>The issue, of course, is whether we want to use 3901argument-dependent lookup in the case where <tt>T</tt> is a 3902user-defined type. This is similar to the issue of valarray 3903transcendentals, as discussed in issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#226">226</a>.</p> 3904 3905<p>This issue differs from valarray transcendentals in two important 3906ways. First, "the effect of instantiating the template 3907<tt>complex</tt> for types other than float, double or long double is 3908unspecified." (26.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-numerics.html#lib.complex.synopsis"> [lib.complex.synopsis]</a>) Second, the standard does not 3909dictate implementation, so there is no guarantee that a particular 3910real math function is used in the implementation of a particular 3911complex function.</p> 3912 3913<p><b>Proposed resolution:</b></p> 3914<p><b>Rationale:</b></p> 3915<p>If you instantiate std::complex for user-defined types, all bets 3916are off.</p> 3917<hr> 3918<a name="447"><h3>447. Wrong template argument for time facets</h3></a><p><b>Section:</b> 22.1.1.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.category"> [lib.locale.category]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Pete Becker <b>Date:</b> 26 Dec 2003</p> 3919<p> 392022.1.1.1.1/4, table 52, "Required Instantiations", lists, among others: 3921</p> 3922<pre> time_get<char,InputIterator> 3923 time_get_byname<char,InputIterator> 3924 time_get<wchar_t,OutputIterator> 3925 time_get_byname<wchar_t,OutputIterator> 3926</pre> 3927 3928<p> 3929The second argument to the last two should be InputIterator, not 3930OutputIterator. 3931</p> 3932<p><b>Proposed resolution:</b></p> 3933<p> 3934Change the second template argument to InputIterator. 3935</p> 3936<p><b>Rationale:</b></p> 3937Duplicate of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#327">327</a> 3938<hr> 3939<a name="450"><h3>450. set::find is inconsistent with associative container requirements</h3></a><p><b>Section:</b> 23.3.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.set"> [lib.set]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Bill Plauger <b>Date:</b> 30 Jan 2004</p> 3940<p>map/multimap have:</p> 3941 3942<pre> iterator find(const key_type& x) const; 3943 const_iterator find(const key_type& x) const; 3944</pre> 3945 3946<p> 3947which is consistent with the table of associative container requirements. 3948But set/multiset have: 3949</p> 3950<pre> iterator find(const key_type&) const; 3951</pre> 3952 3953<p> 3954set/multiset should look like map/multimap, and honor the requirements 3955table, in this regard. 3956</p> 3957<p><b>Proposed resolution:</b></p> 3958<p><b>Rationale:</b></p> 3959<p>Duplicate of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#214">214</a>.</p> 3960<hr> 3961<a name="451"><h3>451. Associative erase should return an iterator</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a>, 23.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative"> [lib.associative]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Bill Plauger <b>Date:</b> 30 Jan 2004</p> 3962<p>map/multimap/set/multiset have:</p> 3963<pre> void erase(iterator); 3964 void erase(iterator, iterator); 3965</pre> 3966 3967<p>But there's no good reason why these can't return an iterator, as for 3968vector/deque/list:</p> 3969<pre> iterator erase(iterator); 3970 iterator erase(iterator, iterator); 3971</pre> 3972 3973<p><b>Proposed resolution:</b></p> 3974<p> 3975Informally: The table of associative container requirements, and the 3976relevant template classes, should return an iterator designating the 3977first element beyond the erased subrange. 3978</p> 3979<p><b>Rationale:</b></p> 3980<p>Duplicate of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#130">130</a></p> 3981<hr> 3982<a name="452"><h3>452. locale::combine should be permitted to generate a named locale</h3></a><p><b>Section:</b> 22.1.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.members"> [lib.locale.members]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Bill Plauger <b>Date:</b> 30 Jan 2004</p> 3983<pre>template<class Facet> 3984 locale::combine(const locale&) const; 3985</pre> 3986<p> 3987is obliged to create a locale that has no name. This is overspecification 3988and overkill. The resulting locale should follow the usual rules -- it 3989has a name if the locale argument has a name and Facet is one of the 3990standard facets. 3991</p> 3992 3993<p><i>[ 3994 Sydney and post-Sydney (see c++std-lib-13439, c++std-lib-13440, 3995 c++std-lib-13443): agreed that it's overkill to say that the locale 3996 is obligated to be nameless. However, we also can't require it to 3997 have a name. At the moment, locale names are based on categories 3998 and not on individual facets. If a locale contains two different 3999 facets of different names from the same category, then this would 4000 not fit into existing naming schemes. We need to give 4001 implementations more freedom. Bill will provide wording. 4002]</i></p> 4003 4004<p><b>Proposed resolution:</b></p> 4005<p><b>Rationale:</b></p> 4006<p>After further discussion the LWG decided to close this as NAD. 4007 The fundamental problem is that names right now are per-category, 4008 not per-facet. The <tt>combine</tt> member function works at the 4009 wrong level of granularity.</p> 4010<hr> 4011<a name="472"><h3>472. Missing "Returns" clause in std::equal_range</h3></a><p><b>Section:</b> 25.3.3.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.equal.range"> [lib.equal.range]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Prateek R Karandikar <b>Date:</b> 29 Feb 1900</p> 4012<p> 4013There is no "Returns:" clause for std::equal_range, which returns non-void. 4014</p> 4015<p><b>Proposed resolution:</b></p> 4016<p><b>Rationale:</b></p> 4017<p>Fixed as part of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#270">270</a>.</p> 4018<hr> 4019<a name="476"><h3>476. Forward Iterator implied mutability</h3></a><p><b>Section:</b> 24.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.forward.iterators"> [lib.forward.iterators]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Dave Abrahams <b>Date:</b> 9 Jul 2004</p> 4020 4021<p>24.1/3 says:</p> 4022<blockquote> 4023 Forward iterators satisfy all the requirements of the input and 4024 output iterators and can be used whenever either kind is specified 4025</blockquote> 4026 4027<p> 4028The problem is that satisfying the requirements of output iterator 4029means that you can always assign *something* into the result of 4030dereferencing it. That makes almost all non-mutable forward 4031iterators non-conforming. I think we need to sever the refinement 4032relationship between forward iterator and output iterator. 4033</p> 4034 4035<p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#200">200</a>. But this is not a dup.</p> 4036 4037<p><b>Proposed resolution:</b></p> 4038<p><b>Rationale:</b></p> 4039<p>Yes, 24.1/3 does say that. But it's introductory material. The 4040precise specification is in 24.1.3, and the requrements table there is 4041right. We don't need to fine-tune introductory wording. (Especially 4042since this wording is likely to be changed as part of the iterator 4043overhaul.)</p> 4044<hr> 4045<a name="477"><h3>477. Operator-> for const forward iterators</h3></a><p><b>Section:</b> 24.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.forward.iterators"> [lib.forward.iterators]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dave Abrahams <b>Date:</b> 11 Jul 2004</p> 4046<p> 4047The Forward Iterator requirements table contains the following: 4048</p> 4049<pre> expression return type operational precondition 4050 semantics 4051 ========== ================== =========== ========================== 4052 a->m U& if X is mutable, (*a).m pre: (*a).m is well-defined. 4053 otherwise const U& 4054 4055 r->m U& (*r).m pre: (*r).m is well-defined. 4056</pre> 4057 4058<p> 4059The first line is exactly right. The second line is wrong. Basically 4060it implies that the const-ness of the iterator affects the const-ness 4061of referenced members. But Paragraph 11 of [lib.iterator.requirements] says: 4062</p> 4063 4064<blockquote> 4065 In the following sections, a and b denote values of type const X, n 4066 denotes a value of the difference type Distance, u, tmp, and m 4067 denote identifiers, r denotes a value of X&, t denotes a value of 4068 value type T, o denotes a value of some type that is writable to 4069 the output iterator. 4070</blockquote> 4071 4072<p>AFAICT if we need the second line at all, it should read the same 4073as the first line.</p> 4074 4075<p>Related issue: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#478">478</a></p> 4076<p><b>Proposed resolution:</b></p> 4077<p><b>Rationale:</b></p> 4078<p>The LWG agrees that this is a real problem. Marked as a DUP 4079 because the LWG chose to adopt the solution proposed in 4080 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#478">478</a>. 4081</p> 4082<hr> 4083<a name="480"><h3>480. unary_function and binary_function should have protected nonvirtual destructors</h3></a><p><b>Section:</b> 20.3.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.tuple.tuple"> [lib.tuple.tuple]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Joe Gottman <b>Date:</b> 19 Aug 2004</p> 4084<p>The classes std::unary_function and std::binary_function are both 4085designed to be inherited from but contain no virtual functions. This 4086makes it too easy for a novice programmer to write code like 4087binary_function<int, int, int> *p = new plus<int>; delete p;</p> 4088 4089<p>There are two common ways to prevent this source of undefined 4090behavior: give the base class a public virtual destructor, or give it 4091a protected nonvirtual destructor. Since unary_function and 4092binary_function have no other virtual functions, (note in particular 4093the absence of an operator()() ), it would cost too much to give them 4094public virtual destructors. Therefore, they should be given protected 4095nonvirtual destructors.</p> 4096<p><b>Proposed resolution:</b></p> 4097<p>Change Paragraph 20.3.1 of the Standard from</p> 4098<pre> template <class Arg, class Result> 4099 struct unary_function { 4100 typedef Arg argument_type; 4101 typedef Result result_type; 4102 }; 4103 4104 template <class Arg1, class Arg2, class Result> 4105 struct binary_function { 4106 typedef Arg1 first_argument_type; 4107 typedef Arg2 second_argument_type; 4108 typedef Result result_type; 4109 }; 4110</pre> 4111 4112<p>to</p> 4113<pre> template <class Arg, class Result> 4114 struct unary_function { 4115 typedef Arg argument_type; 4116 typedef Result result_type; 4117 protected: 4118 ~unary_function() {} 4119 }; 4120 4121 template <class Arg1, class Arg2, class Result> 4122 struct binary_function { 4123 typedef Arg1 first_argument_type; 4124 typedef Arg2 second_argument_type; 4125 typedef Result result_type; 4126 protected: 4127 ~binary_function() {} 4128 }; 4129</pre> 4130<p><b>Rationale:</b></p> 4131<p>The LWG doesn't believe the existing definition causes anybody any 4132 concrete harm.</p> 4133<hr> 4134<a name="481"><h3>481. unique's effects on the range [result, last)</h3></a><p><b>Section:</b> 25.2.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.unique"> [lib.alg.unique]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Andrew Koenig <b>Date:</b> 30 Aug 2004</p> 4135<p> 4136The standard says that unique(first, last) "eliminates all but the 4137first element from every consecutive group of equal elements" in 4138[first, last) and returns "the end of the resulting range". So a 4139postcondition is that [first, result) is the same as the old [first, 4140last) except that duplicates have been eliminated. 4141</p> 4142 4143<p>What postconditions are there on the range [result, last)? One 4144 might argue that the standard says nothing about those values, so 4145 they can be anything. One might also argue that the standard 4146 doesn't permit those values to be changed, so they must not be. 4147 Should the standard say something explicit one way or the other?</p> 4148 4149<p><b>Proposed resolution:</b></p> 4150<p> 4151</p> 4152<p><b>Rationale:</b></p> 4153<p>We don't want to make many guarantees about what's in [result, 4154end). Maybe we aren't being quite explicit enough about not being 4155explicit, but it's hard to think that's a major problem.</p> 4156<hr> 4157<a name="483"><h3>483. Heterogeneous equality and EqualityComparable</h3></a><p><b>Section:</b> 25.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.nonmodifying"> [lib.alg.nonmodifying]</a>, 25.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.modifying.operations"> [lib.alg.modifying.operations]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Peter Dimov <b>Date:</b> 20 Sep 2004</p> 4158<p>c++std-lib-14262</p> 4159 4160<p>[lib.alg.find] requires T to be EqualityComparable:</p> 4161 4162<pre>template <class InputIterator, class T> 4163 InputIterator find(InputIterator first, InputIterator last, 4164 const T& value); 4165</pre> 4166 4167<p> 4168However the condition being tested, as specified in the Effects 4169clause, is actually *i == value, where i is an InputIterator. 4170</p> 4171 4172<p> 4173The two clauses are in agreement only if the type of *i is T, but this 4174isn't necessarily the case. *i may have a heterogeneous comparison 4175operator that takes a T, or a T may be convertible to the type of *i. 4176</p> 4177 4178<p>Further discussion (c++std-lib-14264): this problem affects a 4179 number of algorithsm in clause 25, not just <tt>find</tt>. We 4180 should try to resolve this problem everywhere it appears.</p> 4181<p><b>Proposed resolution:</b></p> 4182 4183<p>[lib.alg.find]:</p> 4184<blockquote> 4185 Remove [lib.alg.find]/1. 4186</blockquote> 4187 4188<p>[lib.alg.count]:</p> 4189<blockquote> 4190 Remove [lib.alg.count]/1. 4191</blockquote> 4192 4193<p>[lib.alg.search]:</p> 4194<blockquote> 4195 Remove "Type T is EqualityComparable (20.1.1), " from [lib.alg.search]/4. 4196</blockquote> 4197 4198<p>[lib.alg.replace]:</p> 4199 4200<blockquote> 4201 <p> 4202 Remove [lib.alg.replace]/1. 4203 Replace [lb.alg.replace]/2 with: 4204 </p> 4205 4206 <blockquote> 4207 For every iterator i in the range [first, last) for which *i == value 4208 or pred(*i) holds perform *i = new_value. 4209 </blockquote> 4210 4211 <p> 4212 Remove the first sentence of /4. 4213 Replace the beginning of /5 with: 4214 </p> 4215 4216 <blockquote> 4217 For every iterator i in the range [result, result + (last - 4218 first)), assign to *i either... 4219 </blockquote> 4220 4221 <p>(Note the defect here, current text says assign to i, not *i).</p> 4222</blockquote> 4223 4224<p>[lib.alg.fill]:</p> 4225 4226<blockquote> 4227 <p> 4228 Remove "Type T is Assignable (23.1), " from /1. 4229 Replace /2 with: 4230 </p> 4231 4232 <blockquote> 4233 For every iterator i in the range [first, last) or [first, first + n), 4234 perform *i = value. 4235 </blockquote> 4236</blockquote> 4237 4238<p>[lib.alg.remove]:</p> 4239<blockquote> 4240 Remove /1. 4241 Remove the first sentence of /6. 4242</blockquote> 4243 4244<p><b>Rationale:</b></p> 4245<p>Duplicate of (a subset of) issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#283">283</a>.</p> 4246<hr> 4247<a name="486"><h3>486. min/max CopyConstructible requirement is too strict</h3></a><p><b>Section:</b> 25.3.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.min.max"> [lib.alg.min.max]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Dave Abrahams <b>Date:</b> 13 Oct 2004</p> 4248<p>A straightforward implementation of these algorithms does not need to 4249copy T.</p> 4250<p><b>Proposed resolution:</b></p> 4251<p>drop the the words "and CopyConstructible" from paragraphs 1 and 4</p> 4252<p><b>Rationale:</b></p> 4253<p>Dup of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#281">281</a>.</p> 4254<hr> 4255<a name="487"><h3>487. Allocator::construct is too limiting</h3></a><p><b>Section:</b> 20.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.default.con.req"> [lib.default.con.req]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Dhruv Matani <b>Date:</b> 17 Oct 2004</p> 4256<p> 4257The standard's version of allocator::construct(pointer, 4258const_reference) severely limits what you can construct using this 4259function. Say you can construct a socket from a file descriptor. Now, 4260using this syntax, I first have to manually construct a socket from 4261the fd, and then pass the constructed socket to the construct() 4262function so it will just to an uninitialized copy of the socket I 4263manually constructed. Now it may not always be possible to copy 4264construct a socket eh! So, I feel that the changes should go in the 4265allocator::construct(), making it: 4266</p> 4267<pre> template<typename T> 4268 struct allocator{ 4269 template<typename T1> 4270 void construct(pointer T1 const& rt1); 4271 }; 4272</pre> 4273 4274<p> 4275Now, the ctor of the class T which matches the one that takes a T1 can 4276be called! Doesn't that sound great? 4277</p> 4278<p><b>Proposed resolution:</b></p> 4279<p><b>Rationale:</b></p> 4280<p>NAD. STL uses copying all the time, and making it possible for 4281 allocators to construct noncopyable objects is useless in the 4282 absence of corresponding container changes. We might consider this 4283 as part of a larger redesign of STL.</p> 4284<hr> 4285<a name="489"><h3>489. std::remove / std::remove_if wrongly specified</h3></a><p><b>Section:</b> 25.2.7 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.remove"> [lib.alg.remove]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Thomas Mang <b>Date:</b> 12 Dec 2004</p> 4286<p>In Section 25.2.7 [lib.alg.remove], paragraphs 1 to 5 describe the 4287behavior of the mutating sequence operations std::remove and 4288std::remove_if. However, the wording does not reflect the intended 4289behavior [Note: See definition of intended behavior below] of these 4290algorithms, as it is known to the C++ community [1]. 4291</p> 4292 4293 4294 4295<p>1) Analysis of current wording:</p> 4296 4297 4298<p>25.2.7 [lib.alg.remove], paragraph 2:</p> 4299 4300<p>Current wording says: 4301"Effects: Eliminates all the elements referred to by iterator i in the 4302range [first, last) for which the following corresponding conditions 4303hold: *i == value, pred(*i) != false."</p> 4304 4305<p> 4306This sentences expresses specifically that all elements denoted by the 4307(original) range [first, last) for which the corresponding condition 4308hold will be eliminated. Since there is no formal definition of the term 4309"eliminate" provided, the meaning of "eliminate" in everyday language 4310implies that as postcondition, no element in the range denoted by 4311[first, last) will hold the corresponding condition on reiteration over 4312the range [first, last). 4313</p> 4314 4315<p> 4316However, this is neither the intent [Note: See definition of intended 4317behavior below] nor a general possible approach. It can be easily proven 4318that if all elements of the original range[first, last) will hold the 4319condition, it is not possible to substitute them by an element for which 4320the condition will not hold. 4321</p> 4322 4323 4324<p>25.2.7 [lib.alg.remove], paragraph 3:</p> 4325 4326<p> 4327Current wording says: 4328"Returns: The end of the resulting range." 4329</p> 4330 4331<p> 4332The resulting range is not specified. In combination with 25.2.7 4333[lib.alg.remove], paragraph 2, the only reasonable interpretation of 4334this so-called resulting range is the range [first,last) - thus 4335returning always the ForwardIterator 'last' parameter. 4336</p> 4337 4338 4339<p> 434025.2.7 [lib.alg.remove], paragraph 4: 4341</p> 4342 4343<p> 4344Current wording says: 4345"Notes: Stable: the relative order of the elements that are not removed 4346is the same as their relative order in the original range" 4347</p> 4348 4349<p> 4350This sentences makes use of the term "removed", which is neither 4351specified, nor used in a previous paragraph (which uses the term 4352"eliminate"), nor unamgiuously separated from the name of the algorithm. 4353</p> 4354 4355 4356<p>2) Description of intended behavior:</p> 4357 4358<p> 4359For the rest of this Defect Report, it is assumed that the intended 4360behavior was that all elements of the range [first, last) which do not 4361hold the condition *i == value (std::remove) or pred(*i) != false 4362(std::remove_if)], call them s-elements [Note: s...stay], will be placed 4363into a contiguous subrange of [first, last), denoted by the iterators 4364[first, return value). The number of elements in the resulting range 4365[first, return value) shall be equal to the number of s-elements in the 4366original range [first, last). The relative order of the elements in the 4367resulting subrange[first, return value) shall be the same as the 4368relative order of the corresponding elements in the original range. It 4369is undefined whether any elements in the resulting subrange [return 4370value, last) will hold the corresponding condition, or not. 4371</p> 4372 4373<p> 4374All implementations known to the author of this Defect Report comply 4375with this intent. Since the intent of the behavior (contrary to the 4376current wording) is also described in various utility references serving 4377the C++ community [1], it is not expected that fixing the paragraphs 4378will influence current code - unless the code relies on the behavior as 4379it is described by current wording and the implementation indeed 4380reflects the current wording, and not the intent. 4381</p> 4382 4383 4384 4385<p>3) Proposed fixes:</p> 4386 4387 4388<p>Change 25.2.7 [lib.alg.remove], paragraph 2 to:</p> 4389 4390<p> 4391"Effect: Places all the elements referred to by iterator i in the range 4392[first, last) for which the following corresponding conditions hold : 4393!(*i == value), pred(*i) == false into the subrange [first, k) of the 4394original range, where k shall denote a value of type ForwardIterator. It 4395is undefined whether any elements in the resulting subrange [k, last) 4396will hold the corresponding condition, or not." 4397</p> 4398 4399<p>Comments to the new wording:</p> 4400 4401<p> 4402a) "Places" has no special meaning, and the everyday language meaning 4403should fit. 4404b) The corresponding conditions were negated compared to the current 4405wording, becaue the new wording requires it. 4406c) The wording "of the original range" might be redundant, since any 4407subrange starting at 'first' and containing no more elements than the 4408original range is implicitly a subrange of the original range [first, 4409last). 4410d) The iterator k was introduced instead of "return value" in order to 4411avoid a cyclic dependency on 25.2.7/3. The wording ", where k shall 4412denote a value of type ForwardIterator" might be redundant, because it 4413follows implicitly by 25.2.7/3. 4414e) "Places" does, in the author's opinion, explicitly forbid duplicating 4415any element holding the corresponding condition in the original range 4416[first, last) within the resulting range [first, k). If there is doubt 4417this term might be not unambiguous regarding this, it is suggested that 4418k is specified more closely by the following wording: "k shall denote a 4419value of type ForwardIterator [Note: see d)] so that k - first is equal 4420to the number of elements in the original range [first, last) for which 4421the corresponding condition did hold". This could also be expressed as a 4422separate paragraph "Postcondition:" 4423f) The senctence "It is undefined whether any elements in the resulting 4424subrange [k, last) will hold the corresponding condition, or not." was 4425added consciously so the term "Places" does not imply if the original 4426range [first, last) contains n elements holding the corresponding 4427condition, the identical range[first, last) will also contain exactly n 4428elements holding the corresponding condition after application of the 4429algorithm. 4430</p> 4431 4432<p> 4433Change 25.2.7 [lib.alg.remove], paragraph 3 to: 4434 4435"Returns: The iterator k." 4436</p> 4437 4438<p> 4439Change 25.2.7 [lib.alg.remove], paragraph 4 to: 4440 4441"Notes: Stable: the relative order of the elements that are placed into 4442the subrange [first, return value) shall be the same as their relative 4443order was in the original range [first, last) prior to application of 4444the algorithm." 4445</p> 4446 4447<p> 4448Comments to the new wording: 4449</p> 4450 4451<p> 4452a) the wording "was ... prior to application of the algorithm" is used 4453to explicitly distinguish the original range not only by means of 4454iterators, but also by a 'chronological' factor from the resulting range 4455[first, return value). It might be redundant. 4456</p> 4457 4458<p> 4459[1]: 4460The wording of these references is not always unambiguous, and provided 4461examples partially contradict verbal description of the algorithms, 4462because the verbal description resembles the problematic wording of 4463ISO/IEC 14882:2003. 4464</p> 4465<p><b>Proposed resolution:</b></p> 4466<p><b>Rationale:</b></p> 4467<p>The LWG believes that the standard is sufficiently clear, and that 4468 there is no evidence of any real-world confusion about this point.</p> 4469<hr> 4470<a name="490"><h3>490. std::unique wrongly specified</h3></a><p><b>Section:</b> 25.2.8 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.alg.unique"> [lib.alg.unique]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Thomas Mang <b>Date:</b> 12 Dec 2004</p> 4471<p>In Section 25.2.8 [lib.alg.unique], paragraphs 1 to 3 describe the 4472behavior of the mutating sequence operation std::unique. However, the 4473wording does not reflect the intended behavior [Note: See definition of 4474intended behavior below] of these algorithms, as it is known to the C++ 4475community [1].</p> 4476 4477 4478 4479<p>1) Analysis of current wording:</p> 4480 4481 4482<p>25.2.8 [lib.alg.unique], paragraph 1:</p> 4483 4484<p> 4485Current wording says: 4486"Effects: Eliminates all but the first element from every consecutive 4487group of equal elements referred to by the iterator i in the range 4488[first, last) for which the following corresponding conditions hold: *i 4489== *(i - 1) or pred(*i, *(i -1)) != false" 4490</p> 4491 4492<p> 4493This sentences expresses specifically that all elements denoted by the 4494(original) range [first, last) which are not but the first element from 4495a consecutive group of equal elements (where equality is defined as *i 4496== *(i - 1) or pred(*i, *(i - 1)) ! = false) [Note: See DR 202], call 4497them r-elements [Note: r...remove], will be eliminated. Since there is 4498no formal definition of the term "eliminate" provided, it is undefined 4499how this "elimination" takes place. But the meaning of "eliminate" in 4500everyday language seems to disallow explicitly that after application of 4501the algorithm, any r-element will remain at any position of the range 4502[first, last) [2]. 4503</p> 4504 4505<p> 4506Another defect in the current wording concerns the iterators used to 4507compare two elements for equality: The current wording contains the 4508expression "(i - 1)", which is not covered by 25/9 [Note: See DR 4509submitted by Thomas Mang regarding invalid iterator arithmetic 4510expressions]. 4511</p> 4512 4513 4514<p> 451525.2.8 [lib.alg.unique], paragraph 2: 4516</p> 4517<p>Current wording says: 4518"Returns: The end of the resulting range."</p> 4519 4520<p> 4521The resulting range is not specified. In combination with 25.2.8 4522[lib.alg.unique], paragraph 1, one reasonable interpretation (in the 4523author's opinion even the only possible interpretation) of this 4524so-called resulting range is the range [first, last) - thus returning 4525always the ForwardIterator 'last' parameter. 4526</p> 4527 4528<p>2) Description of intended behavior:</p> 4529 4530<p> 4531For the rest of this Defect Report, it is assumed that the intended 4532behavior was that all elements denoted by the original range [first, 4533last) which are the first element from a consecutive group of elements 4534for which the corresponding conditions: *(i-1) == *i (for the version of 4535unique without a predicate argument) or pred(*(i-1), *i) ! = false (for 4536the version of unique with a predicate argument) [Note: If such a group 4537of elements consists of only a single element, this is also considered 4538the first element] [Note: See resolutions of DR 202], call them 4539s-elements [Note: s...stay], will be placed into a contiguous subrange 4540of [first, last), denoted by the iterators [first, return value). The 4541number of elements in the resulting range [first, return value) shall be 4542equal to the number of s-elements in the original range [first, last). 4543Invalid iterator arithmetic expressions are expected to be resolved as 4544proposed in DR submitted by Thomas Mang regarding invalid iterator 4545arithmetic expressions. It is also assumed by the author that the 4546relative order of the elements in the resulting subrange [first, return 4547value) shall be the same as the relative order of the corresponding 4548elements (the s-elements) in the original range [Note: If this was not 4549intended behavior, the additional proposed paragraph about stable order 4550will certainly become obsolete]. 4551Furthermore, the resolutions of DR 202 are partially considered. 4552</p> 4553 4554<p> 4555All implementations known to the author of this Defect Report comply 4556with this intent [Note: Except possible effects of DR 202]. Since this 4557intent of the behavior (contrary to the current wording) is also 4558described in various utility references serving the C++ community [1], 4559it is not expected that fixing the paragraphs will influence current 4560code [Note: Except possible effects of DR 202] - unless the code relies 4561on the behavior as it is described by current wording and the 4562implementation indeed reflects the current wording, and not the intent. 4563</p> 4564 4565 4566 4567<p>3) Proposed fixes:</p> 4568 4569<p> 4570Change 25.2.8 [lib.alg.unique], paragraph 1 to: 4571</p> 4572 4573<p> 4574"Effect: Places the first element from every consecutive group of 4575elements, referred to by the iterator i in the range [first, last), for 4576which the following conditions hold: *(i-1) == *i (for the version of 4577unique without a predicate argument) or pred(*(i -1), *i) != false (for 4578the version of unique with a predicate argument), into the subrange 4579[first, k) of the original range, where k shall denote a value of type 4580ForwardIterator." 4581</p> 4582 4583<p>Comments to the new wording:</p> 4584 4585<p> 4586a) The new wording was influenced by the resolutions of DR 202. If DR 4587202 is resolved in another way, the proposed wording need also 4588additional review. 4589b) "Places" has no special meaning, and the everyday language meaning 4590should fit. 4591c) The expression "(i - 1)" was left, but is expected that DR submitted 4592by Thomas Mang regarding invalid iterator arithmetic expressions will 4593take this into account. 4594d) The wording "(for the version of unique without a predicate 4595argument)" and "(for the version of unique with a predicate argument)" 4596was added consciously for clarity and is in resemblence with current 459723.2.2.4 [lib.list.ops], paragraph 19. It might be considered redundant. 4598e) The wording "of the original range" might be redundant, since any 4599subrange starting at first and containing no more elements than the 4600original range is implicitly a subrange of the original range [first, 4601last). 4602f) The iterator k was introduced instead of "return value" in order to 4603avoid a cyclic dependency on 25.2.8 [lib.alg.unique], paragraph 2. The 4604wording ", where k shall denote a value of type ForwardIterator" might 4605be redundant, because it follows implicitly by 25.2.8 [lib.alg.unique], 4606paragraph 2. 4607g) "Places" does, in the author's opinion, explicitly forbid duplicating 4608any s-element in the original range [first, last) within the resulting 4609range [first, k). If there is doubt this term might be not unambiguous 4610regarding this, it is suggested that k is specified more closely by the 4611following wording: "k shall denote a value of type ForwardIterator 4612[Note: See f)] so that k - first is equal to the number of elements in 4613the original range [first, last) being the first element from every 4614consecutive group of elements for which the corresponding condition did 4615hold". This could also be expressed as a separate paragraph 4616"Postcondition:". 4617h) If it is considered that the wording is unclear whether it declares 4618the element of a group which consists of only a single element 4619implicitly to be the first element of this group [Note: Such an 4620interpretation could eventually arise especially in case last - first == 46211] , the following additional sentence is proposed: "If such a group of 4622elements consists of only a single element, this element is also 4623considered the first element." 4624</p> 4625 4626<p> 4627Change 25.2.8 [lib.alg.unique], paragraph 2 to: 4628"Returns: The iterator k." 4629</p> 4630 4631<p> 4632Add a separate paragraph "Notes:" as 25.2.8 [lib.alg.unique], paragraph 46332a or 3a, or a separate paragraph "Postcondition:" before 25.2.8 4634[lib.alg.unique], paragraph 2 (wording inside {} shall be eliminated if 4635the preceding expressions are used, or the preceding expressions shall 4636be eliminated if wording inside {} is used): 4637</p> 4638 4639<p> 4640"Notes:{Postcondition:} Stable: the relative order of the elements that 4641are placed into the subrange [first, return value {k}) shall be the same 4642as their relative order was in the original range [first, last) prior to 4643application of the algorithm." 4644</p> 4645 4646<p>Comments to the new wording:</p> 4647 4648<p> 4649a) It is assumed by the author that the algorithm was intended to be 4650stable. 4651In case this was not the intent, this paragraph becomes certainly 4652obsolete. 4653b) The wording "was ... prior to application of the algorithm" is used 4654to explicitly distinguish the original range not only by means of 4655iterators, but also by a 'chronological' factor from the resulting range 4656[first, return value). It might be redundant. 4657</p> 4658 4659<p> 466025.2.8 [lib.alg.unique], paragraph 3: 4661</p> 4662<p>See DR 239.</p> 4663 4664<p> 46654) References to other DRs: 4666</p> 4667 4668<p> 4669See DR 202, but which does not address any of the problems described in 4670this Defect Report [Note: This DR is supposed to complement DR 202]. 4671See DR 239. 4672See DR submitted by Thomas Mang regarding invalid iterator arithmetic 4673expressions. 4674</p> 4675 4676<p> 4677[1]: 4678The wording of these references is not always unambiguous, and provided 4679examples partially contradict verbal description of the algorithms, 4680because the verbal description resembles the problematic wording of 4681ISO/IEC 14882:2003. 4682</p> 4683 4684<p> 4685[2]: 4686Illustration of conforming implementations according to current wording: 4687</p> 4688 4689<p> 4690One way the author of this DR considers how this "elimination" could be 4691achieved by a conforming implementation according to current wording is 4692by substituting each r-element by _any_ s-element [Note: s...stay; any 4693non-r-element], since all r-elements are "eliminated". 4694</p> 4695 4696<p> 4697In case of a sequence consisting of elements being all 'equal' [Note: 4698See DR 202], substituting each r-element by the single s-element is the 4699only possible solution according to current wording. 4700</p> 4701<p><b>Proposed resolution:</b></p> 4702<p><b>Rationale:</b></p> 4703<p>The LWG believes the standard is sufficiently clear. No 4704implementers get it wrong, and changing it wouldn't cause any code to 4705change, so there is no real-world harm here.</p> 4706<hr> 4707<a name="491"><h3>491. std::list<>::unique incorrectly specified</h3></a><p><b>Section:</b> 23.2.2.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.deque.special"> [lib.deque.special]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Thomas Mang <b>Date:</b> 12 Dec 2004</p> 4708<p>In Section 23.2.2.4 [lib.list.ops], paragraphs 19 to 21 describe the 4709behavior of the std::list<T, Allocator>::unique operation. However, the 4710current wording is defective for various reasons.</p> 4711 4712 4713 4714<p> 47151) Analysis of current wording: 4716</p> 4717 4718<p>23.2.2.4 [lib.list.ops], paragraph 19:</p> 4719 4720<p> 4721Current wording says: 4722"Effects: Eliminates all but the first element from every consecutive 4723group of equal elements referred to by the iterator i in the range 4724[first + 1, last) for which *i == *(i - 1) (for the version of unique 4725with no argument) or pred(*i, *(i -1)) (for the version of unique with a 4726predicate argument) holds."</p> 4727 4728<p> 4729This sentences makes use of the undefined term "Eliminates". Although it 4730is, to a certain degree, reasonable to consider the term "eliminate" 4731synonymous with "erase", using "Erase" in the first place, as the 4732wording of 23.2.2.4 [lib.list.ops], paragraph 15 does, would be clearer.</p> 4733 4734<p> 4735The range of the elements referred to by iterator i is "[first + 1, 4736last)". However, neither "first" nor "last" is defined.</p> 4737 4738<p> 4739The sentence makes three times use of iterator arithmetic expressions ( 4740"first + 1", "*i == *(i - 1)", "pred(*i, *(i -1))" ) which is not 4741defined for bidirectional iterator [see DR submitted by Thomas Mang 4742regarding invalid iterator arithmetic expressions].</p> 4743 4744<p> 4745The same problems as pointed out in DR 202 (equivalence relation / order 4746of arguments for pred()) apply to this paragraph.</p> 4747 4748<p> 474923.2.2.4 [lib.list.ops], paragraph 20: 4750</p> 4751 4752<p> 4753Current wording says: 4754"Throws: Nothing unless an exception in thrown by *i == *(i-1) or 4755pred(*i, *(i - 1))"</p> 4756 4757<p> 4758The sentence makes two times use of invalid iterator arithmetic 4759expressions ( "*i == *(i - 1)", "pred(*i, *(i -1))" ). 4760</p> 4761<p> 4762[Note: Minor typos: "in" / missing dot at end of sentence.] 4763</p> 4764 4765<p> 476623.2.2.4 [lib.list.ops], paragraph 21:</p> 4767 4768<p> 4769Current wording says: 4770"Complexity: If the range (last - first) is not empty, exactly (last - 4771first) - 1 applications of the corresponding predicate, otherwise no 4772application of the predicate.</p> 4773 4774<p> 4775See DR 315 regarding "(last - first)" not yielding a range.</p> 4776 4777<p> 4778Invalid iterator arithmetic expression "(last - first) - 1" left .</p> 4779 4780 4781<p>2) Description of intended behavior:</p> 4782 4783<p> 4784For the rest of this Defect Report, it is assumed that "eliminate" is 4785supposed to be synonymous to "erase", that "first" is equivalent to an 4786iterator obtained by a call to begin(), "last" is equivalent to an 4787iterator obtained by a call to end(), and that all invalid iterator 4788arithmetic expressions are resolved as described in DR submitted by 4789Thomas Mang regarding invalid iterator arithmetic expressions.</p> 4790 4791<p> 4792Furthermore, the resolutions of DR 202 are considered regarding 4793equivalence relation and order of arguments for a call to pred.</p> 4794 4795<p> 4796All implementations known to the author of this Defect Report comply 4797with these assumptions, apart from the impact of the alternative 4798resolution of DR 202. Except for the changes implied by the resolutions 4799of DR 202, no impact on current code is expected.</p> 4800 4801<p> 48023) Proposed fixes:</p> 4803 4804<p> 4805Change 23.2.2.4 [lib.list.ops], paragraph 19 to:</p> 4806 4807<p> 4808"Effect: Erases all but the first element from every consecutive group 4809of elements, referred to by the iterator i in the range [begin(), 4810end()), for which the following conditions hold: *(i-1) == *i (for the 4811version of unique with no argument) or pred(*(i-1), *i) != false (for 4812the version of unique with a predicate argument)."</p> 4813 4814<p> 4815Comments to the new wording:</p> 4816 4817<p> 4818a) The new wording was influenced by DR 202 and the resolutions 4819presented there. If DR 202 is resolved in another way, the proposed 4820wording need also additional review. 4821b) "Erases" refers in the author's opinion unambiguously to the member 4822function "erase". In case there is doubt this might not be unamgibuous, 4823a direct reference to the member function "erase" is suggested [Note: 4824This would also imply a change of 23.2.2.4 [lib.list.ops], paragraph 482515.]. 4826c) The expression "(i - 1)" was left, but is expected that DR submitted 4827by Thomas Mang regarding invalid iterator arithmetic expressions will 4828take this into account. 4829d) The wording "(for the version of unique with no argument)" and "(for 4830the version of unique with a predicate argument)" was kept consciously 4831for clarity. 4832e) "begin()" substitutes "first", and "end()" substitutes "last". The 4833range need adjustment from "[first + 1, last)" to "[begin(), end())" to 4834ensure a valid range in case of an empty list. 4835f) If it is considered that the wording is unclear whether it declares 4836the element of a group which consists of only a single element 4837implicitly to be the first element of this group [Note: Such an 4838interpretation could eventually arise especially in case size() == 1] , 4839the following additional sentence is proposed: "If such a group of 4840elements consists of only a single element, this element is also 4841considered the first element."</p> 4842 4843<p> 4844Change 23.2.2.4 [lib.list.ops], paragraph 20 to:</p> 4845 4846<p> 4847"Throws: Nothing unless an exception is thrown by *(i-1) == *i or 4848pred(*(i-1), *i)."</p> 4849 4850<p> 4851Comments to the new wording:</p> 4852 4853<p> 4854a) The wording regarding the conditions is identical to proposed 485523.2.2.4 [lib.list.ops], paragraph 19. If 23.2.2.4 [lib.list.ops], 4856paragraph 19 is resolved in another way, the proposed wording need also 4857additional review. 4858b) The expression "(i - 1)" was left, but is expected that DR submitted 4859by Thomas Mang regarding invalid iterator arithmetic expressions will 4860take this into account. 4861c) Typos fixed.</p> 4862 4863<p> 4864Change 23.2.2.4 [lib.list.ops], paragraph 21 to:</p> 4865 4866<p> 4867"Complexity: If empty() == false, exactly size() - 1 applications of the 4868corresponding predicate, otherwise no applications of the corresponding 4869predicate."</p> 4870 4871<p> 4872Comments to the new wording:</p> 4873 4874<p> 4875a) The new wording is supposed to also replace the proposed resolution 4876of DR 315, which suffers from the problem of undefined "first" / "last". 4877</p> 4878 4879<p> 48805) References to other DRs:</p> 4881 4882<p>See DR 202. 4883See DR 239. 4884See DR 315. 4885See DR submitted by Thomas Mang regarding invalid iterator arithmetic 4886expressions.</p> 4887 4888<p><b>Proposed resolution:</b></p> 4889<p><b>Rationale:</b></p> 4890<p>"All implementations known to the author of this Defect Report 4891comply with these assumption", and "no impact on current code is 4892expected", i.e. there is no evidence of real-world confusion or 4893harm.</p> 4894<hr> 4895<a name="493"><h3>493. Undefined Expression in Input Iterator Note Title</h3></a><p><b>Section:</b> 24.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.input.iterators"> [lib.input.iterators]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Chris Jefferson <b>Date:</b> 13 Dec 2004</p> 4896<p>1) In 24.1.1/3, the following text is currently present.</p> 4897 4898<p>"Note: For input iterators, a==b does not imply ++a=++b (Equality does 4899not guarantee the substitution property or referential transparency)."</p> 4900 4901<p>However, when in Table 72, part of the definition of ++r is given as:</p> 4902 4903<p>"pre: r is dereferenceable. 4904post: any copies of the previous value of r are no longer required 4905either to be dereferenceable ..."</p> 4906 4907<p>While a==b does not imply that b is a copy of a, this statement should 4908perhaps still be made more clear.</p> 4909 4910<p>2) There are no changes to intended behaviour</p> 4911 4912<p> 49133) This Note should be altered to say "Note: For input iterators a==b, 4914when its behaviour is defined ++a==++b may still be false (Equality does 4915not guarantee the substitution property or referential transparency).</p> 4916 4917<p><b>Proposed resolution:</b></p> 4918<p><b>Rationale:</b></p> 4919<p>This is descriptive text, not normative, and the meaning is clear.</p> 4920<hr> 4921<a name="494"><h3>494. Wrong runtime complexity for associative container's insert and delete</h3></a><p><b>Section:</b> 23.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-containers.html#lib.associative.reqmts"> [lib.associative.reqmts]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Hans B os <b>Date:</b> 19 Dec 2004</p> 4922<p>According to [lib.associative.reqmts] table 69, the runtime comlexity 4923of insert(p, t) and erase(q) can be done in amortized constant time.</p> 4924 4925<p>It was my understanding that an associative container could be 4926implemented as a balanced binary tree.</p> 4927 4928<p>For inser(p, t), you 'll have to iterate to p's next node to see if t 4929can be placed next to p. Furthermore, the insertion usually takes 4930place at leaf nodes. An insert next to the root node will be done at 4931the left of the root next node</p> 4932 4933<p>So when p is the root node you 'll have to iterate from the root to 4934its next node, which takes O(log(size)) time in a balanced tree.</p> 4935 4936<p>If you insert all values with insert(root, t) (where root is the 4937root of the tree before insertion) then each insert takes O(log(size)) 4938time. The amortized complexity per insertion will be O(log(size)) 4939also.</p> 4940 4941<p>For erase(q), the normal algorithm for deleting a node that has no 4942empty left or right subtree, is to iterate to the next (or previous), 4943which is a leaf node. Then exchange the node with the next and delete 4944the leaf node. Furthermore according to DR 130, erase should return 4945the next node of the node erased. Thus erasing the root node, 4946requires iterating to the next node.</p> 4947 4948<p>Now if you empty a map by deleting the root node until the map is 4949empty, each operation will take O(log(size)), and the amortized 4950complexity is still O(log(size)).</p> 4951 4952<p>The operations can be done in amortized constant time if iterating 4953to the next node can be done in (non amortized) constant time. This 4954can be done by putting all nodes in a double linked list. This 4955requires two extra links per node. To me this is a bit overkill since 4956you can already efficiently insert or erase ranges with erase(first, 4957last) and insert(first, last).</p> 4958 4959<p><b>Proposed resolution:</b></p> 4960<p><b>Rationale:</b></p> 4961<p>Only "amortized constant" in special circumstances, and we believe 4962 that's implementable. That is: doing this N times will be O(N), not 4963 O(log N).</p> 4964<hr> 4965<a name="499"><h3>499. Std. doesn't seem to require stable_sort() to be stable!</h3></a><p><b>Section:</b> 25.3.1.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-algorithms.html#lib.stable.sort"> [lib.stable.sort]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Prateek Karandikar <b>Date:</b> 12 Apr 2005</p> 4966<blockquote> 4967<p> 496817.3.1.1 Summary</p> 4969 4970<p> 49711 The Summary provides a synopsis of the category, and introduces the 4972first-level subclauses. Each subclause also provides a summary, listing 4973the headers specified in the subclause and the library entities 4974provided in each header. 4975</p> 4976<p> 49772 Paragraphs labelled "Note(s):" or "Example(s):" are informative, 4978other paragraphs are normative. 4979</p> 4980</blockquote> 4981 4982<p>So this means that a "Notes" paragraph wouldn't be normative. </p> 4983 4984<blockquote> 4985<p> 498625.3.1.2 stable_sort 4987</p> 4988<pre>template<class RandomAccessIterator> 4989void stable_sort(RandomAccessIterat or first, RandomAccessIterator last); 4990 4991template<class RandomAccessIterator, class Compare> 4992void stable_sort(RandomAccessIterat or first, RandomAccessIterator last, Compare comp); 4993</pre> 4994<p> 49951 Effects: Sorts the elements in the range [first, last). 4996</p> 4997<p> 49982 Complexity: It does at most N(log N)^2 (where N == last - first) 4999comparisons; if enough extra memory is available, it is N log N. 5000</p> 5001<p> 50023 Notes: Stable: the relative order of the equivalent elements is 5003preserved. 5004</p> 5005</blockquote> 5006 5007<p> 5008The Notes para is informative, and nowhere else is stability mentioned above. 5009</p> 5010 5011<p> 5012Also, I just searched for the word "stable" in my copy of the Standard. 5013and the phrase "Notes: Stable: the relative order of the elements..." 5014is repeated several times in the Standard library clauses for 5015describing various functions. How is it that stability is talked about 5016in the informative paragraph? Or am I missing something obvious? 5017</p> 5018<p><b>Proposed resolution:</b></p> 5019<p> 5020</p> 5021<p><b>Rationale:</b></p> 5022<p> 5023This change has already been made. 5024</p> 5025<hr> 5026<a name="500"><h3>500. do_length cannot be implemented correctly</h3></a><p><b>Section:</b> 22.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-locales.html#lib.locale.codecvt.byname"> [lib.locale.codecvt.byname]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Krzysztof �elechowski <b>Date:</b> 24 May 2005</p> 5027<ol> 5028<li>codecvt::do_length is of type int;</li> 5029<li>it is assumed to be sort-of returning from_next - from of type ptrdiff_t;</li> 5030<li>ptrdiff_t cannot be cast to an int without data loss.</li> 5031</ol> 5032<p> 5033Contradiction. 5034</p> 5035<p><b>Proposed resolution:</b></p> 5036<p> 5037</p> 5038<hr> 5039<a name="501"><h3>501. Proposal: strengthen guarantees of lib.comparisons</h3></a><p><b>Section:</b> 20.5.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-utilities.html#lib.base"> [lib.base]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Me <anti_spam_email2003@yahoo.com> <b>Date:</b> 7 Jun 2005</p> 5040<blockquote> 5041"For templates greater, less, greater_equal, and less_equal, 5042the specializations for any pointer type yield a total order, even if 5043the built-in operators <, >, <=, >= do not." 5044</blockquote> 5045 5046<p> 5047The standard should do much better than guarantee that these provide a 5048total order, it should guarantee that it can be used to test if memory 5049overlaps, i.e. write a portable memmove. You can imagine a platform 5050where the built-in operators use a uint32_t comparison (this tests for 5051overlap on this platform) but the less<T*> functor is allowed to be 5052defined to use a int32_t comparison. On this platform, if you use 5053std::less with the intent of making a portable memmove, comparison on 5054an array that straddles the 0x7FFFFFFF/0x8000000 boundary can give 5055incorrect results. 5056</p> 5057<p><b>Proposed resolution:</b></p> 5058<p> 5059Add a footnote to 20.5.3/8 saying: 5060</p> 5061 5062<blockquote> 5063Given a p1 and p2 such that p1 points to N objects of type T and p2 5064points to M objects of type T. If [p1,p1+N) does not overlap [p2,p2+M), 5065less returns the same value when comparing all pointers in [p1,p1+N) to 5066all pointers in [p2,p2+M). Otherwise, there is a value Q and a value R 5067such that less returns the same value when comparing all pointers in 5068[p1,p1+Q) to all pointers in [p2,p2+R) and an opposite value when 5069comparing all pointers in [p1+Q,p1+N) to all pointers in [p2+R,p2+M). 5070For the sake of completeness, the null pointer value (4.10) for T is 5071considered to be an array of 1 object that doesn't overlap with any 5072non-null pointer to T. less_equal, greater, greater_equal, equal_to, 5073and not_equal_to give the expected results based on the total ordering 5074semantics of less. For T of void, treat it as having similar semantics 5075as T of char i.e. less<cv T*>(a, b) gives the same results as less<cv 5076void*>(a, b) which gives the same results as less<cv char*>((cv 5077char*)(cv void*)a, (cv char*)(cv void*)b). 5078</blockquote> 5079 5080<p> 5081I'm also thinking there should be a footnote to 20.5.3/1 saying that if 5082A and B are similar types (4.4/4), comp<A>(a,b) returns the same value 5083as comp<B>(a,b) (where comp is less, less_equal, etc.). But this might 5084be problematic if there is some really funky operator overloading going 5085on that does different things based on cv (that should be undefined 5086behavior if somebody does that though). This at least should be 5087guaranteed for all POD types (especially pointers) that use the 5088built-in comparison operators. 5089</p> 5090 5091<p><b>Rationale:</b></p> 5092less is already required to provide a strict weak ordering which is good enough 5093to detect overlapping memory situations. 5094<hr> 5095<a name="504"><h3>504. Integer types in pseudo-random number engine requirements</h3></a><p><b>Section:</b> TR1 5.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.req"> [tr.rand.req]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5096<p> 5097In [tr.rand.req], Paragraph 2 states that "... s is a value of integral type, 5098g is an ... object returning values of unsigned integral type ..." 5099</p> 5100<p><b>Proposed resolution:</b></p> 5101<p> 5102In 5.1.1 [tr.rand.req], Paragraph 2 replace 5103</p> 5104 5105<blockquote> 5106... s is a value of integral type, g is an lvalue of a type other than X that 5107defines a zero-argument function object returning values of <del>unsigned integral</del> type 5108<ins><tt>unsigned long int</tt></ins>, 5109... 5110</blockquote> 5111 5112<p> 5113In 5.1.1 [tr.rand.seq], Table 16, replace in the line for X(s) 5114</p> 5115 5116<blockquote> 5117creates an engine with the initial internal state 5118determined by <ins><tt>static_cast<unsigned long>(</tt></ins><tt><i>s</i></tt><ins><tt>)</tt></ins> 5119</blockquote> 5120 5121<p><i>[ 5122Mont Tremblant: Both s and g should be unsigned long. 5123This should refer to the constructor signatures. Jens provided wording post Mont Tremblant. 5124]</i></p> 5125 5126<p><i>[ 5127Berlin: N1932 adopts the proposed resolution: see 26.3.1.3/1e and Table 3 row 2. Moved 5128to Ready. 5129]</i></p> 5130 5131<p><b>Rationale:</b></p> 5132<p> 5133Jens: Just requiring X(unsigned long) still makes it possible 5134for an evil library writer to also supply a X(int) that does something 5135unexpected. The wording above requires that X(s) always performs 5136as if X(unsigned long) would have been called. I believe that is 5137sufficient and implements our intentions from Mont Tremblant. I 5138see no additional use in actually requiring a X(unsigned long) 5139signature. u.seed(s) is covered by its reference to X(s), same 5140arguments. 5141</p> 5142<hr> 5143<a name="506"><h3>506. Requirements of Distribution parameter for variate_generator</h3></a><p><b>Section:</b> TR1 5.1.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.var"> [tr.rand.var]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5144<p> 5145Paragraph 3 requires that template argument U (which corresponds to template 5146parameter Engine) satisfy all uniform random number generator requirements. 5147However, there is no analogous requirement regarding the template argument 5148that corresponds to template parameter Distribution. We believe there should 5149be, and that it should require that this template argument satisfy all random 5150distribution requirements. 5151</p> 5152<p><b>Proposed resolution:</b></p> 5153<p> 5154Consequence 1: Remove the precondition clauses [tr.rand.var]/16 and /18. 5155</p> 5156<p> 5157Consequence 2: Add max() and min() functions to those distributions that 5158do not already have them. 5159</p> 5160 5161<p><i>[ 5162Mont Tremblant: Jens reccommends NAD, min/max not needed everywhere. 5163Marc supports having min and max to satisfy generic programming interface. 5164]</i></p> 5165 5166<p><b>Rationale:</b></p> 5167Berlin: N1932 makes this moot: variate_generator has been eliminated. 5168<hr> 5169<a name="509"><h3>509. Uniform_int template parameters</h3></a><p><b>Section:</b> TR1 5.1.7.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.dist.iunif"> [tr.rand.dist.iunif]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5170<p> 5171In [tr.rand.dist.iunif] the uniform_int distribution currently has a single 5172template parameter, IntType, used as the input_type and as the result_type 5173of the distribution. We believe there is no reason to conflate these types 5174in this way. 5175</p> 5176<p><b>Proposed resolution:</b></p> 5177<p> 5178We recommend that there be a second template parameter to 5179reflect the distribution�s input_type, and that the existing first template 5180parameter continue to reflect (solely) the result_type: 5181</p> 5182<blockquote><pre>template< class IntType = int, UIntType = unsigned int > 5183class uniform_int 5184{ 5185public: 5186 // types 5187 typedef UIntType input_type; 5188 typedef IntType result_type; 5189</pre></blockquote> 5190 5191<p><i>[ 5192Berlin: Moved to NAD. N1932 makes this moot: the input_type template parameter has been 5193eliminated. 5194]</i></p> 5195 5196<hr> 5197<a name="510"><h3>510. Input_type for bernoulli_distribution</h3></a><p><b>Section:</b> TR1 5.1.7.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.dist.bern"> [tr.rand.dist.bern]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5198<p> 5199In [tr.rand.dist.bern] the distribution currently requires; 5200</p> 5201<blockquote><pre>typedef int input_type; 5202</pre></blockquote> 5203<p><b>Proposed resolution:</b></p> 5204<p> 5205We believe this is an unfortunate choice, and recommend instead: 5206</p> 5207<blockquote><pre>typedef unsigned int input_type; 5208</pre></blockquote> 5209 5210<p><i>[ 5211Berlin: Moved to NAD. N1932 makes this moot: the input_type template parameter has been 5212eliminated. 5213]</i></p> 5214 5215<hr> 5216<a name="511"><h3>511. Input_type for binomial_distribution</h3></a><p><b>Section:</b> TR1 5.1.7.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.dist.bin"> [tr.rand.dist.bin]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5217<p> 5218Unlike all other distributions in TR1, this binomial_distribution has an 5219implementation-defined input_type. We believe this is an unfortunate choice, 5220because it hinders users from writing portable code. It also hinders the 5221writing of compliance tests. We recommend instead: 5222</p> 5223<blockquote><pre>typedef RealType input_type; 5224</pre></blockquote> 5225<p> 5226While this choice is somewhat arbitrary (as it was for some of the other 5227distributions), we make this particular choice because (unlike all other 5228distributions) otherwise this template would not publish its RealType 5229argument and so users could not write generic code that accessed this 5230second template parameter. In this respect, the choice is consistent with 5231the other distributions in TR1. 5232</p> 5233<p> 5234We have two reasons for recommending that a real type be specified instead. 5235One reason is based specifically on characteristics of binomial distribution 5236implementations, while the other is based on mathematical characteristics of 5237probability distribution functions in general. 5238</p> 5239<p> 5240Implementations of binomial distributions commonly use Stirling approximations 5241for values in certain ranges. It is far more natural to use real values to 5242represent these approximations than it would be to use integral values to do 5243so. In other ranges, implementations reply on the Bernoulli distribution to 5244obtain values. While TR1�s bernoulli_distribution::input_type is specified as 5245int, we believe this would be better specified as double. 5246</p> 5247<p> 5248This brings us to our main point: The notion of a random distribution rests 5249on the notion of a cumulative distribution function, which in turn mathematically 5250depends on a continuous dependent variable. Indeed, such a distribution function 5251would be meaningless if it depended on discrete values such as integers�and this 5252remains true even if the distribution function were to take discrete steps. 5253</p> 5254<p> 5255Although this note is specifically about binomial_distribution::input_type, 5256we intend to recommend that all of the random distributions� input_types be 5257specified as a real type (either a RealType template parameter, or double, 5258as appropriate). 5259</p> 5260<p> 5261Of the nine distributions in TR1, four already have this characteristic 5262(uniform_real, exponential_distribution, normal_distribution, and 5263gamma_distribution). We have already argued the case for the binomial the 5264remaining four distributions. 5265</p> 5266<p> 5267In the case of uniform_int, we believe that the calculations to produce an 5268integer result in a specified range from an integer in a different specified 5269range is best done using real arithmetic. This is because it involves a 5270product, one of whose terms is the ratio of the extents of the two ranges. 5271Without real arithmetic, the results become less uniform: some numbers become 5272more (or less) probable that they should be. This is, of course, undesireable 5273behavior in a uniform distribution. 5274</p> 5275<p> 5276Finally, we believe that in the case of the bernoulli_distribution (briefly 5277mentioned earlier), as well as the cases of the geometric_distribution and the 5278poisson_distribution, it would be far more natural to have a real input_type. 5279This is because the most natural computation involves the random number 5280delivered and the distribution�s parameter p (in the case of bernoulli_distribution, 5281for example, the computation is a comparison against p), and p is already specified 5282in each case as having some real type. 5283</p> 5284<p><b>Proposed resolution:</b></p> 5285<blockquote><pre>typedef RealType input_type; 5286</pre></blockquote> 5287 5288<p><i>[ 5289Berlin: Moved to NAD. N1932 makes this moot: the input_type template parameter has been 5290eliminated. 5291]</i></p> 5292<hr> 5293<a name="512"><h3>512. Seeding subtract_with_carry_01 from a single unsigned long</h3></a><p><b>Section:</b> TR1 5.1.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.eng.sub1"> [tr.rand.eng.sub1]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5294<p> 5295Paragraph 8 specifies the algorithm by which a subtract_with_carry_01 engine 5296is to be seeded given a single unsigned long. This algorithm is seriously 5297flawed in the case where the engine parameter w (also known as word_size) 5298exceeds 31 [bits]. The key part of the paragraph reads: 5299</p> 5300<blockquote> 5301sets x(-r) ... x(-1) to (lcg(1)*2**(-w)) mod 1 5302</blockquote> 5303<p> 5304and so forth. 5305</p> 5306<p> 5307Since the specified linear congruential engine, lcg, delivers numbers with 5308a maximum of 2147483563 (just a shade under 31 bits), then when w is, for 5309example, 48, each of the x(i) will be less than 2**-17. The consequence 5310is that roughly the first 400 numbers delivered will be conspicuously 5311close to either zero or one. 5312</p> 5313<p> 5314Unfortunately, this is not an innocuous flaw: One of the predefined engines 5315in [tr.rand.predef], namely ranlux64_base_01, has w = 48 and would exhibit 5316this poor behavior, while the original N1378 proposal states that these 5317pre-defined engines are intended to be of "known good properties." 5318</p> 5319<p><b>Proposed resolution:</b></p> 5320<p> 5321In 5.1.4.4 [tr.rand.eng.sub1], replace the "effects" clause for 5322void seed(unsigned long value = 19780503) by 5323</p> 5324 5325<blockquote> 5326<i>Effects:</i> If <tt>value == 0</tt>, sets value to <tt>19780503</tt>. In any 5327case, <del>with a linear congruential generator <tt>lcg</tt>(i) having parameters 5328<tt><i>m<sub>lcg</sub></i> = 2147483563</tt>, <tt><i>a<sub>lcg</sub></i> = 40014</tt>, 5329<tt><i>c<sub>lcg</sub></i> = 0</tt>, and <tt><i>lcg</i>(0) = value</tt>,</del> 5330sets <ins>carry<tt>(-1)</tt> and</ins> <tt>x(-r) … x(-1)</tt> 5331<ins>as if executing</ins> 5332 5333<blockquote><pre><ins> 5334linear_congruential<unsigned long, 40014, 0, 2147483563> lcg(value); 5335seed(lcg); 5336</ins></pre></blockquote> 5337 5338<del>to <tt>(<i>lcg</i>(1) � 2<sup>-<i>w</i></sup>) mod 1 5339… (<i>lcg</i>(<i>r</i>) � 2<sup>-<i>w</i></sup>) mod 1</tt>, 5340respectively. If <tt><i>x</i>(-1) == 0</tt>, sets carry<tt>(-1) = 2<sup>-<i>w</i></sup></tt>, 5341else sets carry<tt>(-1) = 0</tt>.</del> 5342</blockquote> 5343 5344<p><i>[ 5345Jens provided revised wording post Mont Tremblant. 5346]</i></p> 5347 5348<p><i>[ 5349Berlin: N1932 adopts the originally-proposed resolution of the issue. 5350Jens's supplied wording is a clearer description of what is 5351intended. Moved to Ready. 5352]</i></p> 5353 5354<p><b>Rationale:</b></p> 5355<p> 5356Jens: I'm using an explicit type here, because fixing the 5357prose would probably not qualify for the (with issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#504">504</a> even 5358stricter) requirements we have for seed(Gen&). 5359</p> 5360 5361<p><i>[ 5362Portland: Subsumed by N2111. 5363]</i></p> 5364<hr> 5365<a name="513"><h3>513. Size of state for subtract_with_carry_01</h3></a><p><b>Section:</b> TR1 5.1.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.eng.sub1"> [tr.rand.eng.sub1]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5366<p> 5367Paragraph 3 begins: 5368</p> 5369<blockquote> 5370The size of the state is r. 5371</blockquote> 5372<p> 5373However, this is not quite consistent with the remainder of the paragraph 5374which specifies a total of nr+1 items in the textual representation of 5375the state. We recommend the sentence be corrected to match: 5376</p> 5377<blockquote> 5378The size of the state is nr+1. 5379</blockquote> 5380<p> 5381To give meaning to the coefficient n, it may be also desirable to move 5382n�s definition from later in the paragraph. Either of the following 5383seem reasonable formulations: 5384</p> 5385<blockquote> 5386With n=..., the size of the state is nr+1. 5387</blockquote> 5388<blockquote> 5389The size of the state is nr+1, where n=... . 5390</blockquote> 5391<p> 5392</p> 5393<p><b>Proposed resolution:</b></p> 5394<p><i>[ 5395Jens: I plead for "NAD" on the grounds that "size of state" is only 5396used as an argument for big-O complexity notation, thus 5397constant factors and additions don't count. 5398]</i></p> 5399 5400<p><i>[ 5401Berlin: N1932 adopts the proposed NAD. 5402]</i></p> 5403 5404<hr> 5405<a name="514"><h3>514. Size of state for subtract_with_carry</h3></a><p><b>Section:</b> TR1 5.1.4.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.eng.sub"> [tr.rand.eng.sub]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5406<p> 5407Paragraph 2 begins: 5408</p> 5409<blockquote> 5410The size of the state is r. 5411</blockquote> 5412<p> 5413However, the next sentence specifies a total of r+1 items in the textual 5414representation of the state, r specific x�s as well as a specific carry. 5415This makes a total of r+1 items that constitute the size of the state, 5416rather than r. 5417</p> 5418<p><b>Proposed resolution:</b></p> 5419<p> 5420We recommend the sentence be corrected to match: 5421</p> 5422<blockquote> 5423 The size of the state is r+1. 5424</blockquote> 5425 5426<p><i>[ 5427Jens: I plead for "NAD" on the grounds that "size of state" is only 5428used as an argument for big-O complexity notation, thus 5429constant factors and additions don't count. 5430]</i></p> 5431 5432<p><i>[ 5433Berlin: N1932 adopts the proposed NAD. 5434]</i></p> 5435 5436<hr> 5437<a name="516"><h3>516. Seeding subtract_with_carry_01 using a generator</h3></a><p><b>Section:</b> TR1 5.1.4.4 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.eng.sub1"> [tr.rand.eng.sub1]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5438<p> 5439Paragraph 6 says: 5440</p> 5441<blockquote> 5442... obtained by successive invocations of g, ... 5443</blockquote> 5444<p> 5445We recommend instead: 5446</p> 5447<blockquote> 5448... obtained by taking successive invocations of g mod 2**32, ... 5449</blockquote> 5450<p> 5451as the context seems to require only 32-bit quantities be used here. 5452</p> 5453<p><b>Proposed resolution:</b></p> 5454<p> 5455Berlin: N1932 adopts the proposed resultion: see 26.3.3.4/7. Moved to Ready. 5456</p> 5457 5458<p><i>[ 5459Portland: Subsumed by N2111. 5460]</i></p> 5461<hr> 5462<a name="517"><h3>517. Should include name in external representation</h3></a><p><b>Section:</b> TR1 5.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.req"> [tr.rand.req]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Walter Brown <b>Date:</b> 3 Jul 2005</p> 5463<p> 5464The last two rows of Table 16 deal with the i/o requirements of an engine, 5465specifying that the textual representation of an engine�s state, 5466appropriately formatted, constitute the engine�s external representation. 5467</p> 5468<p> 5469This seems adequate when an engine�s type is known. However, it seems 5470inadequate in the context of generic code, where it becomes useful and 5471perhaps even necessary to determine an engine�s type via input. 5472</p> 5473<p> 5474</p> 5475<p><b>Proposed resolution:</b></p> 5476<p> 5477We therefore recommend that, in each of these two rows of Table 16, the 5478text "textual representation" be expanded so as to read "engine name 5479followed by the textual representation." 5480</p> 5481 5482<p><i>[ 5483Berlin: N1932 considers this NAD. This is a QOI issue. 5484]</i></p> 5485 5486<hr> 5487<a name="544"><h3>544. minor NULL problems in C.2</h3></a><p><b>Section:</b> C.2 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/diff.html#diff.library"> [diff.library]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Martin Sebor <b>Date:</b> 25 Nov 2005</p> 5488<p> 5489According to C.2.2.3, p1, "the macro NULL, defined in any of <clocale>, 5490<cstddef>, <cstdio>, <cstdlib>, <cstring>, <ctime>, 5491or <cwchar>." This is consistent with the C standard. 5492</p> 5493<p> 5494However, Table 95 in C.2 fails to mention <clocale> and <cstdlib>. 5495</p> 5496<p> 5497In addition, C.2, p2 claims that "The C++ Standard library provides 549854 standard macros from the C library, as shown in Table 95." While 5499table 95 does have 54 entries, since a couple of them (including the 5500NULL macro) are listed more than once, the actual number of macros 5501defined by the C++ Standard Library may not be 54. 5502</p> 5503<p><b>Proposed resolution:</b></p> 5504<p> 5505I propose we add <clocale> and <cstdlib> to Table 96 and remove the 5506number of macros from C.2, p2 and reword the sentence as follows: 5507</p> 5508<blockquote> 5509The C++ Standard library <del>provides 54 standard macros from</del> 5510<ins>defines a number macros corresponding to those defined by</ins> the C 5511<ins>Standard</ins> library, as shown in Table 96. 5512</blockquote> 5513 5514<p><i>[ 5515Portland: Resolution is considered editorial. It will be incorporated into the WD. 5516]</i></p> 5517 5518<hr> 5519<a name="549"><h3>549. Undefined variable in binomial_distribution</h3></a><p><b>Section:</b> TR1 5.1.7.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.rand.dist.bin"> [tr.rand.dist.bin]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Matt Austern <b>Date:</b> 10 Jan 2006</p> 5520<p> 5521Paragraph 1 says that "A binomial distributon random distribution produces 5522integer values i>0 with p(i) = (n choose i) * p*i * (1-p)^(t-i), where t and 5523p are the parameters of the distribution. OK, that tells us what t, p, and i 5524are. What's n? 5525</p> 5526<p><b>Proposed resolution:</b></p> 5527<p> 5528Berlin: Typo: "n" replaced by "t" in N1932: see 26.3.7.2.2/1. 5529</p> 5530 5531<p><i>[ 5532Portland: Subsumed by N2111. 5533]</i></p> 5534<hr> 5535<a name="554"><h3>554. Problem with lwg DR 184 numeric_limits<bool></h3></a><p><b>Section:</b> 18.2.1.5 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-support.html#lib.numeric.special"> [lib.numeric.special]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Howard Hinnant <b>Date:</b> 29 Jan 2006</p> 5536<p> 5537I believe we have a bug in the resolution of: 5538<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#184">lwg 184</a> 5539(WP status). 5540</p> 5541 5542<p> 5543The resolution spells out each member of <tt>numeric_limits<bool></tt>. 5544The part I'm having a little trouble with is: 5545</p> 5546<blockquote><pre>static const bool traps = false; 5547</pre></blockquote> 5548 5549<p> 5550Should this not be implementation defined? Given: 5551</p> 5552 5553<blockquote><pre>int main() 5554{ 5555 bool b1 = true; 5556 bool b2 = false; 5557 bool b3 = b1/b2; 5558} 5559</pre></blockquote> 5560 5561<p> 5562If this causes a trap, shouldn't <tt>numeric_limits<bool>::traps</tt> be 5563<tt>true</tt>? 5564</p> 5565<p><b>Proposed resolution:</b></p> 5566<p> 5567Change 18.2.1.5p3: 5568</p> 5569 5570<blockquote> 5571-3- The specialization for <tt>bool</tt> shall be provided as follows: 5572<blockquote><pre>namespace std { 5573 template <> class numeric_limits<bool> { 5574 ... 5575 static const bool traps = <del>false</del> <ins><i>implementation-defined</i></ins>; 5576 ... 5577 }; 5578} 5579</pre></blockquote> 5580</blockquote> 5581 5582<p><i>[ 5583Redmond: NAD because traps refers to values, not operations. There is no bool 5584value that will trap. 5585]</i></p> 5586 5587<hr> 5588<a name="555"><h3>555. TR1, 8.21/1: typo</h3></a><p><b>Section:</b> TR1 8.21 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/tr1.html#tr.c99.boolh"> [tr.c99.boolh]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> Paolo Carlini <b>Date:</b> 2 Feb 2006</p> 5589<p> 5590This one, if nobody noticed it yet, seems really editorial: 5591s/cstbool/cstdbool/ 5592</p> 5593<p><b>Proposed resolution:</b></p> 5594<p> 5595Change 8.21p1: 5596</p> 5597<blockquote> 5598-1- The header behaves as if it defines the additional macro defined in 5599<tt><cst<ins>d</ins>bool></tt> by including the header <tt><cstdbool></tt>. 5600</blockquote> 5601 5602<p><i>[ 5603Redmond: Editorial. 5604]</i></p> 5605 5606<hr> 5607<a name="558"><h3>558. lib.input.iterators Defect</h3></a><p><b>Section:</b> 24.1.1 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iterators.html#lib.input.iterators"> [lib.input.iterators]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#NAD">NAD</a> <b>Submitter:</b> David Abrahams <b>Date:</b> 9 Feb 2006</p> 5608<blockquote> 5609<p> 5610 24.1.1 Input iterators [lib.input.iterators] 5611</p> 5612<p> 5613 1 A class or a built-in type X satisfies the requirements of an 5614 input iterator for the value type T if the following expressions are 5615 valid, where U is the type of any specified member of type T, as 5616 shown in Table 73. 5617</p> 5618</blockquote> 5619<p> 5620There is no capital U used in table 73. There is a lowercase u, but 5621that is clearly not meant to denote a member of type T. Also, there's 5622no description in 24.1.1 of what lowercase a means. IMO the above 5623should have been...Hah, a and b are already covered in 24.1/11, so maybe it 5624should have just been: 5625</p> 5626<p><b>Proposed resolution:</b></p> 5627<p> 5628Change 24.1.1p1: 5629</p> 5630<blockquote> 5631-1- A class or a built-in type <tt>X</tt> satisfies the requirements of an 5632input iterator for the value type <tt>T</tt> if the following expressions 5633are valid<del>, where <tt>U</tt> is the type of any specified member of type 5634<tt>T</tt>,</del> as shown in Table 73. 5635</blockquote> 5636 5637<p><i>[ 5638Portland: Editorial. 5639]</i></p> 5640 5641<hr> 5642<a name="569"><h3>569. Postcondition for basic_ios::clear(iostate) incorrectly stated</h3></a><p><b>Section:</b> 27.4.4.3 <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lib-iostreams.html#lib.iostate.flags"> [lib.iostate.flags]</a> <b>Status:</b> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#Dup">Dup</a> <b>Submitter:</b> Seungbeom Kim <b>Date:</b> 10 Mar 2006</p> 5643<p> 5644Section: 27.4.4.3 [lib.iostate.flags] 5645</p> 5646<p> 5647Paragraph 4 says: 5648</p> 5649<blockquote> 5650<blockquote><pre>void clear(iostate <i>state</i> = goodbit); 5651</pre></blockquote> 5652<p> 5653<i>Postcondition:</i> If <tt>rdbuf()!=0</tt> then <tt><i>state</i> == rdstate();</tt> 5654otherwise <tt>rdstate()==<i>state</i>|ios_base::badbit</tt>. 5655</p> 5656</blockquote> 5657 5658<p> 5659The postcondition "rdstate()==state|ios_base::badbit" is parsed as 5660"(rdstate()==state)|ios_base::badbit", which is probably what the 5661committee meant. 5662</p> 5663<p><b>Proposed resolution:</b></p> 5664<p><b>Rationale:</b></p> 5665<p> 5666This is a duplicate of issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#272">272</a>. 5667</p> 5668<p>----- End of document -----</p> 5669</body></html>