From fdb510e7d6764f80d14dfd71dc56cce1b7c9b9f0 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 15 Jul 2004 18:04:07 +0000 Subject: [PATCH] lwg-active.html, [...]: Import Revision 30. 2004-07-15 Paolo Carlini * docs/html/ext/lwg-active.html, lwg-defects.html: Import Revision 30. * docs/html/ext/howto.html: Tweak entries for DRs 167/253/389/402. From-SVN: r84765 --- libstdc++-v3/ChangeLog | 5 + libstdc++-v3/docs/html/ext/howto.html | 8 +- libstdc++-v3/docs/html/ext/lwg-active.html | 4437 ++++++++----------- libstdc++-v3/docs/html/ext/lwg-defects.html | 4285 ++++++++++++------ 4 files changed, 4824 insertions(+), 3911 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 39c9e3ebdfb..6ffd46345de 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 Paolo Carlini + + * docs/html/ext/lwg-active.html, lwg-defects.html: Import Revision 30. + * docs/html/ext/howto.html: Tweak entries for DRs 167/253/389/402. + 2004-07-15 Jakub Jelinek PR libstdc++/14697 diff --git a/libstdc++-v3/docs/html/ext/howto.html b/libstdc++-v3/docs/html/ext/howto.html index b3f91552825..c085800c600 100644 --- a/libstdc++-v3/docs/html/ext/howto.html +++ b/libstdc++-v3/docs/html/ext/howto.html @@ -351,7 +351,7 @@ should probably not be calling underflow(). --> -
167: +
167: Improper use of traits_type::length()
op<< with a const char* was @@ -412,7 +412,7 @@
This nested typdef was originally not specified.
-
253: +
253: valarray helper functions are almost entirely useless
Make the copy constructor and copy-assignment operator declarations @@ -479,13 +479,13 @@
Change the format string to "%.0Lf".
-
389: +
389: Const overload of valarray::operator[] returns by value
Change it to return a const T&.
-
402: +
402: Wrong new expression in [some_]allocator::construct
Replace "new" with "::new". diff --git a/libstdc++-v3/docs/html/ext/lwg-active.html b/libstdc++-v3/docs/html/ext/lwg-active.html index 379e65861a3..1241e2b9cc1 100644 --- a/libstdc++-v3/docs/html/ext/lwg-active.html +++ b/libstdc++-v3/docs/html/ext/lwg-active.html @@ -1,14 +1,15 @@ -C++ Standard Library Active Issues List - - + + +C++ Standard Library Active Issues List + - + - + - + @@ -18,19 +19,19 @@ -
Doc. no.N1537=03-0120N1635=04-0075
Date:13 Nov 200312 Apr 2004
Project:Reply to: Matt Austern <austern@apple.com>
-

C++ Standard Library Active Issues List (Revision 28)

+ +

C++ Standard Library Active Issues List (Revision 30)

Reference ISO/IEC IS 14882:1998(E)

Also see:

The purpose of this document is to record the status of issues which have come before the Library Working Group (LWG) of the ANSI @@ -40,10 +41,10 @@

This document contains only library issues which are actively being considered by the Library Working Group. That is, issues which have a - status of New, Open, - Ready, and Review. See - Library Defect Reports List for issues considered defects and - Library Closed Issues List for issues considered closed.

+ status of New, Open, + Ready, and Review. See + Library Defect Reports List for issues considered defects and + Library Closed Issues List for issues considered closed.

The issues in these lists are not necessarily formal ISO Defect Reports (DR's). While some issues will eventually be elevated to @@ -77,7 +78,7 @@

Public information as to how to obtain a copy of the C++ Standard, join the standards committee, submit an issue, or comment on an issue can be found in the comp.std.c++ FAQ. - Public discussion of C++ Standard related issues occurs on news:comp.std.c++. + Public discussion of C++ Standard related issues occurs on news:comp.std.c++.

For committee members, files available on the committee's private @@ -87,12 +88,20 @@ directory as the issues list files.

Revision History

    +
  • R30: +Post-Sydney mailing: reflects decisions made at the Sydney meeting. +Voted all "Ready" issues from R29 into the working paper. +Added new issues 460-462. +
  • +
  • R29: +Pre-Sydney mailing. Added new issues 441-457. +
  • R28: -Post-Kona mailing: reflects decisiosn made at the Kona meeting. -Added new issues 432-440. +Post-Kona mailing: reflects decisions made at the Kona meeting. +Added new issues 432-440.
  • R27: -Pre-Kona mailing. Added new issues 404-431. +Pre-Kona mailing. Added new issues 404-431.
  • R26: Post-Oxford mailing: reflects decisions made at the Oxford meeting. @@ -100,139 +109,139 @@ All issues in Ready status were voted into DR status. All issues in DR status were voted into WP status.
  • R25: -Pre-Oxford mailing. Added new issues 390-402. +Pre-Oxford mailing. Added new issues 390-402.
  • R24: Post-Santa Cruz mailing: reflects decisions made at the Santa Cruz -meeting. All Ready issues from R23 with the exception of 253, which has been given a new proposed resolution, were -moved to DR status. Added new issues 383-389. (Issues 387-389 were discussed -at the meeting.) Made progress on issues 225, 226, 229: 225 and 229 have been moved to Ready status, and the only remaining -concerns with 226 involve wording. +meeting. All Ready issues from R23 with the exception of 253, which has been given a new proposed resolution, were +moved to DR status. Added new issues 383-389. (Issues 387-389 were discussed +at the meeting.) Made progress on issues 225, 226, 229: 225 and 229 have been moved to Ready status, and the only remaining +concerns with 226 involve wording.
  • R23: -Pre-Santa Cruz mailing. Added new issues 367-382. +Pre-Santa Cruz mailing. Added new issues 367-382. Moved issues in the TC to TC status.
  • R22: -Post-Curaçao mailing. Added new issues 362-366. +Post-Curaçao mailing. Added new issues 362-366.
  • R21: -Pre-Curaçao mailing. Added new issues 351-361. +Pre-Curaçao mailing. Added new issues 351-361.
  • R20: Post-Redmond mailing; reflects actions taken in Redmond. Added -new issues 336-350, of which issues -347-350 were added since Redmond, hence +new issues 336-350, of which issues +347-350 were added since Redmond, hence not discussed at the meeting. All Ready issues were moved to DR status, with the exception of issues -284, 241, and 267. +284, 241, and 267. Noteworthy issues discussed at Redmond include -120 202, 226, 233, -270, 253, 254, 323. +120 202, 226, 233, +270, 253, 254, 323.
  • R19: Pre-Redmond mailing. Added new issues -323-335. +323-335.
  • R18: Post-Copenhagen mailing; reflects actions taken in Copenhagen. -Added new issues 312-317, and discussed -new issues 271-314. +Added new issues 312-317, and discussed +new issues 271-314. Changed status of issues -103 118 136 153 -165 171 183 184 -185 186 214 221 -234 237 243 248 -251 252 256 260 -261 262 263 265 -268 +103 118 136 153 +165 171 183 184 +185 186 214 221 +234 237 243 248 +251 252 256 260 +261 262 263 265 +268 to DR. Changed status of issues -49 109 117 182 -228 230 232 235 -238 241 242 250 -259 264 266 267 -271 272 273 275 -281 284 285 286 -288 292 295 297 -298 301 303 306 -307 308 312 +49 109 117 182 +228 230 232 235 +238 241 242 250 +259 264 266 267 +271 272 273 275 +281 284 285 286 +288 292 295 297 +298 301 303 306 +307 308 312 to Ready. Closed issues -111 277 279 287 -289 293 302 313 -314 +111 277 279 287 +289 293 302 313 +314 as NAD.
  • R17: Pre-Copenhagen mailing. Converted issues list to XML. Added proposed -resolutions for issues 49, 76, 91, 235, 250, 267. -Added new issues 278-311. +resolutions for issues 49, 76, 91, 235, 250, 267. +Added new issues 278-311.
  • R16: post-Toronto mailing; reflects actions taken in Toronto. Added new -issues 265-277. Changed status of issues -3, 8, 9, 19, -26, 31, 61, -63, 86, 108, -112, 114, 115, -122, 127, 129, -134, 137, 142, -144, 146, 147, -159, 164, 170, -181, 199, 208, -209, 210, 211, -212, 217, 220, -222, 223, 224, -227 to "DR". Reopened issue 23. Reopened -issue 187. Changed issues 2 and -4 to NAD. Fixed a typo in issue 17. Fixed -issue 70: signature should be changed both places it -appears. Fixed issue 160: previous version didn't fix +issues 265-277. Changed status of issues +3, 8, 9, 19, +26, 31, 61, +63, 86, 108, +112, 114, 115, +122, 127, 129, +134, 137, 142, +144, 146, 147, +159, 164, 170, +181, 199, 208, +209, 210, 211, +212, 217, 220, +222, 223, 224, +227 to "DR". Reopened issue 23. Reopened +issue 187. Changed issues 2 and +4 to NAD. Fixed a typo in issue 17. Fixed +issue 70: signature should be changed both places it +appears. Fixed issue 160: previous version didn't fix the bug in enough places.
  • R15: pre-Toronto mailing. Added issues -233-264. Some small HTML formatting +233-264. Some small HTML formatting changes so that we pass Weblint tests.
  • R14: post-Tokyo II mailing; reflects committee actions taken in -Tokyo. Added issues 228 to 232. (00-0019R1/N1242) +Tokyo. Added issues 228 to 232. (00-0019R1/N1242)
  • R13: -pre-Tokyo II updated: Added issues 212 to 227. +pre-Tokyo II updated: Added issues 212 to 227.
  • R12: -pre-Tokyo II mailing: Added issues 199 to -211. Added "and paragraph 5" to the proposed resolution -of issue 29. Add further rationale to issue -178. +pre-Tokyo II mailing: Added issues 199 to +211. Added "and paragraph 5" to the proposed resolution +of issue 29. Add further rationale to issue +178.
  • R11: post-Kona mailing: Updated to reflect LWG and full committee actions in Kona (99-0048/N1224). Note changed resolution of issues -4 and 38. Added issues 196 -to 198. Closed issues list split into "defects" and +4 and 38. Added issues 196 +to 198. Closed issues list split into "defects" and "closed" documents. Changed the proposed resolution of issue -4 to NAD, and changed the wording of proposed resolution -of issue 38. +4 to NAD, and changed the wording of proposed resolution +of issue 38.
  • R10: -pre-Kona updated. Added proposed resolutions 83, -86, 91, 92, -109. Added issues 190 to -195. (99-0033/D1209, 14 Oct 99) +pre-Kona updated. Added proposed resolutions 83, +86, 91, 92, +109. Added issues 190 to +195. (99-0033/D1209, 14 Oct 99)
  • R9: -pre-Kona mailing. Added issues 140 to -189. Issues list split into separate "active" and +pre-Kona mailing. Added issues 140 to +189. Issues list split into separate "active" and "closed" documents. (99-0030/N1206, 25 Aug 99)
  • R8: @@ -240,48 +249,46 @@ post-Dublin mailing. Updated to reflect LWG and full committee actions in Dublin. (99-0016/N1193, 21 Apr 99)
  • R7: -pre-Dublin updated: Added issues 130, 131, -132, 133, 134, -135, 136, 137, -138, 139 (31 Mar 99) +pre-Dublin updated: Added issues 130, 131, +132, 133, 134, +135, 136, 137, +138, 139 (31 Mar 99)
  • R6: -pre-Dublin mailing. Added issues 127, 128, -and 129. (99-0007/N1194, 22 Feb 99) +pre-Dublin mailing. Added issues 127, 128, +and 129. (99-0007/N1194, 22 Feb 99)
  • R5: -update issues 103, 112; added issues -114 to 126. Format revisions to prepare +update issues 103, 112; added issues +114 to 126. Format revisions to prepare for making list public. (30 Dec 98)
  • R4: -post-Santa Cruz II updated: Issues 110, -111, 112, 113 added, several +post-Santa Cruz II updated: Issues 110, +111, 112, 113 added, several issues corrected. (22 Oct 98)
  • R3: -post-Santa Cruz II: Issues 94 to 109 +post-Santa Cruz II: Issues 94 to 109 added, many issues updated to reflect LWG consensus (12 Oct 98)
  • R2: -pre-Santa Cruz II: Issues 73 to 93 added, -issue 17 updated. (29 Sep 98) +pre-Santa Cruz II: Issues 73 to 93 added, +issue 17 updated. (29 Sep 98)
  • R1: -Correction to issue 55 resolution, 60 code -format, 64 title. (17 Sep 98) +Correction to issue 55 resolution, 60 code +format, 64 title. (17 Sep 98)

Issue Status

-

-New - The issue has not yet been +

New - The issue has not yet been reviewed by the LWG. Any Proposed Resolution is purely a suggestion from the issue submitter, and should not be construed as the view of LWG.

-

-Open - The LWG has discussed the issue +

Open - The LWG has discussed the issue but is not yet ready to move the issue forward. There are several possible reasons for open status:

    @@ -300,31 +307,26 @@ format, -

    -Dup - The LWG has reached consensus that +

    Dup - The LWG has reached consensus that the issue is a duplicate of another issue, and will not be further dealt with. A Rationale identifies the duplicated issue's issue number.

    -

    -NAD - The LWG has reached consensus that +

    NAD - The LWG has reached consensus that the issue is not a defect in the Standard, and the issue is ready to forward to the full committee as a proposed record of response. A Rationale discusses the LWG's reasoning.

    -

    -Review - Exact wording of a +

    Review - Exact wording of a Proposed Resolution is now available for review on an issue for which the LWG previously reached informal consensus.

    -

    -Ready - The LWG has reached consensus +

    Ready - The LWG has reached consensus that the issue is a defect in the Standard, the Proposed Resolution is correct, and the issue is ready to forward to the full committee for further action as a Defect Report (DR).

    -

    -DR - (Defect Report) - The full J16 +

    DR - (Defect Report) - The full J16 committee has voted to forward the issue to the Project Editor to be processed as a Potential Defect Report. The Project Editor reviews the issue, and then forwards it to the WG21 Convenor, who returns it @@ -332,48 +334,43 @@ format, -

    -TC - (Technical Corrigenda) - The full +

    TC - (Technical Corrigenda) - The full WG21 committee has voted to accept the Defect Report's Proposed Resolution as a Technical Corrigenda. Action on this issue is thus complete and no further action is possible under ISO rules.

    -

    -WP - (Working Paper) - The proposed +

    WP - (Working Paper) - The proposed resolution has not been accepted as a Technical Corrigendum, but the full WG21 committee has voted to apply the Defect Report's Proposed Resolution to the working paper.

    -

    -RR - (Record of Response) - The full WG21 +

    RR - (Record of Response) - The full WG21 committee has determined that this issue is not a defect in the Standard. Action on this issue is thus complete and no further action is possible under ISO rules.

    -

    -Future - In addition to the regular +

    Future - In addition to the regular status, the LWG believes that this issue should be revisited at the next revision of the standard. It is usually paired with NAD.

    -

    Issues are always given the status of New when +

    Issues are always given the status of New when they first appear on the issues list. They may progress to - Open or Review while the LWG + Open or Review while the LWG is actively working on them. When the LWG has reached consensus on the disposition of an issue, the status will then change to - Dup, NAD, or Ready as appropriate. Once the full J16 committee votes to + Dup, NAD, or Ready as appropriate. Once the full J16 committee votes to forward Ready issues to the Project Editor, they are given the - status of Defect Report ( DR). These in turn may - become the basis for Technical Corrigenda (TC), + status of Defect Report ( DR). These in turn may + become the basis for Technical Corrigenda (TC), or are closed without action other than a Record of Response - (RR ). The intent of this LWG process is that + (RR ). The intent of this LWG process is that only issues which are truly defects in the Standard move to the formal ISO DR status.

    Active Issues


    -

    23. Num_get overflow result

    -Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: Open  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    23. Num_get overflow result

    Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: Open  Submitter: Nathan Myers  Date: 6 Aug 1998

    The current description of numeric input does not account for the possibility of overflow. This is an implicit result of changing the description to rely on the definition of scanf() (which fails to @@ -398,7 +395,7 @@ and hard to trace, so I will describe it briefly:

    • - According to 22.2.2.1.2 [lib.facet.num.get.virtuals] + According to 22.2.2.1.2 [lib.facet.num.get.virtuals] paragraph 11 failbit is set if scanf() would return an input error; otherwise a value is converted to the rules of scanf. @@ -492,10 +489,10 @@ upon overflow. We considered three options based on this:

      it.

      Proposed resolution:

      -

      typo: 22.2.2.2.2 [lib.facet.num.put.virtuals], para 2, bullet 3. Strike "in." from +

      typo: 22.2.2.2.2 [lib.facet.num.put.virtuals], para 2, bullet 3. Strike "in." from the end.

      -

      Change 22.2.2.2 [lib.locale.nm.put], para 11, bullet 2 from:

      +

      Change 22.2.2.2 [lib.locale.nm.put], para 11, bullet 2 from:

      The sequence of chars accumulated in stage 2 would have caused scanf to report an input failure. ios_base::failbit is @@ -525,377 +522,14 @@ what kind of error happened. Martin will provide wording, Howard may help.]


      -

      44. Iostreams use operator== on int_type values

      -Section: 27 [lib.input.output]  Status: Ready  Submitter: Nathan Myers  Date: 6 Aug 1998

      -

      Many of the specifications for iostreams specify that character -values or their int_type equivalents are compared using operators == -or !=, though in other places traits::eq() or traits::eq_int_type is -specified to be used throughout. This is an inconsistency; we should -change uses of == and != to use the traits members instead.

      -

      Proposed resolution:

      - -

      [Pre-Kona: Dietmar supplied wording]

      - -

      List of changes to clause 27:

      -
        -
      1. - In lib.basic.ios.members paragraph 13 (postcondition clause for - 'fill(cT)') change - -
        - fillch == fill() -
        - - to - -
        - traits::eq(fillch, fill()) -
        - - -
      2. -
      3. - In lib.istream.unformatted paragraph 7 (effects clause for - 'get(cT,streamsize,cT)'), third bullet, change - -
        - c == delim for the next available input character c -
        - - to - -
        - traits::eq(c, delim) for the next available input character c -
        - -
      4. -
      5. - In lib.istream.unformatted paragraph 12 (effects clause for - 'get(basic_streambuf<cT,Tr>&,cT)'), third bullet, change - -
        - c == delim for the next available input character c -
        - - to - -
        - traits::eq(c, delim) for the next available input character c -
        - -
      6. -
      7. - In lib.istream.unformatted paragraph 17 (effects clause for - 'getline(cT,streamsize,cT)'), second bullet, change - -
        - c == delim for the next available input character c -
        - - to - -
        - traits::eq(c, delim) for the next available input character c -
        - -
      8. -
      9. - In lib.istream.unformatted paragraph 24 (effects clause for - 'ignore(int,int_type)'), second bullet, change - -
        - c == delim for the next available input character c -
        - - to - -
        - traits::eq_int_type(c, delim) for the next available input - character c -
        - -
      10. -
      11. - In lib.istream.unformatted paragraph 25 (notes clause for - 'ignore(int,int_type)'), second bullet, change - -
        - The last condition will never occur if delim == traits::eof() -
        - - to - -
        - The last condition will never occur if - traits::eq_int_type(delim, traits::eof()). -
        - -
      12. -
      13. - In lib.istream.sentry paragraph 6 (example implementation for the - sentry constructor) change - -
        - while ((c = is.rdbuf()->snextc()) != traits::eof()) { -
        - - to - -
        - while (!traits::eq_int_type(c = is.rdbuf()->snextc(), traits::eof())) { -
        - -
      14. -
      - -

      List of changes to Chapter 21:

      - -
        -
      1. - In lib.string::find paragraph 1 (effects clause for find()), - second bullet, change - -
        - at(xpos+I) == str.at(I) for all elements ... -
        - - to - -
        - traits::eq(at(xpos+I), str.at(I)) for all elements ... -
        - -
      2. -
      3. - In lib.string::rfind paragraph 1 (effects clause for rfind()), - second bullet, change - -
        - at(xpos+I) == str.at(I) for all elements ... -
        - - to - -
        - traits::eq(at(xpos+I), str.at(I)) for all elements ... -
        - -
      4. -
      5. - In lib.string::find.first.of paragraph 1 (effects clause for - find_first_of()), second bullet, change - -
        - at(xpos+I) == str.at(I) for all elements ... -
        - - to - -
        - traits::eq(at(xpos+I), str.at(I)) for all elements ... -
        - -
      6. -
      7. - In lib.string::find.last.of paragraph 1 (effects clause for - find_last_of()), second bullet, change - -
        - at(xpos+I) == str.at(I) for all elements ... -
        - - to - -
        - traits::eq(at(xpos+I), str.at(I)) for all elements ... -
        - -
      8. -
      9. - In lib.string::find.first.not.of paragraph 1 (effects clause for - find_first_not_of()), second bullet, change - -
        - at(xpos+I) == str.at(I) for all elements ... -
        - - to - -
        - traits::eq(at(xpos+I), str.at(I)) for all elements ... -
        -
      10. - -
      11. - In lib.string::find.last.not.of paragraph 1 (effects clause for - find_last_not_of()), second bullet, change - -
        - at(xpos+I) == str.at(I) for all elements ... -
        - - to - -
        - traits::eq(at(xpos+I), str.at(I)) for all elements ... -
        -
      12. - -
      13. - In lib.string.ios paragraph 5 (effects clause for getline()), - second bullet, change - -
        - c == delim for the next available input character c -
        - - to - -
        - traits::eq(c, delim) for the next available input character c -
        -
      14. - -
      - -

      Notes:

      -
        -
      • - Fixing this issue highlights another sloppyness in - lib.istream.unformatted paragraph 24: this clause mentions a "character" - which is then compared to an 'int_type' (see item 5. in the list - below). It is not clear whether this requires explicit words and - if so what these words are supposed to be. A similar issue exists, - BTW, for operator*() of istreambuf_iterator which returns the result - of sgetc() as a character type (see lib.istreambuf.iterator::op* - paragraph 1), and for operator++() of istreambuf_iterator which - passes the result of sbumpc() to a constructor taking a char_type - (see lib.istreambuf.iterator::operator++ paragraph 3). Similarily, the - assignment operator ostreambuf_iterator passes a char_type to a function - taking an int_type (see lib.ostreambuf.iter.ops paragraph 1). -
      • -
      • - It is inconsistent to use comparisons using the traits functions in - Chapter 27 while not using them in Chapter 21, especially as some - of the inconsistent uses actually involve streams (eg. getline() on - streams). To avoid leaving this issue open still longer due to this - inconsistency (it is open since 1998), a list of changes to Chapter - 21 is below. -
      • -
      • - In Chapter 24 there are several places with statements like "the end - of stream is reached (streambuf_type::sgetc() returns traits::eof())" - (lib.istreambuf.iterator paragraph 1, lib.ostreambuf.iter.ops - paragraph 5). It is unclear whether these should be clarified to use - traits::eq_int_type() for detecting traits::eof(). -
      • -
      - -
      -

      92. Incomplete Algorithm Requirements

      -Section: 25 [lib.algorithms]  Status: Ready  Submitter: Nico Josuttis  Date: 29 Sep 1998

      -

      The standard does not state, how often a function object is copied, -called, or the order of calls inside an algorithm. This may lead to -surprising/buggy behavior. Consider the following example:

      - -
      class Nth {    // function object that returns true for the nth element 
      -  private: 
      -    int nth;     // element to return true for 
      -    int count;   // element counter 
      -  public: 
      -    Nth (int n) : nth(n), count(0) { 
      -    } 
      -    bool operator() (int) { 
      -        return ++count == nth; 
      -    } 
      -}; 
      -.... 
      -// remove third element 
      -    list<int>::iterator pos; 
      -    pos = remove_if(coll.begin(),coll.end(),  // range 
      -                    Nth(3)),                  // remove criterion 
      -    coll.erase(pos,coll.end()); 
      - -

      This call, in fact removes the 3rd AND the 6th element. This -happens because the usual implementation of the algorithm copies the -function object internally:

      - -
      template <class ForwIter, class Predicate> 
      -ForwIter std::remove_if(ForwIter beg, ForwIter end, Predicate op) 
      -{ 
      -    beg = find_if(beg, end, op); 
      -    if (beg == end) { 
      -        return beg; 
      -    } 
      -    else { 
      -        ForwIter next = beg; 
      -        return remove_copy_if(++next, end, beg, op); 
      -    } 
      -} 
      - -

      The algorithm uses find_if() to find the first element that should -be removed. However, it then uses a copy of the passed function object -to process the resulting elements (if any). Here, Nth is used again -and removes also the sixth element. This behavior compromises the -advantage of function objects being able to have a state. Without any -cost it could be avoided (just implement it directly instead of -calling find_if()).

      -

      Proposed resolution:

      - -

      Add a new paragraph following 25 [lib.algorithms] paragraph 8:

      -
      -[Note: Unless otherwise specified, algorithms that take function -objects as arguments are permitted to copy those function objects -freely. Programmers for whom object identity is important should -consider using a wrapper class that points to a noncopied -implementation object, or some equivalent solution.] -
      - -

      [Dublin: Pete Becker felt that this may not be a defect, -but rather something that programmers need to be educated about. -There was discussion of adding wording to the effect that the number -and order of calls to function objects, including predicates, not -affect the behavior of the function object.]

      - -

      [Pre-Kona: Nico comments: It seems the problem is that we don't -have a clear statement of "predicate" in the -standard. People including me seemed to think "a function -returning a Boolean value and being able to be called by an STL -algorithm or be used as sorting criterion or ... is a -predicate". But a predicate has more requirements: It should -never change its behavior due to a call or being copied. IMHO we have -to state this in the standard. If you like, see section 8.1.4 of my -library book for a detailed discussion.]

      - -

      [Kona: Nico will provide wording to the effect that "unless -otherwise specified, the number of copies of and calls to function -objects by algorithms is unspecified".  Consider placing in -25 [lib.algorithms] after paragraph 9.]

      - -

      [Santa Cruz: The standard doesn't currently guarantee that - functions object won't be copied, and what isn't forbidden is - allowed. It is believed (especially since implementations that were - written in concert with the standard do make copies of function - objects) that this was intentional. Thus, no normative change is - needed. What we should put in is a non-normative note suggesting to - programmers that if they want to guarantee the lack of copying they - should use something like the ref wrapper.]

      - -

      [Oxford: Matt provided wording.]

      - - -
      -

      96. Vector<bool> is not a container

      -Section: 23.2.5 [lib.vector.bool]  Status: Open  Submitter: AFNOR  Date: 7 Oct 1998

      -

      -vector<bool> is not a container as its reference and +

      96. Vector<bool> is not a container

      Section: 23.2.5 [lib.vector.bool]  Status: Open  Submitter: AFNOR  Date: 7 Oct 1998

      +

      vector<bool> is not a container as its reference and pointer types are not references and pointers.

      Also it forces everyone to have a space optimization instead of a speed one.

      -

      -See also: 99-0008 == N1185 Vector<bool> is +

      See also: 99-0008 == N1185 Vector<bool> is Nonconforming, Forces Optimization Choice.

      Proposed resolution:

      @@ -947,146 +581,7 @@ course users with specific suggestions as to how to apply the eventual solution.]


      -

      98. Input iterator requirements are badly written

      -Section: 24.1.1 [lib.input.iterators]  Status: Ready  Submitter: AFNOR  Date: 7 Oct 1998

      -

      Table 72 in 24.1.1 [lib.input.iterators] specifies semantics for -*r++ of:

      - -

         { T tmp = *r; ++r; return tmp; } -

      - -

      There are two problems with this. First, the return type is -specified to be "T", as opposed to something like "convertible to T". -This is too specific: we want to allow *r++ to return an lvalue.

      - -

      Second, writing the semantics in terms of code misleadingly -suggests that the effects *r++ should precisely replicate the behavior -of this code, including side effects. (Does this mean that *r++ -should invoke the copy constructor exactly as many times as the sample -code above would?) See issue 334 for a similar -problem.

      - -

      Proposed resolution:

      -In Table 72 in 24.1.1 [lib.input.iterators], change the return type -for *r++ from T to "convertible to T". -

      Rationale:

      -

      This issue has two parts: the return type, and the number of times - the copy constructor is invoked.

      - -

      The LWG believes the the first part is a real issue. It's - inappropriate for the return type to be specified so much more - precisely for *r++ than it is for *r. In particular, if r is of - (say) type int*, then *r++ isn't int, - but int&.

      - -

      The LWG does not believe that the number of times the copy - constructor is invoked is a real issue. This can vary in any case, - because of language rules on copy constructor elision. That's too - much to read into these semantics clauses.

      -
      -

      120. Can an implementor add specializations?

      -Section: 17.4.3.1 [lib.reserved.names]  Status: Ready  Submitter: Judy Ward  Date: 15 Dec 1998

      - -

      The original issue asked whether a library implementor could -specialize standard library templates for built-in types. (This was -an issue because users are permitted to explicitly instantiate -standard library templates.)

      - -

      Specializations are no longer a problem, because of the resolution -to core issue 259. Under the proposed resolution, it will be legal -for a translation unit to contain both a specialization and an -explicit instantiation of the same template, provided that the -specialization comes first. In such a case, the explicit -instantiation will be ignored. Further discussion of library issue -120 assumes that the core 259 resolution will be adopted.

      - -

      However, as noted in lib-7047, one piece of this issue still -remains: what happens if a standard library implementor explicitly -instantiates a standard library templates? It's illegal for a program -to contain two different explicit instantiations of the same template -for the same type in two different translation units (ODR violation), -and the core working group doesn't believe it is practical to relax -that restriction.

      - -

      The issue, then, is: are users allowed to explicitly instantiate -standard library templates for non-user defined types? The status quo -answer is 'yes'. Changing it to 'no' would give library implementors -more freedom.

      - -

      This is an issue because, for performance reasons, library -implementors often need to explicitly instantiate standard library -templates. (for example, std::basic_string<char>) Does giving -users freedom to explicitly instantiate standard library templates for -non-user defined types make it impossible or painfully difficult for -library implementors to do this?

      - -

      John Spicer suggests, in lib-8957, that library implementors have a -mechanism they can use for explicit instantiations that doesn't -prevent users from performing their own explicit instantiations: put -each explicit instantiation in its own object file. (Different -solutions might be necessary for Unix DSOs or MS-Windows DLLs.) On -some platforms, library implementors might not need to do anything -special: the "undefined behavior" that results from having two -different explicit instantiations might be harmless.

      - -

      Proposed resolution:

      -

      Append to 17.4.3.1 [lib.reserved.names] paragraph 1:

      -
      - A program may explicitly instantiate any templates in the standard - library only if the declaration depends on the name of a user-defined - type of external linkage and the instantiation meets the standard library - requirements for the original template. -
      - -

      [Kona: changed the wording from "a user-defined name" to "the name of - a user-defined type"]

      - -

      Rationale:

      -

      The LWG considered another possible resolution:

      -
      -

      In light of the resolution to core issue 259, no normative changes - in the library clauses are necessary. Add the following non-normative - note to the end of 17.4.3.1 [lib.reserved.names] paragraph 1:

      -
      - [Note: A program may explicitly instantiate standard library - templates, even when an explicit instantiation does not depend on - a user-defined name. --end note] -
      -
      - -

      The LWG rejected this because it was believed that it would make - it unnecessarily difficult for library implementors to write - high-quality implementations. A program may not include an - explicit instantiation of the same template, for the same template - arguments, in two different translation units. If users are - allowed to provide explicit instantiations of Standard Library - templates for built-in types, then library implementors aren't, - at least not without nonportable tricks.

      - -

      The most serious problem is a class template that has writeable - static member variables. Unfortunately, such class templates are - important and, in existing Standard Library implementations, are - often explicitly specialized by library implementors: locale facets, - which have a writeable static member variable id. If a - user's explicit instantiation collided with the implementations - explicit instantiation, iostream initialization could cause locales - to be constructed in an inconsistent state.

      - -

      One proposed implementation technique was for Standard Library - implementors to provide explicit instantiations in separate object - files, so that they would not be picked up by the linker when the - user also provides an explicit instantiation. However, this - technique only applies for Standard Library implementations that - are packaged as static archives. Most Standard Library - implementations nowadays are packaged as dynamic libraries, so this - technique would not apply.

      - -

      The Committee is now considering standardization of dynamic - linking. If there are such changes in the future, it may be - appropriate to revisit this issue later.

      -
      -

      130. Return type of container::erase(iterator) differs for associative containers

      -Section: 23.1.2 [lib.associative.reqmts], 23.1.1 [lib.sequence.reqmts]  Status: Review  Submitter: Andrew Koenig  Date: 2 Mar 1999

      +

      130. Return type of container::erase(iterator) differs for associative containers

      Section: 23.1.2 [lib.associative.reqmts], 23.1.1 [lib.sequence.reqmts]  Status: Review  Submitter: Andrew Koenig  Date: 2 Mar 1999

      Table 67 (23.1.1) says that container::erase(iterator) returns an iterator. Table 69 (23.1.2) says that in addition to this requirement, associative containers also say that container::erase(iterator) @@ -1096,99 +591,55 @@ fail to meet the requirements for containers.

      Proposed resolution:

      -In 23.1.2 [lib.associative.reqmts], in Table 69 Associative container +In 23.1.2 [lib.associative.reqmts], in Table 69 Associative container requirements, change the return type of a.erase(q) from void to iterator. Change the assertion/not/pre/post-condition from "erases the element pointed to -by q" to "erases the element pointed to -by q and returns the iterator immediately following -q prior to the erasure." +by q" to "erases the element pointed to by q. +Returns an iterator pointing to the element immediately following q +prior to the element being erased. If no such element exists, a.end() +is returned."

      -In 23.3.1 [lib.map], in the map class synopsis; and -in 23.3.2 [lib.multimap], in the multimap class synopsis; and -in 23.3.3 [lib.set], in the set class synopsis; and -in 23.3.4 [lib.multiset], in the multiset class synopsis: +In 23.1.2 [lib.associative.reqmts], in Table 69 Associative container +requirements, change the return type of a.erase(q1, q2) +from void to iterator. Change the +assertion/not/pre/post-condition from "erases the elements in the +range [q1, q2)" to "erases the elements in the range [q1, +q2). Returns an iterator pointing to the element immediately +following q2 prior to any elements being erased. If no such element +exists, a.end() is returned." +

      + +

      +In 23.3.1 [lib.map], in the map class synopsis; and +in 23.3.2 [lib.multimap], in the multimap class synopsis; and +in 23.3.3 [lib.set], in the set class synopsis; and +in 23.3.4 [lib.multiset], in the multiset class synopsis: change the signature of the first erase overload to

      -
         iterator erase(iterator position);
      +
      +   iterator erase(iterator position);
       

      [Pre-Kona: reopened at the request of Howard Hinnant]

      +

      [Post-Kona: the LWG agrees the return type should be iterator, not void. (Alex Stepanov agrees too.) Matt provided wording.]

      -
      -

      167. Improper use of traits_type::length() -

      -Section: 27.6.2.5.4 [lib.ostream.inserters.character]  Status: Ready  Submitter: Dietmar Kühl  Date: 20 Jul 1999

      -

      Paragraph 4 states that the length is determined using -traits::length(s). Unfortunately, this function is not -defined for example if the character type is wchar_t and the -type of s is char const*. Similar problems exist if -the character type is char and the type of s is -either signed char const* or unsigned char -const*.

      -

      Proposed resolution:

      -

      Change 27.6.2.5.4 [lib.ostream.inserters.character] paragraph 4 from:

      -
      -

      Effects: Behaves like an formatted inserter (as described in - lib.ostream.formatted.reqmts) of out. After a sentry object is - constructed it inserts characters. The number of characters starting - at s to be inserted is traits::length(s). Padding is determined as - described in lib.facet.num.put.virtuals. The traits::length(s) - characters starting at s are widened using out.widen - (lib.basic.ios.members). The widened characters and any required - padding are inserted into out. Calls width(0).

      -
      -

      to:

      -
      -

      Effects: Behaves like a formatted inserter (as described in - lib.ostream.formatted.reqmts) of out. After a sentry object is - constructed it inserts n characters starting at s, - where n is the number that would be computed as if by:

      -
        -
      • traits::length(s) for the overload where the first argument is of - type basic_ostream<charT, traits>& and the second is - of type const charT*, and also for the overload where the first - argument is of type basic_ostream<char, traits>& and - the second is of type const char*.
      • -
      • std::char_traits<char>::length(s) - for the overload where the first argument is of type - basic_ostream<charT, traits>& and the second is of type - const char*.
      • -
      • traits::length(reinterpret_cast<const char*>(s)) - for the other two overloads.
      • -
      -

      Padding is determined as described in - lib.facet.num.put.virtuals. The n characters starting at - s are widened using out.widen (lib.basic.ios.members). The - widened characters and any required padding are inserted into - out. Calls width(0).

      -
      - -

      [Santa Cruz: Matt supplied new wording]

      - -

      [Kona: changed "where n is" to " where n is the - number that would be computed as if by"]

      +

      [ + Sydney: the proposed wording went in the right direction, but it + wasn't good enough. We want to return an iterator from the range form + of erase as well as the single-iterator form. Also, the wording is + slightly different from the wording we have for sequences; there's no + good reason for having a difference. Matt provided new wording, + which we will review at the next meeting. +]

      -

      Rationale:

      -

      We have five separate cases. In two of them we can use the -user-supplied traits class without any fuss. In the other three we -try to use something as close to that user-supplied class as possible. -In two cases we've got a traits class that's appropriate for -char and what we've got is a const signed char* or a const -unsigned char*; that's close enough so we can just use a reinterpret -cast, and continue to use the user-supplied traits class. Finally, -there's one case where we just have to give up: where we've got a -traits class for some arbitrary charT type, and we somehow have to -deal with a const char*. There's nothing better to do but fall back -to char_traits<char>


      -

      197. max_size() underspecified

      -Section: 20.1.5 [lib.allocator.requirements], 23.1 [lib.container.requirements]  Status: Open  Submitter: Andy Sawyer  Date: 21 Oct 1999

      +

      197. max_size() underspecified

      Section: 20.1.5 [lib.allocator.requirements], 23.1 [lib.container.requirements]  Status: Open  Submitter: Andy Sawyer  Date: 21 Oct 1999

      Must the value returned by max_size() be unchanged from call to call?

      Must the value returned from max_size() be meaningful?

      @@ -1220,21 +671,21 @@ into account the actual currently available resources). This, obviously, has to be determined dynamically each time max_size() is called.

      Proposed resolution:

      -

      Change 20.1.5 [lib.allocator.requirements] table 32 max_size() wording from:
      +

      Change 20.1.5 [lib.allocator.requirements] table 32 max_size() wording from:

            the largest value that can meaningfully be passed to X::allocate
      to:
            the value of the largest constant expression -(5.19 [expr.const]) that could ever meaningfully be passed to X::allocate

      +(5.19 [expr.const]) that could ever meaningfully be passed to X::allocate

      -Change 23.1 [lib.container.requirements] table 65 max_size() wording from:
      +Change 23.1 [lib.container.requirements] table 65 max_size() wording from:

            size() of the largest possible container.
      to:
            the value of the largest constant expression -(5.19 [expr.const]) that could ever meaningfully be returned by X::size(). +(5.19 [expr.const]) that could ever meaningfully be returned by X::size().

      [Kona: The LWG informally discussed this and asked Andy Sawyer to submit @@ -1243,7 +694,7 @@ an issue.]

      [Tokyo: The LWG believes (1) above is the intended meaning.]

      [Post-Tokyo: Beman Dawes supplied the above resolution at the -request of the LWG. 21.3.3 [lib.string.capacity] was not changed because it +request of the LWG. 21.3.3 [lib.string.capacity] was not changed because it references max_size() in 23.1. The term "compile-time" was avoided because it is not defined anywhere in the standard (even though it is used several places in the library clauses).]

      @@ -1254,8 +705,7 @@ function than as an allocator member function. For the latter, it is probably best thought of as an architectural limit. Nathan will provide new wording.]


      -

      201. Numeric limits terminology wrong

      -Section: 18.2.1 [lib.limits]  Status: Open  Submitter: Stephen Cleary  Date: 21 Dec 1999

      +

      201. Numeric limits terminology wrong

      Section: 18.2.1 [lib.limits]  Status: Open  Submitter: Stephen Cleary  Date: 21 Dec 1999

      In some places in this section, the terms "fundamental types" and "scalar types" are used when the term "arithmetic types" is intended. @@ -1267,34 +717,26 @@ specializations of numeric_limits.

      Change 18.2 [lib.support.limits] para 1 from:

      -

      The headers <limits>, <climits>, and <cfloat> -supply characteristics of implementation-dependent fundamental types -(3.9.1).

      +

      The headers <limits>, <climits>, and <cfloat> supply characteristics of implementation-dependent fundamental types (3.9.1).

      to:

      -

      The headers <limits>, <climits>, and <cfloat> -supply characteristics of implementation-dependent arithmetic types -(3.9.1).

      +

      The headers <limits>, <climits>, and <cfloat> supply characteristics of implementation-dependent arithmetic types (3.9.1).

      Change 18.2.1 [lib.limits] para 1 from:

      -

      The numeric_limits component provides a C++ program with -information about various properties of the implementation's -representation of the fundamental +

      The numeric_limits component provides a C++ program with information about various properties of the implementation's representation of the fundamental types.

      to:

      -

      The numeric_limits component provides a C++ program with -information about various properties of the implementation's -representation of the arithmetic +

      The numeric_limits component provides a C++ program with information about various properties of the implementation's representation of the arithmetic types.

      @@ -1325,17 +767,14 @@ types.

      Change 18.2.1.1 [lib.numeric.limits] para 1 from:

      -

      The member is_specialized makes it possible to distinguish between -fundamental types, which have specializations, and non-scalar types, -which +

      The member is_specialized makes it possible to distinguish between fundamental types, which have specializations, and non-scalar types, which do not.

      to:

      -

      The member is_specialized makes it possible to distinguish between -arithmetic types, which have specializations, and non-arithmetic types, +

      The member is_specialized makes it possible to distinguish between arithmetic types, which have specializations, and non-arithmetic types, which do not.

      @@ -1350,178 +789,7 @@ types and for user-defined types, and the standard doesn't make it clear how numeric_limits applies to each of those cases. A wholesale review of numeric_limits is needed. A paper would be welcome.]


      -

      226. User supplied specializations or overloads of namespace std function templates

      -Section: 17.4.3.1 [lib.reserved.names]  Status: Ready  Submitter: Dave Abrahams  Date: 01 Apr 2000

      -

      The issues are: 

      -

      1. How can a 3rd party library implementor (lib1) write a version of a standard -algorithm which is specialized to work with his own class template? 

      -

      2. How can another library implementor (lib2) write a generic algorithm which -will take advantage of the specialized algorithm in lib1?

      -

      This appears to be the only viable answer under current language rules:

      -
      -
      namespace lib1
      -{
      -    // arbitrary-precision numbers using T as a basic unit
      -    template <class T>
      -    class big_num { //...
      -    };
      -    
      -
          // defining this in namespace std is illegal (it would be an
      -    // overload), so we hope users will rely on Koenig lookup
      -    template <class T>
      -    void swap(big_int<T>&, big_int<T>&);
      -}
      -
      #include <algorithm>
      -namespace lib2
      -{
      -    template <class T>
      -    void generic_sort(T* start, T* end)
      -    {
      -            ...
      -        // using-declaration required so we can work on built-in types
      -        using std::swap;
      -        // use Koenig lookup to find specialized algorithm if available
      -        swap(*x, *y);
      -    }
      -}
      -
      -

      This answer has some drawbacks. First of all, it makes writing lib2 difficult -and somewhat slippery. The implementor needs to remember to write the -using-declaration, or generic_sort will fail to compile when T is a built-in -type. The second drawback is that the use of this style in lib2 effectively -"reserves" names in any namespace which defines types which may -eventually be used with lib2. This may seem innocuous at first when applied to -names like swap, but consider more ambiguous names like unique_copy() instead. -It is easy to imagine the user wanting to define these names differently in his -own namespace. A definition with semantics incompatible with the standard -library could cause serious problems (see issue 225).

      -

      Why, you may ask, can't we just partially specialize std::swap()? It's -because the language doesn't allow for partial specialization of function -templates. If you write:

      -
      -
      namespace std
      -{
      -    template <class T>
      -    void swap(lib1::big_int<T>&, lib1::big_int<T>&);
      -}
      -
      -

      You have just overloaded std::swap, which is illegal under the current -language rules. On the other hand, the following full specialization is legal:

      -
      -
      namespace std
      -{
      -    template <>
      -    void swap(lib1::other_type&, lib1::other_type&);
      -}
      -
      - -

      This issue reflects concerns raised by the "Namespace issue -with specialized swap" thread on comp.lang.c++.moderated. A -similar set of concerns was earlier raised on the boost.org mailing -list and the ACCU-general mailing list. Also see library reflector -message c++std-lib-7354.

      - -

      -J. C. van Winkel points out (in c++std-lib-9565) another unexpected -fact: it's impossible to output a container of std::pair's using copy -and an ostream_iterator, as long as both pair-members are built-in or -std:: types. That's because a user-defined operator<< for (for -example) std::pair<const std::string, int> will not be found: -lookup for operator<< will be performed only in namespace std. -Opinions differed on whether or not this was a defect, and, if so, -whether the defect is that something is wrong with user-defined -functionality and std, or whether it's that the standard library does -not provide an operator<< for std::pair<>. -

      - -

      Proposed resolution:

      - -

      Adopt the wording proposed in Howard Hinnant's paper - N1523=03-0106, "Proposed Resolution To LWG issues 225, 226, 229".

      - - -

      [Tokyo: Summary, "There is no conforming way to extend -std::swap for user defined templates."  The LWG agrees that -there is a problem. Would like more information before -proceeding. This may be a core issue. Core issue 229 has been opened -to discuss the core aspects of this problem. It was also noted that -submissions regarding this issue have been received from several -sources, but too late to be integrated into the issues list. -]

      - -

      [Post-Tokyo: A paper with several proposed resolutions, -J16/00-0029==WG21/N1252, "Shades of namespace std functions -" by Alan Griffiths, is in the Post-Tokyo mailing. It -should be considered a part of this issue.]

      - -

      [Toronto: Dave Abrahams and Peter Dimov have proposed a -resolution that involves core changes: it would add partial -specialization of function template. The Core Working Group is -reluctant to add partial specialization of function templates. It is -viewed as a large change, CWG believes that proposal presented leaves -some syntactic issues unanswered; if the CWG does add partial -specialization of function templates, it wishes to develop its own -proposal. The LWG continues to believe that there is a serious -problem: there is no good way for users to force the library to use -user specializations of generic standard library functions, and in -certain cases (e.g. transcendental functions called by -valarray and complex) this is important. Koenig -lookup isn't adequate, since names within the library must be -qualified with std (see issue 225), specialization doesn't -work (we don't have partial specialization of function templates), and -users aren't permitted to add overloads within namespace std. -]

      - -

      [Copenhagen: Discussed at length, with no consensus. Relevant -papers in the pre-Copenhagen mailing: N1289, N1295, N1296. Discussion -focused on four options. (1) Relax restrictions on overloads within -namespace std. (2) Mandate that the standard library use unqualified -calls for swap and possibly other functions. (3) Introduce -helper class templates for swap and possibly other functions. -(4) Introduce partial specialization of function templates. Every -option had both support and opposition. Straw poll (first number is -support, second is strongly opposed): (1) 6, 4; (2) 6, 7; (3) 3, 8; -(4) 4, 4.]

      - -

      [Redmond: Discussed, again no consensus. Herb presented an -argument that a user who is defining a type T with an -associated swap should not be expected to put that -swap in namespace std, either by overloading or by partial -specialization. The argument is that swap is part of -T's interface, and thus should to in the same namespace as -T and only in that namespace. If we accept this argument, -the consequence is that standard library functions should use -unqualified call of swap. (And which other functions? Any?) -A small group (Nathan, Howard, Jeremy, Dave, Matt, Walter, Marc) will -try to put together a proposal before the next meeting.]

      - -

      [Curaçao: An LWG-subgroup spent an afternoon working on issues -225, 226, and 229. Their conclusion was that the issues should be -separated into an LWG portion (Howard's paper, N1387=02-0045), and a -EWG portion (Dave will write a proposal). The LWG and EWG had -(separate) discussions of this plan the next day. The proposed -resolution is the one proposed by Howard.]

      - -

      [Santa Cruz: the LWG agreed with the general direction of - Howard's paper, N1387. (Roughly: Koenig lookup is disabled unless - we say otherwise; this issue is about when we do say otherwise.) - However, there were concerns about wording. Howard will provide new - wording. Bill and Jeremy will review it.]

      - -

      [Kona: Howard proposed the new wording. The LWG accepted his - proposed resolution.]

      - -

      Rationale:

      -

      Informally: introduce a Swappable concept, and specify that the - value types of the iterators passed to certain standard algorithms - (such as iter_swap, swap_ranges, reverse, rotate, and sort) conform - to that concept. The Swappable concept will make it clear that - these algorithms use unqualified lookup for the calls - to swap. Also, in 26.3.3.3 [lib.valarray.transcend] paragraph 1, - state that the valarray transcendentals use unqualified lookup.

      -
      -

      233. Insertion hints in associative containers

      -Section: 23.1.2 [lib.associative.reqmts]  Status: Open  Submitter: Andrew Koenig  Date: 30 Apr 2000

      +

      233. Insertion hints in associative containers

      Section: 23.1.2 [lib.associative.reqmts]  Status: Open  Submitter: Andrew Koenig  Date: 30 Apr 2000

      If mm is a multimap and p is an iterator into the multimap, then mm.insert(p, x) inserts @@ -1543,8 +811,7 @@ can supply p, and the implementation is allowed to disregard it entirely.

      -

      -Additional comments from Nathan:
      +

      Additional comments from Nathan:
      The vote [in Redmond] was on whether to elaborately specify the use of the hint, or to require behavior only if the value could be inserted @@ -1557,7 +824,7 @@ proposed "before or after, if possible, otherwise [...]".

      Proposed resolution:

      -

      In table 69 "Associative Container Requirements" in 23.1.2 [lib.associative.reqmts], in the row for a.insert(p, t), +

      In table 69 "Associative Container Requirements" in 23.1.2 [lib.associative.reqmts], in the row for a.insert(p, t), change

      @@ -1614,12 +881,11 @@ you can do it efficiently enough with a red-black tree, but there are other (perhaps better) balanced tree techniques that might differ enough to make the detailed semantics hard to satisfy."]

      -

      [Curaçao: Nathan should give us the alternative wording he +

      [Curaçao: Nathan should give us the alternative wording he suggests so the LWG can decide between the two options.]


      -

      247. vector, deque::insert complexity

      -Section: 23.2.4.3 [lib.vector.modifiers]  Status: Open  Submitter: Lisa Lippincott  Date: 06 June 2000

      +

      247. vector, deque::insert complexity

      Section: 23.2.4.3 [lib.vector.modifiers]  Status: Open  Submitter: Lisa Lippincott  Date: 06 June 2000

      Paragraph 2 of 23.2.4.3 [lib.vector.modifiers] describes the complexity of vector::insert:

      @@ -1652,7 +918,7 @@ inserting at the end of the vector, and then using

      I looked to see if deque had a similar problem, and was surprised to find that deque places no requirement on the -complexity of inserting multiple elements (23.2.1.3 [lib.deque.modifiers], +complexity of inserting multiple elements (23.2.1.3 [lib.deque.modifiers], paragraph 3):

      @@ -1688,160 +954,150 @@ requirements that would imply any implementation technique more complicated than a while loop whose body is a single-element insert.]


      -

      253. valarray helper functions are almost entirely useless

      -Section: 26.3.2.1 [lib.valarray.cons], 26.3.2.2 [lib.valarray.assign]  Status: Ready  Submitter: Robert Klarer  Date: 31 Jul 2000

      -

      This discussion is adapted from message c++std-lib-7056 posted -November 11, 1999. I don't think that anyone can reasonably claim -that the problem described below is NAD.

      - -

      These valarray constructors can never be called:

      - -
         template <class T>
      -         valarray<T>::valarray(const slice_array<T> &);
      -   template <class T>
      -         valarray<T>::valarray(const gslice_array<T> &);
      -   template <class T>
      -         valarray<T>::valarray(const mask_array<T> &);
      -   template <class T>
      -         valarray<T>::valarray(const indirect_array<T> &);
      -
      +

      254. Exception types in clause 19 are constructed from std::string +

      Section: 19.1 [lib.std.exceptions]  Status: Open  Submitter: Dave Abrahams  Date: 01 Aug 2000

      +

      +Many of the standard exception types which implementations are +required to throw are constructed with a const std::string& +parameter. For example: +

      -

      Similarly, these valarray assignment operators cannot be -called:

      - -
           template <class T>
      -     valarray<T> valarray<T>::operator=(const slice_array<T> &);
      -     template <class T>
      -     valarray<T> valarray<T>::operator=(const gslice_array<T> &);
      -     template <class T>
      -     valarray<T> valarray<T>::operator=(const mask_array<T> &);
      -     template <class T>
      -     valarray<T> valarray<T>::operator=(const indirect_array<T> &);
      +
      +     19.1.5  Class out_of_range                          [lib.out.of.range]
      +     namespace std {
      +       class out_of_range : public logic_error {
      +       public:
      +         explicit out_of_range(const string& what_arg);
      +       };
      +     }
      +
      +   1 The class out_of_range defines the type of objects  thrown  as  excep-
      +     tions to report an argument value not in its expected range.
      +
      +     out_of_range(const string& what_arg);
      +
      +     Effects:
      +       Constructs an object of class out_of_range.
      +     Postcondition:
      +       strcmp(what(), what_arg.c_str()) == 0.
       
      -

      Please consider the following example:

      +

      +There are at least two problems with this: +

      +
        +
      1. A program which is low on memory may end up throwing +std::bad_alloc instead of out_of_range because memory runs out while +constructing the exception object.
      2. +
      3. An obvious implementation which stores a std::string data member +may end up invoking terminate() during exception unwinding because the +exception object allocates memory (or rather fails to) as it is being +copied.
      4. +
      -
         #include <valarray>
      -   using namespace std;
      +

      +There may be no cure for (1) other than changing the interface to +out_of_range, though one could reasonably argue that (1) is not a +defect. Personally I don't care that much if out-of-memory is reported +when I only have 20 bytes left, in the case when out_of_range would +have been reported. People who use exception-specifications might care +a lot, though. +

      - int main() - { - valarray<double> va1(12); - valarray<double> va2(va1[slice(1,4,3)]); // line 1 - } -
      +

      +There is a cure for (2), but it isn't completely obvious. I think a +note for implementors should be made in the standard. Avoiding +possible termination in this case shouldn't be left up to chance. The +cure is to use a reference-counted "string" implementation +in the exception object. I am not necessarily referring to a +std::string here; any simple reference-counting scheme for a NTBS +would do. +

      +

      Further discussion, in email:

      -

      Since the valarray va1 is non-const, the result of the sub-expression -va1[slice(1,4,3)] at line 1 is an rvalue of type const -std::slice_array<double>. This slice_array rvalue is then used to -construct va2. The constructor that is used to construct va2 is -declared like this:

      +

      +...I'm not so concerned about (1). After all, a library implementation +can add const char* constructors as an extension, and users don't +need to avail themselves of the standard exceptions, though this is +a lame position to be forced into. FWIW, std::exception and +std::bad_alloc don't require a temporary basic_string. +

      -
           template <class T>
      -     valarray<T>::valarray(const slice_array<T> &);
      -
      +

      +...I don't think the fixed-size buffer is a solution to the problem, +strictly speaking, because you can't satisfy the postcondition +
      +   strcmp(what(), what_arg.c_str()) == 0 +
      +For all values of what_arg (i.e. very long values). That means that +the only truly conforming solution requires a dynamic allocation. +

      -

      Notice the constructor's const reference parameter. When the -constructor is called, a slice_array must be bound to this reference. -The rules for binding an rvalue to a const reference are in 8.5.3, -paragraph 5 (see also 13.3.3.1.4). Specifically, paragraph 5 -indicates that a second slice_array rvalue is constructed (in this -case copy-constructed) from the first one; it is this second rvalue -that is bound to the reference parameter. Paragraph 5 also requires -that the constructor that is used for this purpose be callable, -regardless of whether the second rvalue is elided. The -copy-constructor in this case is not callable, however, because it is -private. Therefore, the compiler should report an error.

      - -

      Since slice_arrays are always rvalues, the valarray constructor that has a -parameter of type const slice_array<T> & can never be called. The -same reasoning applies to the three other constructors and the four -assignment operators that are listed at the beginning of this post. -Furthermore, since these functions cannot be called, the valarray helper -classes are almost entirely useless.

      -

      Proposed resolution:

      -

      slice_array:

      - +

      Further discussion, from Redmond:

      -

      gslice_array:

      - +

      The most important progress we made at the Redmond meeting was +realizing that there are two separable issues here: the const +string& constructor, and the copy constructor. If a user writes +something like throw std::out_of_range("foo"), the const +string& constructor is invoked before anything gets thrown. The +copy constructor is potentially invoked during stack unwinding.

      -

      mask_array:

      - +

      The copy constructor is a more serious problem, becuase failure +during stack unwinding invokes terminate. The copy +constructor must be nothrow. Curaçao: Howard thinks this +requirement is already present.

      + +

      The fundamental problem is that it's difficult to get the nothrow +requirement to work well with the requirement that the exception +objects store a string of unbounded size, particularly if you also try +to make the const string& constructor nothrow. Options discussed +include:

      -

      indirect_array:

        -
      • Make the copy constructor and copy-assignment operator declarations - public in the indirect_array class definition in 26.3.9 [lib.template.indirect.array] -
      • -
      • remove the note in paragraph 2 of 26.3.9 [lib.template.indirect.array] -
      • -
      • remove the copy constructor declaration from 26.3.9.1 [lib.indirect.array.cons] -
      • -
      • change the descriptive text in 26.3.9.1 [lib.indirect.array.cons] to read "This constructor is - declared to be private. This constructor need not be defined."
      • -
      • remove the first sentence of paragraph 1 of 26.3.9.2 [lib.indirect.array.assign] -
      • -
      • Change the first three words of the second sentence of paragraph 1 of - 26.3.9.2 [lib.indirect.array.assign] to "These assignment operators have"
      • +
      • Limit the size of a string that exception objects are required to +throw: change the postconditions of 19.1.2 [lib.domain.error] paragraph 3 +and 19.1.6 [lib.runtime.error] paragraph 3 to something like this: +"strncmp(what(), what_arg._str(), N) == 0, where N is an +implementation defined constant no smaller than 256".
      • +
      • Allow the const string& constructor to throw, but not the +copy constructor. It's the implementor's responsibility to get it +right. (An implementor might use a simple refcount class.)
      • +
      • Compromise between the two: an implementation is not allowed to +throw if the string's length is less than some N, but, if it doesn't +throw, the string must compare equal to the argument.
      • +
      • Add a new constructor that takes a const char*
      -

      [Proposed resolution was modified in Santa Cruz: explicitly make -copy constructor and copy assignment operators public, instead of -removing them.]

      + +

      (Not all of these options are mutually exclusive.)

      + +

      Proposed resolution:

      Rationale:

      -

      Keeping the valarray constructors private is untenable. Merely -making valarray a friend of the helper classes isn't good enough, -because access to the copy constructor is checked in the user's -environment.

      - -

      Making the assignment operator public is not strictly necessary to -solve this problem. A majority of the LWG (straw poll: 13-4) -believed we should make the assignment operators public, in addition -to the copy constructors, for reasons of symmetry and user -expectation.

      + +

      Throwing a bad_alloc while trying to construct a message for another +exception-derived class is not necessarily a bad thing. And the +bad_alloc constructor already has a no throw spec on it (18.4.2.1).

      + +

      +The copy constructors of all exception-derived classes already have a +no throw spec. Reference 18.6.1, 19.1 and 15.4/13. +

      + +

      Future:

      + +

      All involved would like to see const char* constructors added, but +this should probably be done for C++0X as opposed to a DR.

      + +

      I believe the no throw specs currently decorating these functions +could be improved by some kind of static no throw spec checking +mechanism (in a future C++ language). As they stand, the copy +constructors might fail via a call to unexpected. I think what is +intended here is that the copy constructors can't fail.

      + +

      [Pre-Sydney: reopened at the request of Howard Hinnant.]

      +
      -

      258. Missing allocator requirement

      -Section: 20.1.5 [lib.allocator.requirements]  Status: Open  Submitter: Matt Austern  Date: 22 Aug 2000

      +

      258. Missing allocator requirement

      Section: 20.1.5 [lib.allocator.requirements]  Status: Open  Submitter: Matt Austern  Date: 22 Aug 2000

      From lib-7752:

      @@ -1910,11 +1166,10 @@ the second line from the bottom in table 32 already implies the desired property. This issue should be considered in light of other issues related to allocator instances.]


      -

      280. Comparison of reverse_iterator to const reverse_iterator

      -Section: 24.4.1 [lib.reverse.iterators]  Status: Open  Submitter: Steve Cleary  Date: 27 Nov 2000

      +

      280. Comparison of reverse_iterator to const reverse_iterator

      Section: 24.4.1 [lib.reverse.iterators]  Status: Open  Submitter: Steve Cleary  Date: 27 Nov 2000

      This came from an email from Steve Cleary to Fergus in reference to -issue 179. The library working group briefly discussed +issue 179. The library working group briefly discussed this in Toronto and believed it should be a separate issue. There was also some reservations about whether this was a worthwhile problem to fix. @@ -1935,9 +1190,10 @@ that, I don't see how any user code could break."

      Proposed resolution:

      -Section: 24.4.1.1 [lib.reverse.iterator] +Section: 24.4.1.1 [lib.reverse.iterator] add/change the following declarations:

      -
        A) Add a templated assignment operator, after the same manner
      +
      +  A) Add a templated assignment operator, after the same manner
               as the templated copy constructor, i.e.:
       
         template < class U >
      @@ -1961,7 +1217,7 @@ add/change the following declarations:

      Also make the addition/changes for these signatures in -24.4.1.3 [lib.reverse.iter.ops]. +24.4.1.3 [lib.reverse.iter.ops].

      [ @@ -1973,156 +1229,7 @@ desirable to provide this feature in a different way. ]


      -

      283. std::replace() requirement incorrect/insufficient

      -Section: 25.2.4 [lib.alg.replace]  Status: Ready  Submitter: Martin Sebor  Date: 15 Dec 2000

      -

      -(revision of the further discussion) -There are a number of problems with the requires clauses for the -algorithms in 25.1 and 25.2. The requires clause of each algorithm -should describe the necessary and sufficient requirements on the inputs -to the algorithm such that the algorithm compiles and runs properly. -Many of the requires clauses fail to do this. Here is a summary of the kinds -of mistakes: -

      - -
        -
      1. -Use of EqualityComparable, which only puts requirements on a single -type, when in fact an equality operator is required between two -different types, typically either T and the iterator's value type -or between the value types of two different iterators. -
      2. -
      3. -Use of Assignable for T when in fact what was needed is Assignable -for the value_type of the iterator, and convertability from T to the -value_type of the iterator. Or for output iterators, the requirement -should be that T is writable to the iterator (output iterators do -not have value types). -
      4. -
      - -

      -Here is the list of algorithms that contain mistakes: -

      - -
        -
      • 25.1.2 std::find
      • -
      • 25.1.6 std::count
      • -
      • 25.1.8 std::equal
      • -
      • 25.1.9 std::search, std::search_n
      • -
      • 25.2.4 std::replace, std::replace_copy
      • -
      • 25.2.5 std::fill
      • -
      • 25.2.7 std::remove, std::remove_copy
      • -
      - -

      -Also, in the requirements for EqualityComparable, the requirement that -the operator be defined for const objects is lacking. -

      - -

      Proposed resolution:

      - -

      20.1.1 Change p1 from

      - -

      In Table 28, T is a type to be supplied by a C++ program -instantiating a template, a, b, and c are -values of type T. -

      - -

      to

      - -

      -In Table 28, T is a type to be supplied by a C++ program -instantiating a template, a, b, and c are -values of type const T. -

      - -

      25 Between p8 and p9

      - -

      Add the following sentence:

      - -

      When the description of an algorithm gives an expression such as -*first == value for a condition, it is required that the expression -evaluate to either true or false in boolean contexts.

      - -

      25.1.2 Change p1 by deleting the requires clause.

      - -

      25.1.6 Change p1 by deleting the requires clause.

      - -

      25.1.9

      - -

      Change p4 from

      - -

      -4- Requires: Type T is EqualityComparable -(20.1.1), type Size is convertible to integral type (4.7.12.3). -

      - -

      to

      - -

      -4- Requires: The type Size is convertible to integral -type (4.7.12.3).

      - -

      25.2.4 Change p1 from

      - -

      -1- Requires: Type T is Assignable (23.1 ) (and, for replace(), EqualityComparable (20.1.1 )).

      - -

      to

      - -

      -1- Requires: The expression *first = new_value must be valid.

      - -

      and change p4 from

      - -

      -4- Requires: Type T is Assignable (23.1) (and, -for replace_copy(), EqualityComparable -(20.1.1)). The ranges [first, last) and [result, result + -(last - first)) shall not overlap.

      - -

      to

      - -

      -4- Requires: The results of the expressions *first and -new_value must be writable to the result output iterator. The -ranges [first, last) and [result, result + (last - -first)) shall not overlap.

      - - -

      25.2.5 Change p1 from

      - -

      -1- Requires: Type T is Assignable (23.1). The -type Size is convertible to an integral type (4.7.12.3).

      - -

      to

      - -

      -1- Requires: The expression value must be is writable to -the output iterator. The type Size is convertible to an -integral type (4.7.12.3).

      - -

      25.2.7 Change p1 from

      - -

      -1- Requires: Type T is EqualityComparable (20.1.1).

      - -

      to

      - -

      --1- Requires: The value type of the iterator must be -Assignable (23.1). -

      - -

      Rationale:

      -

      -The general idea of the proposed solution is to remove the faulty -requires clauses and let the returns and effects clauses speak for -themselves. That is, the returns clauses contain expressions that must -be valid, and therefore already imply the correct requirements. In -addition, a sentence is added at the beginning of chapter 25 saying -that expressions given as conditions must evaluate to true or false in -a boolean context. An alternative would be to say that the type of -these condition expressions must be literally bool, but that would be -imposing a greater restriction that what the standard currently says -(which is convertible to bool). -

      -
      -

      290. Requirements to for_each and its function object

      -Section: 25.1.1 [lib.alg.foreach]  Status: Open  Submitter: Angelika Langer  Date: 03 Jan 2001

      +

      290. Requirements to for_each and its function object

      Section: 25.1.1 [lib.alg.foreach]  Status: Open  Submitter: Angelika Langer  Date: 03 Jan 2001

      The specification of the for_each algorithm does not have a "Requires" section, which means that there are no restrictions imposed on the function object whatsoever. In essence it @@ -2150,7 +1257,7 @@ algorithm does not say so.

      Proposed resolution:

      Add a "Requires" section to section 25.1.1 similar to those proposed for transform and the numeric algorithms (see issue -242): +242):

      @@ -2166,116 +1273,14 @@ blanket statement in Clause 25, not just a special requirement for ]


      -

      291. Underspecification of set algorithms

      -Section: 25.3.5 [lib.alg.set.operations]  Status: Ready  Submitter: Matt Austern  Date: 03 Jan 2001

      -

      -The standard library contains four algorithms that compute set -operations on sorted ranges: set_union, set_intersection, -set_difference, and set_symmetric_difference. Each -of these algorithms takes two sorted ranges as inputs, and writes the -output of the appropriate set operation to an output range. The elements -in the output range are sorted. -

      - -

      -The ordinary mathematical definitions are generalized so that they -apply to ranges containing multiple copies of a given element. Two -elements are considered to be "the same" if, according to an -ordering relation provided by the user, neither one is less than the -other. So, for example, if one input range contains five copies of an -element and another contains three, the output range of set_union -will contain five copies, the output range of -set_intersection will contain three, the output range of -set_difference will contain two, and the output range of -set_symmetric_difference will contain two. -

      - -

      -Because two elements can be "the same" for the purposes -of these set algorithms, without being identical in other respects -(consider, for example, strings under case-insensitive comparison), -this raises a number of unanswered questions: -

      - -
        -
      • If we're copying an element that's present in both of the -input ranges, which one do we copy it from?
      • -
      • If there are n copies of an element in the relevant -input range, and the output range will contain fewer copies (say -m) which ones do we choose? The first m, or the last -m, or something else?
      • -
      • Are these operations stable? That is, does a run of equivalent -elements appear in the output range in the same order as as it -appeared in the input range(s)?
      • -
      - -

      -The standard should either answer these questions, or explicitly -say that the answers are unspecified. I prefer the former option, -since, as far as I know, all existing implementations behave the -same way. -

      - -

      Proposed resolution:

      - -

      Add the following to the end of 25.3.5.2 [lib.set.union] paragraph 5:

      -
      -If [first1, last1) contains m elements that are equivalent to -each other and [first2, last2) contains n elements that are -equivalent to them, then max(m, n) of these elements -will be copied to the output range: all m of these elements -from [first1, last1), and the last max(n-m, 0) of them from -[first2, last2), in that order. -
      - -

      Add the following to the end of 25.3.5.3 [lib.set.intersection] paragraph 5:

      -
      -If [first1, last1) contains m elements that are equivalent to each -other and [first2, last2) contains n elements that are -equivalent to them, the first min(m, n) of those -elements from [first1, last1) are copied to the output range. -
      - -

      Add a new paragraph, Notes, after 25.3.5.4 [lib.set.difference] -paragraph 4:

      -
      -If [first1, last1) contains m elements that are equivalent to each -other and [first2, last2) contains n elements that are -equivalent to them, the last max(m-n, 0) elements from -[first1, last1) are copied to the output range. -
      - -

      Add a new paragraph, Notes, after 25.3.5.5 [lib.set.symmetric.difference] -paragraph 4:

      -
      -If [first1, last1) contains m elements that are equivalent to -each other and [first2, last2) contains n elements that are -equivalent to them, then |m - n| of those elements will be -copied to the output range: the last m - n of these elements -from [first1, last1) if m > n, and the last n - -m of these elements from [first2, last2) if m < n. -
      - -

      [Santa Cruz: it's believed that this language is clearer than - what's in the Standard. However, it's also believed that the - Standard may already make these guarantees (although not quite in - these words). Bill and Howard will check and see whether they think - that some or all of these changes may be redundant. If so, we may - close this issue as NAD.]

      - -

      Rationale:

      -

      For simple cases, these descriptions are equivalent to what's - already in the Standard. For more complicated cases, they describe - the behavior of existing implementations.

      -
      -

      294. User defined macros and standard headers

      -Section: 17.4.3.1.1 [lib.macro.names]  Status: Open  Submitter: James Kanze  Date: 11 Jan 2001

      -

      Paragraph 2 of 17.4.3.1.1 [lib.macro.names] reads: "A +

      294. User defined macros and standard headers

      Section: 17.4.3.1.1 [lib.macro.names]  Status: Open  Submitter: James Kanze  Date: 11 Jan 2001

      +

      Paragraph 2 of 17.4.3.1.1 [lib.macro.names] reads: "A translation unit that includes a header shall not contain any macros that define names declared in that header." As I read this, it would mean that the following program is legal:

      -
        #define npos 3.14
      +
      +  #define npos 3.14
         #include <sstream>
       
      @@ -2286,31 +1291,30 @@ which <sstream> didn't include <string>.

      I think that this phrase was probably formulated before it was decided that a standard header may freely include other standard headers. The phrase would be perfectly appropriate for C, for -example. In light of 17.4.4.1 [lib.res.on.headers] paragraph 1, however, +example. In light of 17.4.4.1 [lib.res.on.headers] paragraph 1, however, it isn't stringent enough.

      Proposed resolution:

      -

      In paragraph 2 of 17.4.3.1.1 [lib.macro.names], change "A +

      In paragraph 2 of 17.4.3.1.1 [lib.macro.names], change "A translation unit that includes a header shall not contain any macros that define names declared in that header." to "A translation unit that includes a header shall not contain any macros that define names declared in any standard header."

      [Copenhagen: the general idea is clearly correct, but there is -concern about making sure that the two paragraphs in 17.4.3.1.1 [lib.macro.names] remain consistent. Nathan will provide new +concern about making sure that the two paragraphs in 17.4.3.1.1 [lib.macro.names] remain consistent. Nathan will provide new wording.]


      -

      299. Incorrect return types for iterator dereference

      -Section: 24.1.4 [lib.bidirectional.iterators], 24.1.5 [lib.random.access.iterators]  Status: Open  Submitter: John Potter  Date: 22 Jan 2001

      +

      299. Incorrect return types for iterator dereference

      Section: 24.1.4 [lib.bidirectional.iterators], 24.1.5 [lib.random.access.iterators]  Status: Open  Submitter: John Potter  Date: 22 Jan 2001

      -In section 24.1.4 [lib.bidirectional.iterators], +In section 24.1.4 [lib.bidirectional.iterators], Table 75 gives the return type of *r-- as convertible to T. This is not consistent with Table 74 which gives the return type of *r++ as T&. *r++ = t is valid while *r-- = t is invalid.

      -In section 24.1.5 [lib.random.access.iterators], +In section 24.1.5 [lib.random.access.iterators], Table 76 gives the return type of a[n] as convertible to T. This is not consistent with the semantics of *(a + n) which returns T& by Table 74. *(a + n) = t is valid while a[n] = t is invalid. @@ -2401,12 +1405,11 @@ with a return type of convertible to T and operational semantics of


      -

      309. Does sentry catch exceptions?

      -Section: 27.6 [lib.iostream.format]  Status: Open  Submitter: Martin Sebor  Date: 19 Mar 2001

      +

      309. Does sentry catch exceptions?

      Section: 27.6 [lib.iostream.format]  Status: Open  Submitter: Martin Sebor  Date: 19 Mar 2001

      The descriptions of the constructors of basic_istream<>::sentry -(27.6.1.1.2 [lib.istream::sentry]) and basic_ostream<>::sentry -(27.6.2.3 [lib.ostream::sentry]) do not explain what the functions do in +(27.6.1.1.2 [lib.istream::sentry]) and basic_ostream<>::sentry +(27.6.2.3 [lib.ostream::sentry]) do not explain what the functions do in case an exception is thrown while they execute. Some current implementations allow all exceptions to propagate, others catch them and set ios_base::badbit instead, still others catch some but let @@ -2417,16 +1420,16 @@ others propagate. The text also mentions that the functions may call setstate(failbit) (without actually saying on what object, but presumably the stream argument is meant). That may have been fine for -basic_istream<>::sentry prior to issue 195, since +basic_istream<>::sentry prior to issue 195, since the function performs an input operation which may fail. However, -issue 195 amends 27.6.1.1.2 [lib.istream::sentry], p2 to +issue 195 amends 27.6.1.1.2 [lib.istream::sentry], p2 to clarify that the function should actually call setstate(failbit | eofbit), so the sentence in p3 is redundant or even somewhat contradictory.

      -The same sentence that appears in 27.6.2.3 [lib.ostream::sentry], p3 +The same sentence that appears in 27.6.2.3 [lib.ostream::sentry], p3 doesn't seem to be very meaningful for basic_istream<>::sentry which performs no input. It is actually rather misleading since it would appear to guide library implementers to calling @@ -2435,8 +1438,7 @@ throws an exception (typically, it's badbit that's set in response to such an event).

      -

      -Additional comments from Martin, who isn't comfortable with the +

      Additional comments from Martin, who isn't comfortable with the current proposed resolution (see c++std-lib-11530)

      @@ -2519,7 +1521,8 @@ badbit is also set in exceptions().

      [1] Extractor that catches exceptions thrown from sentry:

      -
      struct S { long i; };
      +
      +struct S { long i; };
       
       istream& operator>> (istream &strm, S &s)
       {
      @@ -2555,7 +1558,8 @@ istream& operator>> (istream &strm, S &s)
       

      [2] Extractor that propagates exceptions thrown from sentry:

      -
      istream& operator>> (istream &strm, S &s)
      +
      +istream& operator>> (istream &strm, S &s)
       {
           istream::sentry guard (strm, false);
           if (guard) {
      @@ -2593,7 +1597,8 @@ result of a call to strm.clear().
       

      -
      istream& operator>> (istream &strm, S &s)
      +
      +istream& operator>> (istream &strm, S &s)
       {
           const ios::iostate state = strm.rdstate ();
           const ios::iostate except = strm.exceptions ();
      @@ -2632,9 +1637,9 @@ result of a call to strm.clear().
       
       
       

      Proposed resolution:

      -

      Remove the last sentence of 27.6.1.1.2 [lib.istream::sentry] p5 (but not +

      Remove the last sentence of 27.6.1.1.2 [lib.istream::sentry] p5 (but not the footnote, which should be moved to the preceding sentence).

      -

      Remove the last sentence of 27.6.2.3 [lib.ostream::sentry] p3 (but not +

      Remove the last sentence of 27.6.2.3 [lib.ostream::sentry] p3 (but not the footnote, which should be moved to the preceding sentence).

      Rationale:

      The LWG feels that no clarification of EH policy is necessary: the @@ -2642,12 +1647,11 @@ result of a call to strm.clear(). performs, and about which of those operations can throw. However, the sentence at the end should be removed because it's redundant.


      -

      342. seek and eofbit

      -Section: 27.6.1.3 [lib.istream.unformatted]  Status: Open  Submitter: Howard Hinnant  Date: 09 Oct 201

      +

      342. seek and eofbit

      Section: 27.6.1.3 [lib.istream.unformatted]  Status: Open  Submitter: Howard Hinnant  Date: 09 Oct 201

      I think we have a defect.

      -

      According to lwg issue 60 which is now a dr, the -description of seekg in 27.6.1.3 [lib.istream.unformatted] paragraph 38 now looks +

      According to lwg issue 60 which is now a dr, the +description of seekg in 27.6.1.3 [lib.istream.unformatted] paragraph 38 now looks like:

      @@ -2655,10 +1659,10 @@ Behaves as an unformatted input function (as described in 27.6.1.3, paragraph 1), except that it does not count the number of characters extracted and does not affect the value returned by subsequent calls to gcount(). After constructing a sentry object, if fail() != true, -executes rdbuf()­>pubseekpos( pos). +executes rdbuf()­>pubseekpos( pos).
      -

      And according to lwg issue 243 which is also now a dr, +

      And according to lwg issue 243 which is also now a dr, 27.6.1.3, paragraph 1 looks like:

      @@ -2723,216 +1727,12 @@ examined by the user to determine why something failed.

      and propose a resolution.]


      -

      347. locale::category and bitmask requirements

      -Section: 22.1.1.1.1 [lib.locale.category]  Status: Ready  Submitter: P.J. Plauger, Nathan Myers  Date: 23 Oct 2001

      -

      -In 22.1.1.1.1 [lib.locale.category] paragraph 1, the category members -are described as bitmask elements. In fact, the bitmask requirements -in 17.3.2.1.2 [lib.bitmask.types] don't seem quite right: none -and all are bitmask constants, not bitmask elements.

      - -

      In particular, the requirements for none interact poorly -with the requirement that the LC_* constants from the C library must -be recognizable as C++ locale category constants. LC_* values should -not be mixed with these values to make category values.

      - -

      We have two options for the proposed resolution. Informally: -option 1 removes the requirement that LC_* values be recognized as -category arguments. Option 2 changes the category type so that this -requirement is implementable, by allowing none to be some -value such as 0x1000 instead of 0.

      - -

      Nathan writes: "I believe my proposed resolution [Option 2] merely -re-expresses the status quo more clearly, without introducing any -changes beyond resolving the DR.

      - -

      Proposed resolution:

      -

      Replace the first two paragraphs of 22.1.1.1 [lib.locale.types] with:

      -
      -
          typedef int category;
      -
      - -

      Valid category values include the locale member bitmask -elements collate, ctype, monetary, -numeric, time, and messages, each of which -represents a single locale category. In addition, locale member -bitmask constant none is defined as zero and represents no -category. And locale member bitmask constant all is defined such that -the expression

      -
          (collate | ctype | monetary | numeric | time | messages | all) == all
      -
      -

      -is true, and represents the union of all categories. Further -the expression (X | Y), where X and Y each -represent a single category, represents the union of the two -categories. -

      - -

      -locale member functions expecting a category -argument require one of the category values defined above, or -the union of two or more such values. Such a category -argument identifies a set of locale categories. Each locale category, -in turn, identifies a set of locale facets, including at least those -shown in Table 51: -

      -
      -

      [Curaçao: need input from locale experts.]

      - -

      Rationale:

      - -

      The LWG considered, and rejected, an alternate proposal (described - as "Option 2" in the discussion). The main reason for rejecting it - was that library implementors were concerened about implementation - difficult, given that getting a C++ library to work smoothly with a - separately written C library is already a delicate business. Some - library implementers were also concerned about the issue of adding - extra locale categories.

      - -
      -

      -Option 2:
      -Replace the first paragraph of 22.1.1.1 [lib.locale.types] with:

      -
      -

      -Valid category values include the enumerated values. In addition, the -result of applying commutative operators | and & to any two valid -values is valid, and results in the setwise union and intersection, -respectively, of the argument categories. The values all and -none are defined such that for any valid value cat, the -expressions (cat | all == all), (cat & all == cat), -(cat | none == cat) and (cat & none == none) are -true. For non-equal values cat1 and cat2 of the -remaining enumerated values, (cat1 & cat2 == none) is true. -For any valid categories cat1 and cat2, the result -of (cat1 & ~cat2) is valid, and equals the setwise union of -those categories found in cat1 but not found in cat2. -[Footnote: it is not required that all equal the setwise union -of the other enumerated values; implementations may add extra categories.] -

      -
      -
      -
      -

      352. missing fpos requirements

      -Section: 21.1.2 [lib.char.traits.typedefs]  Status: Ready  Submitter: Martin Sebor  Date: 2 Dec 2001

      -

      -(1) -There are no requirements on the stateT template parameter of -fpos listed in 27.4.3. The interface appears to require that -the type be at least Assignable and CopyConstructible (27.4.3.1, p1), -and I think also DefaultConstructible (to implement the operations in -Table 88). -

      -

      -21.1.2, p3, however, only requires that -char_traits<charT>::state_type meet the requirements of -CopyConstructible types. -

      -

      -(2) -Additionally, the stateT template argument has no -corresponding typedef in fpos which might make it difficult to use in -generic code. -

      -

      Proposed resolution:

      -

      -Modify 21.1.2, p4 from -

      -

      - Requires: state_type shall meet the requirements of - CopyConstructible types (20.1.3). -

      -

      - Requires: state_type shall meet the requirements of Assignable - (23.1, p4), CopyConstructible (20.1.3), and - DefaultConstructible (20.1.4) types. -

      - -

      Rationale:

      -

      The LWG feels this is two issues, as indicated above. The first is -a defect---std::basic_fstream is unimplementable without these -additional requirements---and the proposed resolution fixes it. The -second is questionable; who would use that typedef? The class -template fpos is used only in a very few places, all of which know the -state type already. Unless motivation is provided, the second should -be considered NAD.

      -
      -

      355. Operational semantics for a.back()

      -Section: 23.1.1 [lib.sequence.reqmts]  Status: Ready  Submitter: Yaroslav Mironov  Date: 23 Jan 2002

      - -

      Table 68 "Optional Sequence Operations" in 23.1.1/12 -specifies operational semantics for "a.back()" as -"*--a.end()", which may be ill-formed [because calling -operator-- on a temporary (the return) of a built-in type is -ill-formed], provided a.end() returns a simple pointer rvalue -(this is almost always the case for std::vector::end(), for -example). Thus, the specification is not only incorrect, it -demonstrates a dangerous construct: "--a.end()" may -successfully compile and run as intended, but after changing the type -of the container or the mode of compilation it may produce -compile-time error.

      - -

      Proposed resolution:

      -

      Change the specification in table 68 "Optional Sequence -Operations" in 23.1.1/12 for "a.back()" from

      - - -
      -*--a.end() -
      - -

      to

      - -
      - { iterator tmp = a.end(); --tmp; return *tmp; } -
      - -

      and the specification for "a.pop_back()" from

      - -
      -a.erase(--a.end()) -
      - -

      to

      - -
      - { iterator tmp = a.end(); --tmp; a.erase(tmp); } -
      - -

      [Curaçao: LWG changed PR from "{ X::iterator tmp = -a.end(); return *--tmp; }" to "*a.rbegin()", and from -"{ X::iterator tmp = a.end(); a.erase(--tmp); }" to -"a.erase(rbegin())".]

      - -

      [There is a second possible defect; table 68 "Optional -Sequence Operations" in the "Operational Semantics" -column uses operations present only in the "Reversible -Container" requirements, yet there is no stated dependency -between these separate requirements tables. Ask in Santa Cruz if the -LWG would like a new issue opened.]

      - -

      [Santa Cruz: the proposed resolution is even worse than what's in - the current standard: erase is undefined for reverse iterator. If - we're going to make the change, we need to define a temporary and - use operator--. Additionally, we don't know how prevalent this is: - do we need to make this change in more than one place? Martin has - volunteered to review the standard and see if this problem occurs - elsewhere.]

      - -

      [Oxford: Matt provided new wording to address the concerns raised - in Santa Cruz. It does not appear that this problem appears - anywhere else in clauses 23 or 24.]

      - -

      [Kona: In definition of operational semantics of back(), change -"*tmp" to "return *tmp;"]

      - -
      -

      356. Meaning of ctype_base::mask enumerators

      -Section: 22.2.1 [lib.category.ctype]  Status: Open  Submitter: Matt Austern  Date: 23 Jan 2002

      +

      356. Meaning of ctype_base::mask enumerators

      Section: 22.2.1 [lib.category.ctype]  Status: Open  Submitter: Matt Austern  Date: 23 Jan 2002

      What should the following program print?

      -
        #include <locale>
      +
      +  #include <locale>
         #include <iostream>
       
         class my_ctype : public std::ctype<char>
      @@ -2972,7 +1772,7 @@ The above program assumes that ctype_base::mask enumerators like
       space and print are disjoint, and that the way to
       say that a character is both a space and a printing character is to or
       those two enumerators together.  This is suggested by the "exposition
      -only" values in 22.2.1  [lib.category.ctype], but it is nowhere specified in
      +only" values in 22.2.1  [lib.category.ctype], but it is nowhere specified in
       normative text.  An alternative interpretation is that the more
       specific categories subsume the less specific.  The above program
       gives the results it does on the Microsoft compiler because, on that
      @@ -2997,8 +1797,8 @@ lib-9224, lib-9226, lib-9229, lib-9270, lib-9272, lib-9273, lib-9274,
       lib-9277, lib-9279.
       

      -

      Issue 339 is related, but not identical. The -proposed resolution if issue 339 says that +

      Issue 339 is related, but not identical. The +proposed resolution if issue 339 says that ctype_base::mask must be a bitmask type. It does not say that the ctype_base::mask elements are bitmask elements, so it doesn't directly affect this issue.

      @@ -3008,7 +1808,8 @@ that C99 compatibility essentially requires what we're calling option 1 below.

      -
      I think the C99 standard is clear, that isspace -> !isalpha.
      +
      +I think the C99 standard is clear, that isspace -> !isalpha.
       --------
       
       #include <locale>
      @@ -3070,138 +1871,54 @@ option 1 is required for C99 compatibility.
       ]


      -

      359. num_put<>::do_put (..., bool) undocumented

      -Section: 22.2.2.2.1 [lib.facet.num.put.members]  Status: Ready  Submitter: Martin Sebor  Date: 12 Mar 2002

      -

      22.2.2.2.1, p1:

      - -
          iter_type put (iter_type out, ios_base& str, char_type fill,
      -                   bool val) const;
      -    ...
      -
      -    1   Returns: do_put (out, str, fill, val).
      -    
      +

      362. bind1st/bind2nd type safety

      Section: 20.3.6.2 [lib.bind.1st]  Status: Open  Submitter: Andrew Demkin  Date: 26 Apr 2002

      +

      +The definition of bind1st() (20.3.6.2 [lib.bind.1st]) can result in +the construction of an unsafe binding between incompatible pointer +types. For example, given a function whose first parameter type is +'pointer to T', it's possible without error to bind an argument of +type 'pointer to U' when U does not derive from T: +

      +
      +   foo(T*, int);
       
      -

      AFAICS, the behavior of do_put (..., bool) is not documented anywhere, -however, 22.2.2.2.2, p23:

      + struct T {}; + struct U {}; -
      -
      iter_type put (iter_type out, ios_base& str, char_type fill,
      -               bool val) const;
      -
      + U u; + int* p; + int* q; - Effects: If (str.flags() & ios_base::boolalpha) == 0 then do - out = do_put(out, str, fill, (int)val) - Otherwise do -
                   string_type s =
      -                 val ? use_facet<ctype<charT> >(loc).truename()
      -                     : use_facet<ctype<charT> >(loc).falsename();
      +   for_each(p, q, bind1st(ptr_fun(foo), &u));    // unsafe binding
       
      - and then insert the characters of s into out. out. -

      -This means that the bool overload of do_put() will never be called, -which contradicts the first paragraph. Perhaps the declaration -should read do_put(), and not put()? +The definition of bind1st() includes a functional-style conversion to +map its argument to the expected argument type of the bound function +(see below):

      +
      +  typename Operation::first_argument_type(x)
      +

      -Note also that there is no Returns clause for this function, which -should probably be corrected, just as should the second occurrence -of "out." in the text. +A functional-style conversion (5.2.3 [expr.type.conv]) is defined to be +semantically equivalent to an explicit cast expression (5.4 [expr.cast]), which may (according to 5.4, paragraph 5) be interpreted +as a reinterpret_cast, thus masking the error.

      -

      -I think the least invasive change to fix it would be something like -the following: -

      +

      The problem and proposed change also apply to 20.3.6.4 [lib.bind.2nd].

      Proposed resolution:

      -

      In 22.2.2.2.2 [lib.facet.num.put.virtuals], just above paragraph 1, remove - the bool overload.

      -

      -In 22.2.2.2.2 [lib.facet.num.put.virtuals], p23, make the following changes +The simplest and most localized change to prevent such errors is to +require bind1st() use a static_cast expression rather than the +functional-style conversion; that is, have bind1st() return:

      - -
      - Replace put() with do_put() in the declaration - of the member function. -
      - -
      - Change the Effects clause to a Returns clause (to - avoid the requirement to call do_put(..., int) from - do_put (..., bool)) - like so: -
      - -
      - 23 Returns: If (str.flags() & - ios_base::boolalpha) == 0 then - do_put (out, str, fill, (long)val) - Otherwise the function obtains a string s as if by -
                   string_type s =
      -                val ? use_facet<ctype<charT> >(loc).truename()
      -                    : use_facet<ctype<charT> >(loc).falsename();
      -
      - and then inserts each character c of s into out via - *out++ = c - and returns out. -
      - -

      Rationale:

      -

      -This fixes a couple of obvious typos, and also fixes what appears to -be a requirement of gratuitous inefficiency. -

      -
      -

      362. bind1st/bind2nd type safety

      -Section: 20.3.6.2 [lib.bind.1st]  Status: Open  Submitter: Andrew Demkin  Date: 26 Apr 2002

      -

      -The definition of bind1st() (20.3.6.2 [lib.bind.1st]) can result in -the construction of an unsafe binding between incompatible pointer -types. For example, given a function whose first parameter type is -'pointer to T', it's possible without error to bind an argument of -type 'pointer to U' when U does not derive from T: -

      -
         foo(T*, int);
      -
      -   struct T {};
      -   struct U {};
      -
      -   U u;
      -
      -   int* p;
      -   int* q;
      -
      -   for_each(p, q, bind1st(ptr_fun(foo), &u));    // unsafe binding
      -
      - -

      -The definition of bind1st() includes a functional-style conversion to -map its argument to the expected argument type of the bound function -(see below): -

      -
        typename Operation::first_argument_type(x)
      -
      - -

      -A functional-style conversion (5.2.3 [expr.type.conv]) is defined to be -semantically equivalent to an explicit cast expression (5.4 [expr.cast]), which may (according to 5.4, paragraph 5) be interpreted -as a reinterpret_cast, thus masking the error. -

      - -

      The problem and proposed change also apply to 20.3.6.4 [lib.bind.2nd].

      -

      Proposed resolution:

      -

      -The simplest and most localized change to prevent such errors is to -require bind1st() use a static_cast expression rather than the -functional-style conversion; that is, have bind1st() return: -

      -
         binder1st<Operation>( op,
      -     static_cast<typename Operation::first_argument_type>(x)).
      -
      +
      +   binder1st<Operation>( op,
      +     static_cast<typename Operation::first_argument_type>(x)).
      +

      A more agressive solution is to change the semantics of @@ -3223,49 +1940,7 @@ programming. all. Jeremy will check with the original author of this part of the Standard and will see what the original intent was.]


      -

      365. Lack of const-qualification in clause 27

      -Section: 27 [lib.input.output]  Status: Ready  Submitter: Walter Brown, Marc Paterno  Date: 10 May 2002

      -

      -Some stream and streambuf member functions are declared non-const, -even thought they appear only to report information rather than to -change an object's logical state. They should be declared const. See -document N1360 for details and rationale. -

      - -

      The list of member functions under discussion: in_avail, -showmanyc, tellg, tellp, is_open.

      - -

      Related issue: 73 -

      - -

      Proposed resolution:

      -

      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

      -

      Replace

      -
        bool is_open();
      -
      -

      with

      -
        bool is_open() const;
      -
      -

      Rationale:

      -

      Of the changes proposed in N1360, the only one that is safe is -changing the filestreams' is_open to const. The LWG believed that -this was NAD the first time it considered this issue (issue 73), but now thinks otherwise. The corresponding streambuf -member function, after all,is already const.

      - -

      The other proposed changes are less safe, because some streambuf -functions that appear merely to report a value do actually perform -mutating operations. It's not even clear that they should be -considered "logically const", because streambuf has two interfaces, a -public one and a protected one. These functions may, and often do, -change the state as exposed by the protected interface, even if the -state exposed by the public interface is unchanged.

      - -

      Note that implementers can make this change in a binary compatible -way by providing both overloads; this would be a conforming extension.

      - -
      -

      366. Excessive const-qualification

      -Section: 27 [lib.input.output]  Status: Open  Submitter: Walter Brown, Marc Paterno  Date: 10 May 2002

      +

      366. Excessive const-qualification

      Section: 27 [lib.input.output]  Status: Open  Submitter: Walter Brown, Marc Paterno  Date: 10 May 2002

      The following member functions are declared const, yet return non-const pointers. We believe they are should be changed, because they allow code @@ -3284,93 +1959,112 @@ those terms, does not appear in the standard.]

      Proposed resolution:

      In 27.4.4 and 27.4.4.2

      Replace

      -
        basic_ostream<charT,traits>* tie() const;
      +
      +  basic_ostream<charT,traits>* tie() const;
       

      with

      -
        basic_ostream<charT,traits>* tie();
      +
      +  basic_ostream<charT,traits>* tie();
         const basic_ostream<charT,traits>* tie() const;
       

      and replace

      -
        basic_streambuf<charT,traits>* rdbuf() const;
      +
      +  basic_streambuf<charT,traits>* rdbuf() const;
       

      with

      -
        basic_streambuf<charT,traits>* rdbuf();
      +
      +  basic_streambuf<charT,traits>* rdbuf();
         const basic_streambuf<charT,traits>* rdbuf() const;
       

      In 27.5.2 and 27.5.2.3.1

      Replace

      -
        char_type* eback() const;
      +
      +  char_type* eback() const;
       

      with

      -
        char_type* eback();
      +
      +  char_type* eback();
         const char_type* eback() const;
       

      Replace

      -
        char_type gptr() const;
      +
      +  char_type gptr() const;
       

      with

      -
        char_type* gptr();
      +
      +  char_type* gptr();
         const char_type* gptr() const;
       

      Replace

      -
        char_type* egptr() const;
      +
      +  char_type* egptr() const;
       

      with

      -
        char_type* egptr();
      +
      +  char_type* egptr();
         const char_type* egptr() const;
       

      In 27.5.2 and 27.5.2.3.2

      Replace

      -
        char_type* pbase() const;
      +
      +  char_type* pbase() const;
       

      with

      -
        char_type* pbase();
      +
      +  char_type* pbase();
         const char_type* pbase() const;
       

      Replace

      -
        char_type* pptr() const;
      +
      +  char_type* pptr() const;
       

      with

      -
        char_type* pptr();
      +
      +  char_type* pptr();
         const char_type* pptr() const;
       

      Replace

      -
        char_type* epptr() const;
      +
      +  char_type* epptr() const;
       

      with

      -
        char_type* epptr();
      +
      +  char_type* epptr();
         const char_type* epptr() const;
       

      In 27.7.2, 27.7.2.2, 27.7.3 27.7.3.2, 27.7.4, and 27.7.6

      Replace

      -
        basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
      +
      +  basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
       

      with

      -
        basic_stringbuf<charT,traits,Allocator>* rdbuf();
      +
      +  basic_stringbuf<charT,traits,Allocator>* rdbuf();
         const basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
       

      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

      Replace

      -
        basic_filebuf<charT,traits>* rdbuf() const;
      +
      +  basic_filebuf<charT,traits>* rdbuf() const;
       

      with

      -
        basic_filebuf<charT,traits>* rdbuf();
      +
      +  basic_filebuf<charT,traits>* rdbuf();
         const basic_filebuf<charT,traits>* rdbuf() const;
       

      -

      368. basic_string::replace has two "Throws" paragraphs

      -Section: 21.3.5.6 [lib.string::replace]  Status: Open  Submitter: Beman Dawes  Date: 3 Jun 2002

      +

      368. basic_string::replace has two "Throws" paragraphs

      Section: 21.3.5.6 [lib.string::replace]  Status: Open  Submitter: Beman Dawes  Date: 3 Jun 2002

      -21.3.5.6 [lib.string::replace] basic_string::replace, second +21.3.5.6 [lib.string::replace] basic_string::replace, second signature, given in paragraph 1, has two "Throws" paragraphs (3 and 5).

      @@ -3386,8 +2080,7 @@ part of the "Effects" paragraph. Someone who understands string replace well needs to work on this.]


      -

      369. io stream objects and static ctors

      -Section: 27.3 [lib.iostream.objects]  Status: Open  Submitter: Ruslan Abdikeev  Date: 8 Jul 2002

      +

      369. io stream objects and static ctors

      Section: 27.3 [lib.iostream.objects]  Status: Open  Submitter: Ruslan Abdikeev  Date: 8 Jul 2002

      Is it safe to use standard iostream objects from constructors of static objects? Are standard iostream objects constructed and are @@ -3453,17 +2146,19 @@ mention of an _instance_ of ios_base::Init in Standard.

      Proposed resolution:

      -At the end of header <iostream> synopsis in 27.3 [lib.iostream.objects] +At the end of header <iostream> synopsis in 27.3 [lib.iostream.objects]

      -
             namespace std
      +
      +       namespace std
              {
                 ... extern istream cin; ...
       

      add the following lines

      -
                namespace
      +
      +          namespace
                 {
                    ios_base::Init <some_implementation_defined_name>;
                 }
      @@ -3481,8 +2176,7 @@ wording that expreses this intent.]


      -

      371. Stability of multiset and multimap member functions

      -Section: 23.1 [lib.container.requirements]  Status: Open  Submitter: Frank Compagner  Date: 20 Jul 2002

      +

      371. Stability of multiset and multimap member functions

      Section: 23.1 [lib.container.requirements]  Status: Open  Submitter: Frank Compagner  Date: 20 Jul 2002

      The requirements for multiset and multimap containers (23.1 [lib.containers.requirements], 23.1.2 [lib.associative.reqmnts], @@ -3499,7 +2193,8 @@ following 'idiom' that removes elements based on a certain predicate function.

      -
        multimap<int, int> m;
      +
      +  multimap<int, int> m;
         multimap<int, int>::iterator i = m.begin();
         while (i != m.end()) {
             if (pred(i))
      @@ -3534,7 +2229,7 @@ be hard to track down by users. This would also make the need for an
       erase_if() member function that much greater.
       

      -

      This issue is somewhat related to LWG issue 130.

      +

      This issue is somewhat related to LWG issue 130.

      [Santa Cruz: More people need to look at this. Much user code may assume stability. On the other hand, it seems drastic to add a @@ -3542,10 +2237,9 @@ erase_if() member function that much greater.

      Proposed resolution:


      -

      376. basic_streambuf semantics

      -Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: Open  Submitter: Ray Lischner  Date: 14 Aug 2002

      +

      376. basic_streambuf semantics

      Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: Open  Submitter: Ray Lischner  Date: 14 Aug 2002

      -In Section 27.7.1.3 [lib.stringbuf.virtuals], Table 90, the implication is that +In Section 27.7.1.3 [lib.stringbuf.virtuals], Table 90, the implication is that the four conditions should be mutually exclusive, but they are not. The first two cases, as written, are subcases of the third. I think it would be clearer if the conditions were rewritten as follows: @@ -3583,19 +2277,20 @@ implementations before we decide on a solution.]

      Proposed resolution:


      -

      378. locale immutability and locale::operator=()

      -Section: 22.1.1 [lib.locale]  Status: Open  Submitter: Martin Sebor  Date: 6 Sep 2002

      +

      378. locale immutability and locale::operator=()

      Section: 22.1.1 [lib.locale]  Status: Open  Submitter: Martin Sebor  Date: 6 Sep 2002

      I think there is a problem with 22.1.1, p6 which says that

      -
          -6- An instance of locale is immutable; once a facet reference
      +
      +    -6- An instance of locale is immutable; once a facet reference
               is obtained from it, that reference remains usable as long
               as the locale value itself exists.
       

      and 22.1.1.2, p4:

      -
          const locale& operator=(const locale& other) throw();
      +
      +    const locale& operator=(const locale& other) throw();
       
           -4- Effects: Creates a copy of other, replacing the current value.
       
      @@ -3604,7 +2299,8 @@ How can a reference to a facet obtained from a locale object remain valid after an assignment that clearly must replace all the facets in the locale object? Imagine a program such as this

      -
          std::locale loc ("de_DE");
      +
      +    std::locale loc ("de_DE");
           const std::ctype<char> &r0 = std::use_facet<std::ctype<char> >(loc);
           loc = std::locale ("en_US");
           const std::ctype<char> &r1 = std::use_facet<std::ctype<char> >(loc);
      @@ -3615,9 +2311,10 @@ out of scope?
       

      Proposed resolution:

      -Suggest to replace 22.1.1 [lib.locale], p6 with +Suggest to replace 22.1.1 [lib.locale], p6 with

      -
          -6- Unless assigned a new value, locale objects are immutable;
      +
      +    -6- Unless assigned a new value, locale objects are immutable;
               once a facet reference is obtained from it, that reference
               remains usable as long as the locale object itself exists
               or until the locale object is assigned the value of another,
      @@ -3629,50 +2326,7 @@ uncomfortable about the proposed wording.  He and Martin will try to
       come up with better wording.]


      -

      379. nonsensical ctype::do_widen() requirement

      -Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: Ready  Submitter: Martin Sebor  Date: 6 Sep 2002

      -

      -The last sentence in 22.2.1.1.2, p11 below doesn't seem to make sense. -

      -
        charT do_widen (char c) const;
      -
      -  -11- Effects: Applies the simplest reasonable transformation from
      -       a char value or sequence of char values to the corresponding
      -       charT value or values. The only characters for which unique
      -       transformations are required are those in the basic source
      -       character set (2.2). For any named ctype category with a
      -       ctype<charT> facet ctw and valid ctype_base::mask value
      -       M (is(M, c) || !ctw.is(M, do_widen(c))) is true.
      -
      -

      -Shouldn't the last sentence instead read -

      -
             For any named ctype category with a ctype<char> facet ctc
      -       and valid ctype_base::mask value M
      -       (ctc.is(M, c) || !is(M, do_widen(c))) is true.
      -
      -

      -I.e., if the narrow character c is not a member of a class of -characters then neither is the widened form of c. (To paraphrase -footnote 224.) -

      -

      Proposed resolution:

      -

      -Replace the last sentence of 22.2.1.1.2 [lib.locale.ctype.virtuals], p11 with the -following text: -

      -
             For any named ctype category with a ctype<char> facet ctc
      -       and valid ctype_base::mask value M,
      -       (ctc.is(M, c) || !is(M, do_widen(c))) is true.
      -
      - -

      [Kona: Minor edit. Added a comma after the M for clarity.]

      - -

      Rationale:

      -

      The LWG believes this is just a typo, and that this is the correct fix.

      -
      -

      382. codecvt do_in/out result

      -Section: 22.2.1.5 [lib.locale.codecvt]  Status: Open  Submitter: Martin Sebor  Date: 30 Aug 2002

      +

      382. codecvt do_in/out result

      Section: 22.2.1.5 [lib.locale.codecvt]  Status: Open  Submitter: Martin Sebor  Date: 30 Aug 2002

      It seems that the descriptions of codecvt do_in() and do_out() leave sufficient room for interpretation so that two implementations of @@ -3697,7 +2351,7 @@ the following seems less than adequately specified:

      1. - 22.2.1.5.2 [lib.locale.codecvt.virtuals], p2 says this about the effects of the + 22.2.1.5.2 [lib.locale.codecvt.virtuals], p2 says this about the effects of the function: ...Stops if it encounters a character it cannot convert... This assumes that there *is* a character to convert. What happens when there is a sequence that doesn't form a @@ -3730,7 +2384,7 @@ the following seems less than adequately specified:

      -Finally, the conditions described at the end of 22.2.1.5.2 [lib.locale.codecvt.virtuals], p4 don't seem to be possible: +Finally, the conditions described at the end of 22.2.1.5.2 [lib.locale.codecvt.virtuals], p4 don't seem to be possible:

      "A return value of partial, if (from_next == from_end), @@ -3744,7 +2398,7 @@ If the value is partial, it's not clear to me that (from_next ==from_end) could ever hold if there isn't enough room in the destination buffer. In order for (from_next==from_end) to hold, all characters in that range must have been successfully -converted (according to 22.2.1.5.2 [lib.locale.codecvt.virtuals], p2) and since there are no +converted (according to 22.2.1.5.2 [lib.locale.codecvt.virtuals], p2) and since there are no further source characters to convert, no more room in the destination buffer can be needed.

      @@ -3774,10 +2428,11 @@ To address these issues, I propose that paragraphs 2, 3, and 4 be rewritten as follows. The proposal incorporates the accepted resolution of lwg issue 19.

      -
      -2- Effects: Converts characters in the range of source elements
      +
      +-2- Effects: Converts characters in the range of source elements
           [from, from_end), placing the results in sequential positions
      -    starting at destination to. Converts no more than (from_end ­ from)
      -    source elements, and stores no more than (to_limit ­ to)
      +    starting at destination to. Converts no more than (from_end ­ from)
      +    source elements, and stores no more than (to_limit ­ to)
           destination elements.
       
           Stops if it encounters a sequence of source elements it cannot
      @@ -3841,10 +2496,9 @@ written with the assumption of 1->N conversion in mind, not M->N.
       Bill, Howard, and Martin will provide new wording.
       ]


      -

      384. equal_range has unimplementable runtime complexity

      -Section: 25.3.3.3 [lib.equal.range]  Status: Open  Submitter: Hans Bos  Date: 18 Oct 2002

      +

      384. equal_range has unimplementable runtime complexity

      Section: 25.3.3.3 [lib.equal.range]  Status: Open  Submitter: Hans Bos  Date: 18 Oct 2002

      -Section 25.3.3.3 [lib.equal.range] +Section 25.3.3.3 [lib.equal.range] states that at most 2 * log(last - first) + 1 comparisons are allowed for equal_range.

      @@ -3852,7 +2506,8 @@ comparisons are allowed for equal_range.

      It is not possible to implement equal_range with these constraints.

      In a range of one element as in:

      -
          int x = 1;
      +
      +    int x = 1;
           equal_range(&x, &x + 1, 1)
       
      @@ -3862,7 +2517,8 @@ comparisons are allowed for equal_range.

      I have checked a few libraries and they all use the same (nonconforming) algorithm for equal_range that has a complexity of

      -
           2* log(distance(first, last)) + 2.
      +
      +     2* log(distance(first, last)) + 2.
       

      I guess this is the algorithm that the standard assumes for equal_range.

      @@ -3889,12 +2545,11 @@ other questions matter.)]

      Proposed resolution:


      -

      385. Does call by value imply the CopyConstructible requirement?

      -Section: 17 [lib.library]  Status: Open  Submitter: Matt Austern  Date: 23 Oct 2002

      +

      385. Does call by value imply the CopyConstructible requirement?

      Section: 17 [lib.library]  Status: Open  Submitter: Matt Austern  Date: 23 Oct 2002

      Many function templates have parameters that are passed by value; a typical example is find_if's pred parameter in -25.1.2 [lib.alg.find]. Are the corresponding template parameters +25.1.2 [lib.alg.find]. Are the corresponding template parameters (Predicate in this case) implicitly required to be CopyConstructible, or does that need to be spelled out explicitly?

      @@ -3913,8 +2568,8 @@ my_predicate& is not CopyConstructible.

      The scope of this problem, if it is a problem, is unknown. Function -object arguments to generic algorithms in clauses 25 [lib.algorithms] -and 26 [lib.numerics] are obvious examples. A review of the whole +object arguments to generic algorithms in clauses 25 [lib.algorithms] +and 26 [lib.numerics] are obvious examples. A review of the whole library is necessary.

      Proposed resolution:

      @@ -3926,9 +2581,8 @@ into references? References aren't copy constructible, so this should not be allowed. ]


      -

      386. Reverse iterator's operator[] has impossible return type

      -Section: 24.4.1.3.11 [lib.reverse.iter.opindex]  Status: Open  Submitter: Matt Austern  Date: 23 Oct 2002

      -

      In 24.4.1.3.11 [lib.reverse.iter.opindex], reverse_iterator<>::operator[] +

      386. Reverse iterator's operator[] has impossible return type

      Section: 24.4.1.3.11 [lib.reverse.iter.opindex]  Status: Open  Submitter: Matt Austern  Date: 23 Oct 2002

      +

      In 24.4.1.3.11 [lib.reverse.iter.opindex], reverse_iterator<>::operator[] is specified as having a return type of reverse_iterator::reference, which is the same as iterator_traits<Iterator>::reference. (Where Iterator is the underlying iterator type.)

      @@ -3940,7 +2594,7 @@ which is the same as iterator_traits<Iterator>::reference. to Iterator's value type. The return type specified for reverse_iterator's operator[] would thus appear to be impossible.

      -

      Related issue: 299. Jeremy will work on this.

      +

      Related issue: 299. Jeremy will work on this.

      Proposed resolution:

      [ Comments from Dave Abrahams: IMO we should resolve 386 by just saying @@ -3951,8 +2605,7 @@ Comments from Dave Abrahams: IMO we should resolve 386 by just saying readable and writable, which is about as good as we can do. ]


      -

      387. std::complex over-encapsulated

      -Section: 26.2 [lib.complex.numbers]  Status: Open  Submitter: Gabriel Dos Reis  Date: 8 Nov 2002

      +

      387. std::complex over-encapsulated

      Section: 26.2 [lib.complex.numbers]  Status: Open  Submitter: Gabriel Dos Reis  Date: 8 Nov 2002

      The absence of explicit description of std::complex<T> layout makes it imposible to reuse existing software developed in traditional @@ -3965,7 +2618,8 @@ severe pessimizations. For example, the only way to change, independently, the real and imaginary parts is to write something like

      -
      complex<T> z;
      +
      +complex<T> z;
       // ...
       // set the real part to r
       z = complex<T>(r, z.imag());
      @@ -3984,7 +2638,7 @@ of std::complex<> is not justified.
       

      Proposed resolution:

      -

      Add the following requirements to 26.2 [lib.complex.numbers] as 26.2/4:

      +

      Add the following requirements to 26.2 [lib.complex.numbers] as 26.2/4:

      If z is an lvalue expression of type cv std::complex<T> then

      @@ -4011,40 +2665,44 @@ imaginary part of a[i].
    -

    In the header synopsis in 26.2.1 [lib.complex.synopsis], replace

    -
      template<class T> T real(const complex<T>&);
    +

    In the header synopsis in 26.2.1 [lib.complex.synopsis], replace

    +
    +  template<class T> T real(const complex<T>&);
       template<class T> T imag(const complex<T>&);
     

    with

    -
      template<class T> const T& real(const complex<T>&);
    +
    +  template<class T> const T& real(const complex<T>&);
       template<class T>       T& real(      complex<T>&);
       template<class T> const T& imag(const complex<T>&);
       template<class T>       T& imag(      complex<T>&);
     
    -

    In 26.2.7 [lib.complex.value.ops] paragraph 1, change

    -
      template<class T> T real(const complex<T>&);
    +

    In 26.2.7 [lib.complex.value.ops] paragraph 1, change

    +
    +  template<class T> T real(const complex<T>&);
     

    to

    -
      template<class T> const T& real(const complex<T>&);
    +
    +  template<class T> const T& real(const complex<T>&);
       template<class T>       T& real(      complex<T>&);
     

    and change the Returns clause to "Returns: The real -part of x -

    . +part of x

    . -

    In 26.2.7 [lib.complex.value.ops] paragraph 2, change

    -
      template<class T> T imag(const complex<T>&);
    +

    In 26.2.7 [lib.complex.value.ops] paragraph 2, change

    +
    +  template<class T> T imag(const complex<T>&);
     

    to

    -
      template<class T> const T& imag(const complex<T>&);
    +
    +  template<class T> const T& imag(const complex<T>&);
       template<class T>       T& imag(      complex<T>&);
     

    and change the Returns clause to "Returns: The imaginary -part of x -

    . +part of x

    .

    [Kona: The layout guarantee is absolutely necessary for C compatibility. However, there was disagreement about the other part @@ -4057,85 +2715,14 @@ part of x doing it? Howard will try to resolve this issue for the next meeting.]

    +

    [pre-Sydney: Howard summarized the options in n1589.]

    +

    Rationale:

    The LWG believes that C99 compatibility would be enough justification for this change even without other considerations. All existing implementations already have the layout proposed here.


    -

    389. Const overload of valarray::operator[] returns by value

    -Section: 26.3.2 [lib.template.valarray]  Status: Ready  Submitter: Gabriel Dos Reis  Date: 8 Nov 2002

    -

    Consider the following program:

    -
        #include <iostream>
    -    #include <ostream>
    -    #include <vector>
    -    #include <valarray>
    -    #include <algorithm>
    -    #include <iterator>
    -    template<typename Array>
    -    void print(const Array& a)
    -    {
    -    using namespace std;
    -    typedef typename Array::value_type T;
    -    copy(&a[0], &a[0] + a.size(),
    -    ostream_iterator<T>(std::cout, " "));
    -    }
    -    template<typename T, unsigned N>
    -    unsigned size(T(&)[N]) { return N; }
    -    int main()
    -    {
    -    double array[] = { 0.89, 9.3, 7, 6.23 };
    -    std::vector<double> v(array, array + size(array));
    -    std::valarray<double> w(array, size(array));
    -    print(v); // #1
    -    std::cout << std::endl;
    -    print(w); // #2
    -    std::cout << std::endl;
    -    }
    -
    - -

    While the call numbered #1 succeeds, the call numbered #2 fails -because the const version of the member function -valarray<T>::operator[](size_t) returns a value instead of a -const-reference. That seems to be so for no apparent reason, no -benefit. Not only does that defeats users' expectation but it also -does hinder existing software (written either in C or Fortran) -integration within programs written in C++. There is no reason why -subscripting an expression of type valarray<T> that is const-qualified -should not return a const T&.

    -

    Proposed resolution:

    -

    In the class synopsis in 26.3.2 [lib.template.valarray], and in -26.3.2.3 [lib.valarray.access] just above paragraph 1, change

    -
      T operator[](size_t const);
    -
    -

    to

    -
      const T& operator[](size_t const);
    -
    - -

    [Kona: fixed a minor typo: put semicolon at the end of the line - wehre it belongs.]

    - -

    Rationale:

    -

    Return by value seems to serve no purpose. Valaray was explicitly -designed to have a specified layout so that it could easily be -integrated with libraries in other languages, and return by value -defeats that purpose. It is believed that this change will have no -impact on allowable optimizations.

    -
    -

    391. non-member functions specified as const

    -Section: 22.1.3.2 [lib.conversions]  Status: Ready  Submitter: James Kanze  Date: 10 Dec 2002

    -

    -The specifications of toupper and tolower both specify the functions as -const, althought they are not member functions, and are not specified as -const in the header file synopsis in section 22.1 [lib.locales]. -

    -

    Proposed resolution:

    -

    In 22.1.3.2 [lib.conversions], remove const from the function - declarations of std::toupper and std::tolower

    -

    Rationale:

    -

    Fixes an obvious typo

    -
    -

    394. behavior of formatted output on failure

    -Section: 27.6.2.5.1 [lib.ostream.formatted.reqmts]  Status: Open  Submitter: Martin Sebor  Date: 27 Dec 2002

    +

    394. behavior of formatted output on failure

    Section: 27.6.2.5.1 [lib.ostream.formatted.reqmts]  Status: Open  Submitter: Martin Sebor  Date: 27 Dec 2002

    There is a contradiction in Formatted output about what bit is supposed to be set if the formatting fails. On sentence says it's @@ -4144,10 +2731,11 @@ badbit and another that it's failbit.

    27.6.2.5.1, p1 says in the Common Requirements on Formatted output functions: -

         ... If the generation fails, then the formatted output function
    +
    +     ... If the generation fails, then the formatted output function
          does setstate(ios::failbit), which might throw an exception.
     
    -

    +

    27.6.2.5.2, p1 goes on to say this about Arithmetic Inserters:

    @@ -4156,14 +2744,15 @@ functions: following code fragment:

    -

         bool failed =
    +
    +     bool failed =
              use_facet<num_put<charT,ostreambuf_iterator<charT,traits>
              > >
              (getloc()).put(*this, *this, fill(), val). failed();
     
          ... If failed is true then does setstate(badbit) ...
     
    -

    +

    The original intent of the text, according to Jerry Schwarz (see c++std-lib-10500), is captured in the following paragraph: @@ -4230,49 +2819,7 @@ functions should be changed as proposed below.

    Rationale:


    -

    395. inconsistencies in the definitions of rand() and random_shuffle()

    -Section: 26.5 [lib.c.math]  Status: Ready  Submitter: James Kanze  Date: 3 Jan 2003

    -

    -In 26.5 [lib.c.math], the C++ standard refers to the C standard for the -definition of rand(); in the C standard, it is written that "The -implementation shall behave as if no library function calls the rand -function." -

    - -

    -In 25.2.11 [lib.alg.random.shuffle], there is no specification as to -how the two parameter version of the function generates its random -value. I believe that all current implementations in fact call rand() -(in contradiction with the requirement avove); if an implementation does -not call rand(), there is the question of how whatever random generator -it does use is seeded. Something is missing. -

    - -

    Proposed resolution:

    -

    -In [lib.c.math], add a paragraph specifying that the C definition of -rand shal be modified to say that "Unless otherwise specified, the -implementation shall behave as if no library function calls the rand -function." -

    - -

    -In [lib.alg.random.shuffle], add a sentence to the effect that "In -the two argument form of the function, the underlying source of -random numbers is implementation defined. [Note: in particular, an -implementation is permitted to use rand.] -

    -

    Rationale:

    -

    The original proposed resolution proposed requiring the - two-argument from of random_shuffle to - use rand. We don't want to do that, because some existing - implementations already use something else: gcc - uses lrand48, for example. Using rand presents a - problem if the number of elements in the sequence is greater than - RAND_MAX.

    -
    -

    396. what are characters zero and one

    -Section: 23.3.5.1 [lib.bitset.cons]  Status: Open  Submitter: Martin Sebor  Date: 5 Jan 2003

    +

    396. what are characters zero and one

    Section: 23.3.5.1 [lib.bitset.cons]  Status: Open  Submitter: Martin Sebor  Date: 5 Jan 2003

    23.3.5.1, p6 [lib.bitset.cons] talks about a generic character having the value of 0 or 1 but there is no definition of what @@ -4285,12 +2832,14 @@ p33, looks like a defect remotely related to DR 303.

    http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#303

    -
    23.3.5.1:
    +    
    +23.3.5.1:
       -6-  An element of the constructed string has value zero if the
            corresponding character in str, beginning at position pos,
            is 0. Otherwise, the element has the value one.
         
    -
    23.3.5.2:
    +    
    +23.3.5.2:
       -33-  Effects: Constructs a string object of the appropriate
             type and initializes it to a string of length N characters.
             Each character is determined by the value of its
    @@ -4306,8 +2855,9 @@ is a bitset, not a string.
         

    Proposed resolution:

    Change the constructor's function declaration immediately before -23.3.5.1 [lib.bitset.cons] p3 to:

    -
        template <class charT, class traits, class Allocator>
    +23.3.5.1  [lib.bitset.cons] p3 to:

    +
    +    template <class charT, class traits, class Allocator>
         explicit
         bitset(const basic_string<charT, traits, Allocator>& str,
                typename basic_string<charT, traits, Allocator>::size_type pos = 0,
    @@ -4315,7 +2865,7 @@ is a bitset, not a string.
                  basic_string<charT, traits, Allocator>::npos,
                charT zero = charT('0'), charT one = charT('1'))
     
    -

    Change the first two sentences of 23.3.5.1 [lib.bitset.cons] p6 to: "An +

    Change the first two sentences of 23.3.5.1 [lib.bitset.cons] p6 to: "An element of the constructed string has value 0 if the corresponding character in str, beginning at position pos, is zero. Otherwise, the element has the value 1.

    @@ -4328,18 +2878,19 @@ is zero. Otherwise, the element has the value 1.

    Change the declaration of the to_string member function - immediately before 23.3.5.2 [lib.bitset.members] p33 to:

    -
        template <class charT, class traits, class Allocator>
    +  immediately before 23.3.5.2  [lib.bitset.members] p33 to:

    +
    +    template <class charT, class traits, class Allocator>
         basic_string<charT, traits, Allocator> 
         to_string(charT zero = charT('0'), charT one = charT('1')) const;
     
    -

    Change the last sentence of 23.3.5.2 [lib.bitset.members] p33 to: "Bit +

    Change the last sentence of 23.3.5.2 [lib.bitset.members] p33 to: "Bit value 0 becomes the character zero, bit value 1 becomes the character one.

    -

    Change 23.3.5.3 [lib.bitset.operators] p8 to:

    -

    -Returns:

    -
      os << x.template to_string<charT,traits,allocator<charT> >(
    +

    Change 23.3.5.3 [lib.bitset.operators] p8 to:

    +

    Returns:

    +
    +  os << x.template to_string<charT,traits,allocator<charT> >(
           use_facet<ctype<charT> >(os.getloc()).widen('0'),
           use_facet<ctype<charT> >(os.getloc()).widen('1'));
     
    @@ -4353,24 +2904,25 @@ is zero. Otherwise, the element has the value 1.

    resolution allows those users who care about this issue to get it right.

    We fix the inserter to use the new arguments. Note that we already - fixed the analogous problem with the extractor in issue 303.

    + fixed the analogous problem with the extractor in issue 303.


    -

    397. ostream::sentry dtor throws exceptions

    -Section: 27.6.2.3 [lib.ostream::sentry]  Status: Open  Submitter: Martin Sebor  Date: 5 Jan 2003

    +

    397. ostream::sentry dtor throws exceptions

    Section: 27.6.2.3 [lib.ostream::sentry]  Status: Open  Submitter: Martin Sebor  Date: 5 Jan 2003

    17.4.4.8, p3 prohibits library dtors from throwing exceptions.

    27.6.2.3, p4 says this about the ostream::sentry dtor:

    -
        -4- If ((os.flags() & ios_base::unitbuf) && !uncaught_exception())
    +    
    +    -4- If ((os.flags() & ios_base::unitbuf) && !uncaught_exception())
             is true, calls os.flush().
         

    27.6.2.6, p7 that describes ostream::flush() says:

    -
        -7- If rdbuf() is not a null pointer, calls rdbuf()->pubsync().
    +    
    +    -7- If rdbuf() is not a null pointer, calls rdbuf()->pubsync().
             If that function returns ?-1 calls setstate(badbit) (which
             may throw ios_base::failure (27.4.4.3)).
         
    @@ -4389,8 +2941,7 @@ is the only one that can throw. PJP suggests specifying that sentry::~sentry() should internally catch any exceptions it might cause. ]


    -

    398. effects of end-of-file on unformatted input functions

    -Section: 27.6.2.3 [lib.ostream::sentry]  Status: Open  Submitter: Martin Sebor  Date: 5 Jan 2003

    +

    398. effects of end-of-file on unformatted input functions

    Section: 27.6.2.3 [lib.ostream::sentry]  Status: Open  Submitter: Martin Sebor  Date: 5 Jan 2003

    While reviewing unformatted input member functions of istream for their behavior when they encounter end-of-file during input @@ -4405,54 +2956,61 @@ encounter an end-of-file (this is the expected behavior, and also the behavior of all major implementations):

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         get (char_type*, streamsize, char_type);
         
    -

    +

    Also sets failbit if it fails to extract any characters.

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         get (char_type*, streamsize);
         
    -

    +

    Also sets failbit if it fails to extract any characters.

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         getline (char_type*, streamsize, char_type);
         
    -

    +

    Also sets failbit if it fails to extract any characters.

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         getline (char_type*, streamsize);
         
    -

    +

    Also sets failbit if it fails to extract any characters.

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         ignore (int, int_type);
         
    -

    +

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         read (char_type*, streamsize);
         
    -

    +

    Also sets failbit if it encounters end-of-file.

    -

        streamsize readsome (char_type*, streamsize);
    +    
    +    streamsize readsome (char_type*, streamsize);
         
    -

    +

    The following unformated input member functions set failbit but @@ -4463,14 +3021,16 @@ also in conflict with all major implementation which set both eofbit and failbit):

    -

        int_type get();
    +    
    +    int_type get();
         
    -

    +

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         get (char_type&);
         
    -

    +

    These functions only set failbit of they extract no characters, otherwise they don't set any bits, even on failure (I find this @@ -4479,24 +3039,27 @@ conflict with all major implementations which set eofbit whenever they encounter end-of-file):

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         get (basic_streambuf<charT, traits>&, char_type);
         
    -

    +

    -

        basic_istream<charT, traits>&
    +    
    +    basic_istream<charT, traits>&
         get (basic_streambuf<charT, traits>&);
         
    -

    +

    This function sets no bits (all implementations except for STLport and Classic Iostreams set eofbit when they encounter end-of-file):

    -

        int_type peek ();
    +    
    +    int_type peek ();
         
    -

    +

    Proposed resolution:

    Informally, what we want is a global statement of intent saying that eofbit gets set if we trip across EOF, and then we can take @@ -4505,14 +3068,14 @@ end-of-file): and changing it on an individual basis wouldn't make things better. Dietmar will do this work.


    -

    401.  incorrect type casts in table 32 in lib.allocator.requirements

    -Section: 20.1.5 [lib.allocator.requirements]  Status: Open  Submitter: Markus Mauhart  Date: 27 Feb 2003

    +

    401.  incorrect type casts in table 32 in lib.allocator.requirements

    Section: 20.1.5 [lib.allocator.requirements]  Status: Open  Submitter: Markus Mauhart  Date: 27 Feb 2003

    -I think that in par2 of 20.1.5 [lib.allocator.requirements] the last two +I think that in par2 of 20.1.5 [lib.allocator.requirements] the last two lines of table 32 contain two incorrect type casts. The lines are ...

    -
      a.construct(p,t)   Effect: new((void*)p) T(t)
    +
    +  a.construct(p,t)   Effect: new((void*)p) T(t)
       a.destroy(p)       Effect: ((T*)p)?->~T()
     
    @@ -4521,7 +3084,8 @@ lines of table 32 contain two incorrect type casts. The lines are ... from table 31:

    -
      alloc<T>             a     ;// an allocator for T
    +
    +  alloc<T>             a     ;// an allocator for T
       alloc<T>::pointer    p     ;// random access iterator
                                   // (may be different from T*)
       alloc<T>::reference  r = *p;// T&
    @@ -4545,7 +3109,7 @@ current requirement (being a random access iterator).
     

    Note: Actually I would prefer to replace "((T*)p)?->dtor_name" with "p?->dtor_name", but AFAICS this is not possible cause of an omission -in 13.5.6 [over.ref] (for which I have filed another DR on 29.11.2002). +in 13.5.6 [over.ref] (for which I have filed another DR on 29.11.2002).

    [Kona: The LWG thinks this is somewhere on the border between @@ -4557,171 +3121,16 @@ in 13.5.6

    402. wrong new expression in [some_]allocator::construct

    -Section: 20.1.5 [lib.allocator.requirements], 20.4.1.1 [lib.allocator.members],   Status: Ready  Submitter: Markus Mauhart  Date: 27 Feb 2003

    -

    -This applies to the new expression that is contained in both par12 of -20.4.1.1 [lib.allocator.members] and in par2 (table 32) of 20.1.5 [lib.allocator.requirements]. -I think this new expression is wrong, involving unintended side -effects. -

    - - -

    20.4.1.1 [lib.allocator.members] contains the following 3 lines:

    - -
      11 Returns: the largest value N for which the call allocate(N,0) might succeed.
    -     void construct(pointer p, const_reference val);
    -  12 Returns: new((void *) p) T( val)
    -
    - - -

    20.1.5 [lib.allocator.requirements] in table 32 has the following line:

    -
      a.construct(p,t)   Effect: new((void*)p) T(t)
    -
    - -

    -.... with the prerequisits coming from the preceding two paragraphs, -especially from table 31: -

    - -
      alloc<T>             a     ;// an allocator for T
    -  alloc<T>::pointer    p     ;// random access iterator
    -                              // (may be different from T*)
    -  alloc<T>::reference  r = *p;// T&
    -  T const&             t     ;
    -
    - -

    -Cause of using "new" but not "::new", any existing "T::operator new" -function will hide the global placement new function. When there is no -"T::operator new" with adequate signature, -every_alloc<T>::construct(..) is ill-formed, and most -std::container<T,every_alloc<T>> use it; a workaround -would be adding placement new and delete functions with adequate -signature and semantic to class T, but class T might come from another -party. Maybe even worse is the case when T has placement new and -delete functions with adequate signature but with "unknown" semantic: -I dont like to speculate about it, but whoever implements -any_container<T,any_alloc> and wants to use construct(..) -probably must think about it. -

    -

    Proposed resolution:

    -

    -Replace "new" with "::new" in both cases. -

    -
    -

    403. basic_string::swap should not throw exceptions

    -Section: 21.3.5.8 [lib.string::swap]  Status: Ready  Submitter: Beman Dawes  Date: 25 Mar 2003

    - -

    -std::basic_string, 21.3 [lib.basic.string] paragraph 2 says that -basic_string "conforms to the requirements of a Sequence, as specified -in (23.1.1)." The sequence requirements specified in (23.1.1) to not -include any prohibition on swap members throwing exceptions. -

    - -

    -Section 23.1 [lib.container.requirements] paragraph 10 does limit conditions under -which exceptions may be thrown, but applies only to "all container -types defined in this clause" and so excludes basic_string::swap -because it is defined elsewhere. -

    - -

    -Eric Niebler points out that 21.3 [lib.basic.string] paragraph 5 explicitly -permits basic_string::swap to invalidates iterators, which is -disallowed by 23.1 [lib.container.requirements] paragraph 10. Thus the standard would -be contradictory if it were read or extended to read as having -basic_string meet 23.1 [lib.container.requirements] paragraph 10 requirements. -

    - -

    -Yet several LWG members have expressed the belief that the original -intent was that basic_string::swap should not throw exceptions as -specified by 23.1 [lib.container.requirements] paragraph 10, and that the standard is -unclear on this issue. The complexity of basic_string::swap is -specified as "constant time", indicating the intent was to avoid -copying (which could cause a bad_alloc or other exception). An -important use of swap is to ensure that exceptions are not thrown in -exception-safe code. -

    - -

    -Note: There remains long standing concern over whether or not it is -possible to reasonably meet the 23.1 [lib.container.requirements] paragraph 10 swap -requirements when allocators are unequal. The specification of -basic_string::swap exception requirements is in no way intended to -address, prejudice, or otherwise impact that concern. -

    - - - - - -

    Proposed resolution:

    -

    -In 21.3.5.8 [lib.string::swap], add a throws clause: -

    - -

    -Throws: Shall not throw exceptions. -

    -
    -

    404. May a replacement allocation function be declared inline?

    -Section: 17.4.3.4 [lib.replacement.functions], 18.4.1 [lib.new.delete]  Status: Ready  Submitter: Matt Austern  Date: 24 Apr 2003

    -

    -The eight basic dynamic memory allocation functions (single-object -and array versions of ::operator new and ::operator delete, in the -ordinary and nothrow forms) are replaceable. A C++ program may -provide an alternative definition for any of them, which will be used -in preference to the implementation's definition. -

    - -

    -Three different parts of the standard mention requirements on -replacement functions: 17.4.3.4 [lib.replacement.functions], 18.4.1.1 [lib.new.delete.single] -and 18.4.1.2 [lib.new.delete.array], and 3.7.3 [basic.stc.dynamic]. -

    - -

    None of these three places say whether a replacement function may - be declared inline. 18.4.1.1 [lib.new.delete.single] paragraph 2 specifies a - signature for the replacement function, but that's not enough: - the inline specifier is not part of a function's signature. - One might also reason from 7.1.2 [dcl.fct.spec] paragraph 2, which - requires that "an inline function shall be defined in every - translation unit in which it is used," but this may not be quite - specific enough either. We should either explicitly allow or - explicitly forbid inline replacement memory allocation - functions.

    -

    Proposed resolution:

    -

    -Add a new sentence to the end of 17.4.3.4 [lib.replacement.functions] paragraph 3: -"The program's definitions shall not be specified as inline. -No diagnostic is required." -

    - -

    [Kona: added "no diagnostic is required"]

    - -

    Rationale:

    -

    -The fact that inline isn't mentioned appears to have been -nothing more than an oversight. Existing implementations do not -permit inline functions as replacement memory allocation functions. -Providing this functionality would be difficult in some cases, and is -believed to be of limited value. -

    -
    -

    405. qsort and POD

    -Section: 25.4 [lib.alg.c.library]  Status: Review  Submitter: Ray Lischner  Date: 08 Apr 2003

    +

    405. qsort and POD

    Section: 25.4 [lib.alg.c.library]  Status: Ready  Submitter: Ray Lischner  Date: 08 Apr 2003

    -Section 25.4 [lib.alg.c.library] describes bsearch and qsort, from the C +Section 25.4 [lib.alg.c.library] describes bsearch and qsort, from the C standard library. Paragraph 4 does not list any restrictions on qsort, but it should limit the base parameter to point to POD. Presumably, qsort sorts the array by copying bytes, which requires POD.

    Proposed resolution:

    -In 25.4 [lib.alg.c.library] paragraph 4, just after the declarations and +In 25.4 [lib.alg.c.library] paragraph 4, just after the declarations and before the nonnormative note, add these words: "both of which have the same behavior as the original declaration. The behavior is undefined unless the objects in the array pointed to by base are of POD @@ -4731,8 +3140,7 @@ type."

    [Something along these lines is clearly necessary. Matt provided wording.]


    -

    406. vector::insert(s) exception safety

    -Section: 23.2.4.3 [lib.vector.modifiers]  Status: Open  Submitter: Dave Abrahams  Date: 27 Apr 2003

    +

    406. vector::insert(s) exception safety

    Section: 23.2.4.3 [lib.vector.modifiers]  Status: Open  Submitter: Dave Abrahams  Date: 27 Apr 2003

    There is a possible defect in the standard: the standard text was never intended to prevent arbitrary ForwardIterators, whose operations @@ -4743,7 +3151,7 @@ standard appears to impose requirements that aren't met by any existing implementation.

    Proposed resolution:

    -

    Replace 23.2.4.2 [lib.vector.capacity] paragraph 1 with:

    +

    Replace 23.2.4.2 [lib.vector.capacity] paragraph 1 with:

    1 Notes: Causes reallocation if the new size is greater than the old capacity. If no reallocation happens, all the iterators and @@ -4758,32 +3166,14 @@ existing implementation. Forward Iterators.]


    -

    407. Can singular iterators be destroyed?

    -Section: 24.1 [lib.iterator.requirements]  Status: Ready  Submitter: Nathan Myers  Date: 3 June 2003

    -

    -Clause 24.1 [lib.iterator.requirements], paragraph 5, says that the only expression -that is defined for a singular iterator is "an assignment of a -non-singular value to an iterator that holds a singular value". This -means that destroying a singular iterator (e.g. letting an automatic -variable go out of scope) is technically undefined behavior. This -seems overly strict, and probably unintentional. -

    -

    Proposed resolution:

    -

    -Change the sentence in question to "... the only exceptions are -destroying an iterator that holds a singular value, or the assignment -of a non-singular value to an iterator that holds a singular value." -

    -
    -

    408. Is vector<reverse_iterator<char*> > forbidden?

    -Section: 24.1 [lib.iterator.requirements]  Status: Open  Submitter: Nathan Myers  Date: 3 June 2003

    +

    408. Is vector<reverse_iterator<char*> > forbidden?

    Section: 24.1 [lib.iterator.requirements]  Status: Open  Submitter: Nathan Myers  Date: 3 June 2003

    I've been discussing iterator semantics with Dave Abrahams, and a surprise has popped up. I don't think this has been discussed before.

    -24.1 [lib.iterator.requirements] says that the only operation that can be performed on "singular" +24.1 [lib.iterator.requirements] says that the only operation that can be performed on "singular" iterator values is to assign a non-singular value to them. (It doesn't say they can be destroyed, and that's probably a defect.) Some implementations have taken this to imply that there is no need @@ -4833,7 +3223,7 @@ T(), and so copying is defined if the result of T() is copyable.

    -Issue 235, which defines reverse_iterator's default +Issue 235, which defines reverse_iterator's default constructor more precisely, has some relevance to this issue. However, it is not the whole story.

    @@ -4859,7 +3249,7 @@ uninitialized, and possibly equal to an existing pointer value, or

    8.5 paragraph 5 seems to make clear that the second is required to -satisfy DR 235, at least for non-class Iterator argument +satisfy DR 235, at least for non-class Iterator argument types.

    @@ -4886,8 +3276,7 @@ are default-initialized, and it should explicitly allow destroying any iterator value, singular or not, default-initialized or not.

    -

    Related issue: 407 -

    +

    Related issue: 407

    Proposed resolution:

    [ @@ -4901,10 +3290,9 @@ wrong to impose so strict a requirement for iterators. ]


    -

    409. Closing an fstream should clear error state

    -Section: 27.8.1.7 [lib.ifstream.members], 27.8.1.10 [lib.ofstream.members]  Status: Review  Submitter: Nathan Myers  Date: 3 June 2003

    +

    409. Closing an fstream should clear error state

    Section: 27.8.1.7 [lib.ifstream.members], 27.8.1.10 [lib.ofstream.members]  Status: Review  Submitter: Nathan Myers  Date: 3 June 2003

    -A strict reading of 27.8.1 [lib.fstreams] shows that opening or +A strict reading of 27.8.1 [lib.fstreams] shows that opening or closing a basic_[io]fstream does not affect the error bits. This means, for example, that if you read through a file up to EOF, and then close the stream and reopen it at the beginning of the file, @@ -4912,7 +3300,7 @@ the EOF bit in the stream's error state is still set. This is counterintuitive.

    -The LWG considered this issue once before, as issue 22, +The LWG considered this issue once before, as issue 22, and put in a footnote to clarify that the strict reading was indeed correct. We did that because we believed the standard was unambiguous and consistent, and that we should not make architectural @@ -4921,94 +3309,124 @@ language, those considerations no longer apply.

    Proposed resolution:

    -

    Change 27.8.1.4, para. 3 from:

    +

    Change 27.8.1.7 [lib.ifstream.members], para. 3 from:

    +
    -If the open operation succeeds and ( mode & ios_base::ate) != 0, -positions the file to the end (``as if'' by calling -std::fseek(file,0,SEEK_END)). +Calls rdbuf()->open(s,mode|in). If that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure [Footnote: (lib.iostate.flags)).
    +

    to:

    +
    -If the open operation succeeds, calls clear(0). Then if -( mode & ios_base::ate) != 0, positions the file to the end -(``as if'' by calling std::fseek(file,0,SEEK_END)). +Calls rdbuf()->open(s,mode|in). If that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure [Footnote: (lib.iostate.flags)), else calls clear().
    -

    [Kona: the LWG agrees this is a good idea. Post-Kona: Bill -provided wording. He suggests having open, not close, clear the error -flags.]

    +

    Change 27.8.1.10 [lib.ofstream.members], para. 3 from:

    -
    -

    410. Missing semantics for stack and queue comparison operators

    -Section: 23.2.3.1 [lib.queue], 23.2.3.3 [lib.stack]  Status: Review  Submitter: Hans Bos  Date: 7 Jun 2003

    +
    +Calls rdbuf()->open(s,mode|out). If that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure [Footnote: (lib.iostate.flags)). +
    + +

    to:

    + +
    +Calls rdbuf()->open(s,mode|out). If that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure [Footnote: (lib.iostate.flags)), else calls clear(). +
    + +

    Change 27.8.1.13 [lib.fstream.members], para. 3 from:

    + +
    +Calls rdbuf()->open(s,mode), If that function returns a null pointer, calls setstate(failbit), (which may throw ios_base::failure). (lib.iostate.flags) ) +
    + +

    to:

    + +
    +Calls rdbuf()->open(s,mode), If that function returns a null pointer, calls setstate(failbit), (which may throw ios_base::failure). (lib.iostate.flags) ), else calls clear(). +
    + + + +

    [Kona: the LWG agrees this is a good idea. Post-Kona: Bill +provided wording. He suggests having open, not close, clear the error +flags.]

    + +

    [Post-Sydney: Howard provided a new proposed resolution. The + old one didn't make sense because it proposed to fix this at the + level of basic_filebuf, which doesn't have access to the stream's + error state. Howard's proposed resolution fixes this at the level + of the three fstream class template instead.]

    + +
    +

    410. Missing semantics for stack and queue comparison operators

    Section: 23.2.3.1 [lib.queue], 23.2.3.3 [lib.stack]  Status: Ready  Submitter: Hans Bos  Date: 7 Jun 2003

    -Sections 23.2.3.1 [lib.queue] and 23.2.3.3 [lib.stack] list +Sections 23.2.3.1 [lib.queue] and 23.2.3.3 [lib.stack] list comparison operators (==, !=, <, <=, >, =>) for queue and -stack. Only the semantics for queue::operator== (23.2.3.1 [lib.queue] par2) and queue::operator< (23.2.3.1 [lib.queue] +stack. Only the semantics for queue::operator== (23.2.3.1 [lib.queue] par2) and queue::operator< (23.2.3.1 [lib.queue] par3) are defined.

    Proposed resolution:

    -

    Add the following new paragraphs after 23.2.3.1 [lib.queue] +

    Add the following new paragraphs after 23.2.3.1 [lib.queue] paragraph 3:

    -
      operator!=
    +
    +  operator!=
     
    -

    Returns: x.c != y.c -

    +

    Returns: x.c != y.c

    -
      operator>
    +
    +  operator>
     
    -

    Returns: x.c > y.c -

    +

    Returns: x.c > y.c

    -
      operator<=
    +
    +  operator<=
     
    -

    Returns: x.c <= y.c -

    +

    Returns: x.c <= y.c

    -
      operator>=
    +
    +  operator>=
     
    -

    Returns: x.c >= y.c -

    +

    Returns: x.c >= y.c

    -

    Add the following paragraphs at the end of 23.2.3.3 [lib.stack]:

    +

    Add the following paragraphs at the end of 23.2.3.3 [lib.stack]:

    -
      operator==
    +
    +  operator==
     
    -

    Returns: x.c == y.c -

    +

    Returns: x.c == y.c

    -
      operator<
    +
    +  operator<
     
    -

    Returns: x.c < y.c -

    +

    Returns: x.c < y.c

    -
      operator!=
    +
    +  operator!=
     
    -

    Returns: x.c != y.c -

    +

    Returns: x.c != y.c

    -
      operator>
    +
    +  operator>
     
    -

    Returns: x.c > y.c -

    +

    Returns: x.c > y.c

    -
      operator<=
    +
    +  operator<=
     
    -

    Returns: x.c <= y.c -

    +

    Returns: x.c <= y.c

    -
      operator>=
    +
    +  operator>=
     
    -

    Returns: x.c >= y.c -

    +

    Returns: x.c >= y.c

    @@ -5019,27 +3437,9 @@ par3) are defined. There isn't any real doubt about what these operators are supposed to do, but we ought to spell it out.
    -

    411. Wrong names of set member functions

    -Section: 25.3.5 [lib.alg.set.operations]  Status: Ready  Submitter: Daniel Frey  Date: 9 Jul 2003

    -

    -25.3.5 [lib.alg.set.operations] paragraph 1 reads: -"The semantics of the set operations are generalized to multisets in a -standard way by defining union() to contain the maximum number of -occurrences of every element, intersection() to contain the minimum, and -so on." -

    - -

    -This is wrong. The name of the functions are set_union() and -set_intersection(), not union() and intersection(). -

    -

    Proposed resolution:

    -

    Change that sentence to use the correct names.

    -
    -

    412. Typo in 27.4.4.3

    -Section: 27.4.4.3 [lib.iostate.flags]  Status: Review  Submitter: Martin Sebor  Date: 10 Jul 2003

    +

    412. Typo in 27.4.4.3

    Section: 27.4.4.3 [lib.iostate.flags]  Status: Ready  Submitter: Martin Sebor  Date: 10 Jul 2003

    -The Effects clause in 27.4.4.3 [lib.iostate.flags] paragraph 5 says that the +The Effects clause in 27.4.4.3 [lib.iostate.flags] paragraph 5 says that the function only throws if the respective bits are already set prior to the function call. That's obviously not the intent. The typo ought to be corrected and the text reworded as: "If (state & @@ -5047,7 +3447,7 @@ exceptions()) == 0, returns. ..."

    Proposed resolution:

    -In 27.4.4.3 [lib.iostate.flags] paragraph 5, replace "If (rdstate() & +In 27.4.4.3 [lib.iostate.flags] paragraph 5, replace "If (rdstate() & exceptions()) == 0" with "If ((state | (rdbuf() ? goodbit : badbit)) & exceptions()) == 0".

    @@ -5059,8 +3459,7 @@ exceptions()) == 0" with "If ((state | (rdbuf() ? goodbit : badbit)) latter, of course. Post-Kona: Martin provided wording.]


    -

    413. Proposed resolution to LDR#64 still wrong

    -Section: 27.6.1.2.3 [lib.istream::extractors]  Status: New  Submitter: Bo Persson  Date: 13 Jul 2003

    +

    413. Proposed resolution to LDR#64 still wrong

    Section: 27.6.1.2.3 [lib.istream::extractors]  Status: Open  Submitter: Bo Persson  Date: 13 Jul 2003

    The second sentence of the proposed resolution says:

    @@ -5075,72 +3474,22 @@ However, we are not extracting from sb, but extracting from the basic_istream (*this) and inserting into sb. I can't really tell if "extracting" or "sb" is a typo.

    -

    Proposed resolution:

    -
    -

    414. Which iterators are invalidated by v.erase()?

    -Section: 23.2.4.3 [lib.vector.modifiers]  Status: Ready  Submitter: Matt Austern  Date: 19 Aug 2003

    -

    -Consider the following code fragment: -

    -
    -
    int A[8] = { 1,3,5,7,9,8,4,2 };
    -std::vector<int> v(A, A+8);
    -
    -std::vector<int>::iterator i1 = v.begin() + 3;
    -std::vector<int>::iterator i2 = v.begin() + 4;
    -v.erase(i1);
    -
    -
    - -

    -Which iterators are invalidated by v.erase(i1): i1, i2, -both, or neither? -

    - -

    -On all existing implementations that I know of, the status of i1 and -i2 is the same: both of them will be iterators that point to some -elements of the vector (albeit not the same elements they did -before). You won't get a crash if you use them. Depending on -exactly what you mean by "invalidate", you might say that neither one -has been invalidated because they still point to something, -or you might say that both have been invalidated because in both -cases the elements they point to have been changed out from under the -iterator. -

    -

    -The standard doesn't say either of those things. It says that erase -invalidates all iterators and references "after the point of the -erase". This doesn't include i1, since it's at the point of the -erase instead of after it. I can't think of any sensible definition -of invalidation by which one can say that i2 is invalidated but i1 -isn't. -

    +

    [ +Sydney: Definitely a real issue. We are, indeed, extracting characters +from an istream and not from sb. The problem was there in the FDIS and +wasn't fixed by issue 64. Probably what was intended was +to have *this instead of sb. We're talking about the exception flag +state of a basic_istream object, and there's only one basic_istream +object in this discussion, so that would be a consistent +interpretation. (But we need to be careful: the exception policy of +this member function must be consistent with that of other +extractors.) PJP will provide wording. +]

    -

    -(This issue is important if you try to reason about iterator validity -based only on the guarantees in the standard, rather than reasoning -from typical implementation techniques. Strict debugging modes, -which some programmers find useful, do not use typical implementation -techniques.) -

    Proposed resolution:

    -

    -In 23.2.4.3 [lib.vector.modifiers] paragraph 3, change "Invalidates all the -iterators and references after the point of the erase" to -"Invalidates iterators and references at or after the point of the -erase". -

    -

    Rationale:

    -

    I believe this was essentially a typographical error, and that it - was taken for granted that erasing an element invalidates iterators - that point to it. The effects clause in question treats iterators - and references in parallel, and it would seem counterintuitive to - say that a reference to an erased value remains valid.


    -

    415. behavior of std::ws

    -Section: 27.6.1.4 [lib.istream.manip]  Status: Review  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    415. behavior of std::ws

    Section: 27.6.1.4 [lib.istream.manip]  Status: Ready  Submitter: Martin Sebor  Date: 18 Sep 2003

    According to 27.6.1.4, the ws() manipulator is not required to construct the sentry object. The manipulator is also not a member function so the @@ -5153,7 +3502,7 @@ doesn't affect the stream's gcount).

    Proposed resolution:

    -Add to 27.6.1.4 [lib.istream.manip], immediately before the first sentence +Add to 27.6.1.4 [lib.istream.manip], immediately before the first sentence of paragraph 1, the following text:

    @@ -5168,8 +3517,7 @@ of paragraph 1, the following text:

    [Post-Kona: Martin provided wording]


    -

    416. definitions of XXX_MIN and XXX_MAX macros in climits

    -Section: 18.2.2 [lib.c.limits]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    416. definitions of XXX_MIN and XXX_MAX macros in climits

    Section: 18.2.2 [lib.c.limits]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    Given two overloads of the function foo(), one taking an argument of type @@ -5218,8 +3566,7 @@ where the actual type is easily detectable by overload resolution. <climits>.]


    -

    417. what does ctype::do_widen() return on failure

    -Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    417. what does ctype::do_widen() return on failure

    Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    The Effects and Returns clauses of the do_widen() member function of the ctype facet fail to specify the behavior of the function on failure. @@ -5241,8 +3588,7 @@ and iostream to reliably detect this failure. existing library components aren't written with the assumption that widen can throw.]


    -

    418. exceptions thrown during iostream cleanup

    -Section: 27.4.2.1.6 [lib.ios::Init]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    418. exceptions thrown during iostream cleanup

    Section: 27.4.2.1.6 [lib.ios::Init]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    The dtor of the ios_base::Init object is supposed to call flush() on the 6 standard iostream objects cout, cerr, clog, wcout, wcerr, and wclog. @@ -5268,8 +3614,7 @@ object throws. might reasonably swallow the exception, or call abort, or do something even more drastic.]


    -

    419. istream extractors not setting failbit if eofbit is already set

    -Section: 27.6.1.1.2 [lib.istream::sentry]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    419. istream extractors not setting failbit if eofbit is already set

    Section: 27.6.1.1.2 [lib.istream::sentry]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    27.6.1.1.2, p2 says that istream::sentry ctor prepares for input if is.good() @@ -5288,6 +3633,7 @@ eof = 1, fail = 1 on all of them.

    +
     #include <sstream>
     #include <cstdio>
     
    @@ -5347,29 +3693,7 @@ corrected.
       clearer.


    -

    420. is std::FILE a complete type?

    -Section: 27.8.1 [lib.fstreams]  Status: Ready  Submitter: Martin Sebor  Date: 18 Sep 2003

    -

    -7.19.1, p2, of C99 requires that the FILE type only be declared in -<stdio.h>. None of the (implementation-defined) members of the -struct is mentioned anywhere for obvious reasons. -

    - -

    -C++ says in 27.8.1, p2 that FILE is a type that's defined in <cstdio>. Is -it really the intent that FILE be a complete type or is an implementation -allowed to just declare it without providing a full definition? -

    -

    Proposed resolution:

    -

    In the first sentence of 27.8.1 [lib.fstreams] paragraph 2, change - "defined" to "declared".

    -

    Rationale:

    -

    We don't want to impose any restrictions beyond what the C standard - already says. We don't want to make anything implementation defined, - because that imposes new requirements in implementations.

    -
    -

    421. is basic_streambuf copy-constructible?

    -Section: 27.5.2.1 [lib.streambuf.cons]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    421. is basic_streambuf copy-constructible?

    Section: 27.5.2.1 [lib.streambuf.cons]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    The reflector thread starting with c++std-lib-11346 notes that the class template basic_streambuf, along with basic_stringbuf and basic_filebuf, @@ -5388,9 +3712,119 @@ of the standard provide a compiler-generated copy ctor and assignment operator yet fail to specify their semantics. It's believed that the only types for which this is actually a problem (i.e. types where the compiler-generated default may be inappropriate and may not have been -intended) are locale facets. See issue 439. +intended) are locale facets. See issue 439.

    Proposed resolution:

    +

    +27.5.2 [lib.streambuf]: Add into the synopsis, public section, just above the destructor declaration: +

    + +
    +
    +basic_streambuf(const basic_streambuf& sb);
    +basic_streambuf& operator=(const basic_streambuf& sb);
    +
    +
    + +

    Insert after 27.5.2.1, paragraph 2:

    +
    +
    +basic_streambuf(const basic_streambuf& sb);
    +
    + +

    Constructs a copy of sb.

    +

    Postcondtions:

    +
    +                eback() == sb.eback()
    +                gptr()  == sb.gptr()
    +                egptr() == sb.egptr()
    +                pbase() == sb.pbase()
    +                pptr()  == sb.pptr()
    +                epptr() == sb.epptr()
    +                getloc() == sb.getloc()
    +
    + +
    +basic_streambuf& operator=(const basic_streambuf& sb);
    +
    + +

    Assigns the data members of sb to this.

    + +

    Postcondtions:

    +
    +                eback() == sb.eback()
    +                gptr()  == sb.gptr()
    +                egptr() == sb.egptr()
    +                pbase() == sb.pbase()
    +                pptr()  == sb.pptr()
    +                epptr() == sb.epptr()
    +                getloc() == sb.getloc()
    +
    + +

    Returns: *this.

    +
    + +

    27.7.1 [lib.stringbuf]:

    + +Option A: + +
    +

    Insert into the basic_stringbuf synopsis in the private section:

    + +
    +basic_stringbuf(const basic_stringbuf&);             // not defined
    +basic_stringbuf& operator=(const basic_stringbuf&);  // not defined
    +
    +
    + +Option B: + +
    +

    Insert into the basic_stringbuf synopsis in the public section:

    + +
    +basic_stringbuf(const basic_stringbuf& sb);
    +basic_stringbuf& operator=(const basic_stringbuf& sb);
    +
    + +

    27.7.1.1, insert after paragraph 4:

    + +
    basic_stringbuf(const basic_stringbuf& sb);
    + +

    +Constructs an independent copy of sb as if with sb.str(), and with the openmode that sb was constructed with. +

    + +

    Postcondtions:

    +
    +               str() == sb.str()
    +               gptr()  - eback() == sb.gptr()  - sb.eback()
    +               egptr() - eback() == sb.egptr() - sb.eback()
    +               pptr()  - pbase() == sb.pptr()  - sb.pbase()
    +               getloc() == sb.getloc()
    +
    + +

    +Note: The only requirement on epptr() is that it point beyond the initialized range if an output sequence exists. There is no requirement that epptr() - pbase() == sb.epptr() - sb.pbase(). +

    + +
    basic_stringbuf& operator=(const basic_stringbuf& sb);
    +

    +After assignment the basic_stringbuf has the same state as if it were initially copy constructed from sb, except that the basic_stringbuf is allowed to retain any excess capacity it might have, which may in turn effect the value of epptr(). +

    +
    + +

    27.8.1.1 [lib.filebuf]

    + +

    Insert at the bottom of the basic_filebuf synopsis:

    + +
    +
    +private:
    +  basic_filebuf(const basic_filebuf&);             // not defined
    +  basic_filebuf& operator=(const basic_filebuf&);  // not defined
    +
    +

    [Kona: this is an issue for basic_streambuf itself and for its derived classes. We are leaning toward allowing basic_streambuf to be copyable, and specifying its precise semantics. (Probably the @@ -5398,9 +3832,45 @@ intended) are locale facets. See issue

    422. explicit specializations of member functions of class templates

    -Section: 17.4.3.1 [lib.reserved.names]  Status: Review  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    422. explicit specializations of member functions of class templates

    Section: 17.4.3.1 [lib.reserved.names]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    It has been suggested that 17.4.3.1, p1 may or may not allow programs to explicitly specialize members of standard templates on user-defined types. @@ -5414,7 +3884,7 @@ the program) by relying on the "as if" rule.

    Proposed resolution:

    - Add the following sentence immediately after the text of 17.4.3.1 [lib.reserved.names], p1: + Add the following sentence immediately after the text of 17.4.3.1 [lib.reserved.names], p1:

    @@ -5430,9 +3900,15 @@ the program) by relying on the "as if" rule. library class templates, and that doing so invokes undefined behavior. Post-Kona: Martin provided wording.]

    +

    [Sydney: The LWG agrees that the standard shouldn't permit users +to specialize individual member functions unless they specialize the +whole class, but we're not sure these words say what we want them to; +they could be read as prohibiting the specialization of any standard +library class templates. We need to consult with CWG to make sure we +use the right wording.]

    +
    -

    423. effects of negative streamsize in iostreams

    -Section: 27 [lib.input.output]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    423. effects of negative streamsize in iostreams

    Section: 27 [lib.input.output]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    A third party test suite tries to exercise istream::ignore(N) with @@ -5462,8 +3938,7 @@ ostream::write(). negative. Martin will do that review.]


    -

    424. normative notes

    -Section: 17.3.1.1 [lib.structure.summary]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    424. normative notes

    Section: 17.3.1.1 [lib.structure.summary]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    The text in 17.3.1.1, p1 says: @@ -5514,8 +3989,7 @@ None of these lists is meant to be exhaustive. ]


    -

    425. return value of std::get_temporary_buffer

    -Section: 20.4.3 [lib.temporary.buffer]  Status: Review  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    425. return value of std::get_temporary_buffer

    Section: 20.4.3 [lib.temporary.buffer]  Status: Ready  Submitter: Martin Sebor  Date: 18 Sep 2003

    The standard is not clear about the requirements on the value returned from a call to get_temporary_buffer(0). In particular, it fails to specify whether @@ -5525,13 +3999,12 @@ malloc). The standard also fails to mention what the required behavior is when the argument is less than 0.

    Proposed resolution:

    -

    Change 20.4.3 [lib.temporary.buffer] paragraph 2 from "...or a pair of 0 +

    Change 20.4.3 [lib.temporary.buffer] paragraph 2 from "...or a pair of 0 values if no storage can be obtained" to "...or a pair of 0 values if no storage can be obtained or if n <= 0."

    [Kona: Matt provided wording]


    -

    426. search_n(), fill_n(), and generate_n() with negative n

    -Section: 25.1.9 [lib.alg.search], 25.2.5 [lib.alg.fill], 25.2.6 [lib.alg.generate]  Status: Review  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    426. search_n(), fill_n(), and generate_n() with negative n

    Section: 25.1.9 [lib.alg.search], 25.2.5 [lib.alg.fill], 25.2.6 [lib.alg.generate]  Status: Ready  Submitter: Martin Sebor  Date: 18 Sep 2003

    The complexity requirements for these function templates are incorrect (or don't even make sense) for negative n:

    @@ -5559,20 +4032,19 @@ templates don't say anything about the behavior when n is negative.
    Complexity: At most (last1 - first1) * count applications -of the corresponding predicate if count is non-negative, +of the corresponding predicate if count is positive, or 0 otherwise.

    Change 25.2.5, p2 to

    -Effects: Assigns value through all the iterators in the -range [first, last), or [first, first + n) if n is non -negative, none otherwise. +Effects: Assigns value through all the iterators in the range [first, +last), or [first, first + n) if n is positive, none otherwise.

    Change 25.2.5, p3 to:

    -Complexity: Exactly last - first (or n if n is non-negative, +Complexity: Exactly last - first (or n if n is positive, or 0 otherwise) assignments.
    @@ -5583,24 +4055,23 @@ to (notice the correction for the misspelled "through"):
    Effects: Invokes the function object genand assigns the return value of gen through all the iterators in the range [first, last), -or [first, first + n) if n is non-negative, or [first, first) +or [first, first + n) if n is positive, or [first, first) otherwise.

    Change 25.2.6, p3 to:

    -Complexity: Exactly last - first (or n if n is non-negative, +Complexity: Exactly last - first (or n if n is positive, or 0 otherwise) assignments.

    Rationale:

    Informally, we want to say that whenever we see a negative number we treat it the same as if it were zero. We believe the above - changes do that (although they probably aren't the minimal way of - saying so). The LWG considered and rejected the alternative of - saying that negative numbers are undefined behavior.

    + changes do that (although they may not be the minimal way of saying + so). The LWG considered and rejected the alternative of saying that + negative numbers are undefined behavior.


    -

    427. stage 2 and rationale of DR 221

    -Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    427. stage 2 and rationale of DR 221

    Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    The requirements specified in Stage 2 and reiterated in the rationale of DR 221 (and echoed again in DR 303) specify that num_get<charT>:: @@ -5628,39 +4099,26 @@ instantiate the num_get template on user-defined types. traits parameters. This is a fundamental design flaw and it appears all over the place, not just in this one place. It's not clear what the correct solution is, but a thorough review of facets - and traits is in order. (The LWG considered and rejected the + and traits is in order. The LWG considered and rejected the possibility of changing numeric facets to use narrowing instead of - widening: it wouldn't fix the general problem, it would be a - drastic reversal of a deliberate change, and it would probably have - unfortunate performance implications.)]

    -
    -

    428. string::erase(iterator) validity

    -Section: 21.3.5.5 [lib.string::erase]  Status: Ready  Submitter: Martin Sebor  Date: 18 Sep 2003

    -

    -23.1.1, p3 along with Table 67 specify as a prerequisite for a.erase(q) -that q must be a valid dereferenceable iterator into the sequence a. -

    - -

    -However, 21.3.5.5, p5 describing string::erase(p) only requires that -p be a valid iterator. -

    + widening. This may be a good idea for other reasons (see issue + 459), but it doesn't solve the problem raised by this + issue. Whether we use widen or narrow the num_get facet + still has no idea which traits class the user wants to use for + the comparison, because only streams, not facets, are passed traits + classes. The standard does not require that two different + traits classes with the same char_type must necessarily + have the same behavior.]

    + +

    Informally, one possibility: require that some of the basic +character operations, such as eq, lt, +and assign, must behave the same way for all traits classes +with the same char_type. If we accept that limitation on +traits classes, then the facet could reasonably be required to +use char_traits<charT>

    . -

    -This may be interepreted as a relaxation of the general requirement, -which is most likely not the intent. -

    -

    Proposed resolution:

    -

    Remove 21.3.5.5 [lib.string::erase] paragraph 5.

    -

    Rationale:

    -

    The LWG considered two options: changing the string requirements to - match the general container requirements, or just removing the - erroneous string requirements altogether. The LWG chose the latter - option, on the grounds that duplicating text always risks the - possibility that it might be duplicated incorrectly.


    -

    430. valarray subset operations

    -Section: 26.3.2.4 [lib.valarray.sub]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    +

    430. valarray subset operations

    Section: 26.3.2.4 [lib.valarray.sub]  Status: Open  Submitter: Martin Sebor  Date: 18 Sep 2003

    The standard fails to specify the behavior of valarray::operator[](slice) and other valarray subset operations when they are passed an "invalid" @@ -5674,9 +4132,8 @@ object (e.g., slice (2, 1, 1) for a valarray of size 1). performance, so we don't want to require specific checking. We need wording to express this decision.]


    -

    431. Swapping containers with unequal allocators

    -Section: 20.1.5 [lib.allocator.requirements], 25 [lib.algorithms]  Status: Open  Submitter: Matt Austern  Date: 20 Sep 2003

    -

    Clause 20.1.5 [lib.allocator.requirements] paragraph 4 says that implementations +

    431. Swapping containers with unequal allocators

    Section: 20.1.5 [lib.allocator.requirements], 25 [lib.algorithms]  Status: Open  Submitter: Matt Austern  Date: 20 Sep 2003

    +

    Clause 20.1.5 [lib.allocator.requirements] paragraph 4 says that implementations are permitted to supply containers that are unable to cope with allocator instances and that container implementations may assume that all instances of an allocator type compare equal. We gave @@ -5699,7 +4156,8 @@ object (e.g., slice (2, 1, 1) for a valarray of size 1).

    3. The operation swaps both the vectors' contents and their allocators. This would be an O(1) operation. That is:

    -
        my_alloc a1(...);
    +  
    +    my_alloc a1(...);
         my_alloc a2(...);
         assert(a1 != a2);
     
    @@ -5719,9 +4177,10 @@ object (e.g., slice (2, 1, 1) for a valarray of size 1).
     

    [Kona: This is part of a general problem. We need a paper saying how to deal with unequal allocators in general.]

    +

    [pre-Sydney: Howard argues for option 3 in n1599.]

    +
    -

    432. stringbuf::overflow() makes only one write position available

    -Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: Open  Submitter: Christian W Brock  Date: 24 Sep 2003

    +

    432. stringbuf::overflow() makes only one write position available

    Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: Ready  Submitter: Christian W Brock  Date: 24 Sep 2003

    27.7.1.3 par 8 says:

    Notes: The function can make a write position available only if @@ -5751,166 +4210,362 @@ This WOULD force sputc() to call the virtual overflow() each time.

    The proposed change also affects Defect Report 169.

    Proposed resolution:

    -

    Change the paragraph in question to:

    +

    27.7.1.1/2 Change:

    +
    -Notes: The function can make a write position available only if - ( mode & ios_base::out) != 0. To make a write position - available, the function reallocates (or initially allocates) an - array object with a sufficient number of elements to hold the - current array object (if any), plus at least one additional write - position. The function alters the write end - pointer epptr() to point one position past - the end of the new available write area. - If ( mode & ios_base::in) != 0, the function alters the read end - pointer egptr() to point just past the new write position. +2- Notes: The function allocates no array object.
    -

    [Kona: we want to make this change because of efficiency, but we - need to specify more precisely what the underlying character - sequence is; the proposed change isn't enough. (We want the - returned string to end with the last character written, for example, - not the last character allocated. This probably implies that the - stringbuf keep track of a high water mark.) Howard will provide - wording.]

    - -
    -

    434. bitset::to_string() hard to use

    -Section: 23.3.5.2 [lib.bitset.members]  Status: Open  Submitter: Martin Sebor  Date: 15 Oct 2003

    -It has been pointed out a number of times that the bitset to_string() member -function template is tedious to use since callers must explicitly specify the -entire template argument list (3 arguments). At least two implementations -provide a number of overloads of this template to make it easier to use. +to:

    -

    Proposed resolution:

    -

    In order to allow callers to specify no template arguments at all, just the -first one (charT), or the first 2 (charT and traits), in addition to all -three template arguments, add the following three overloads to both the -interface (declarations only) of the class template bitset as well as to -section 23.3.5.2, immediately after p34, the Returns clause of the existing -to_string() member function template:

    -
        template <class charT, class traits>
    -    basic_string<charT, traits, allocator<charT> >
    -    to_string () const;
    +
    +2- Postcondition: str() == "". +
    - -34.1- Returns: to_string<charT, traits, allocator<charT> >(). +

    +27.7.1.1/3 Change: +

    - template <class charT> - basic_string<charT, char_traits<charT>, allocator<charT> > - to_string () const; +
    +

    +-3- Effects: Constructs an object of class basic_stringbuf, +initializing the base class with basic_streambuf() +(lib.streambuf.cons), and initializing mode with which . Then copies +the content of str into the basic_stringbuf underlying character +sequence and initializes the input and output sequences according to +which. If which & ios_base::out is true, initializes the output +sequence with the underlying sequence. If which & ios_base::in is +true, initializes the input sequence with the underlying sequence. +

    +
    - -34.2- Returns: to_string<charT, char_traits<charT>, allocator<charT> >(). +

    to:

    - basic_string<char, char_traits<char>, allocator<char> > - to_string () const; +
    +

    +-3- Effects: Constructs an object of class basic_stringbuf, +initializing the base class with basic_streambuf() +(lib.streambuf.cons), and initializing mode with which. Then copies +the content of str into the basic_stringbuf underlying character +sequence. If which & ios_base::out is true, initializes the output +sequence such that pbase() points to the first underlying character, +epptr() points one past the last underlying character, and if (which & +ios_base::ate) is true, pptr() is set equal to +epptr() else pptr() is set equal to pbase(). If which & ios_base::in +is true, initializes the input sequence such that eback() and gptr() +point to the first underlying character and egptr() points one past +the last underlying character. +

    +
    - -34.3- Returns: to_string<char, char_traits<char>, allocator<char> >(). -
    +

    27.7.1.2/1 Change:

    -

    [Kona: the LWG agrees that this is an improvement over the - status quo. Dietmar will propose an alternative using a proxy - object, so that "s = b.to_string()" would work not just when s is - of type std::string, but when s is of type std::basic_string<C,T> - for arbitrary types C and T.]

    +
    +

    +-1- Returns: A basic_string object whose content is equal to the +basic_stringbuf underlying character sequence. If the buffer is only +created in input mode, the underlying character sequence is equal to +the input sequence; otherwise, it is equal to the output sequence. In +case of an empty underlying character sequence, the function returns +basic_string<charT,traits,Allocator>(). +

    +
    -
    -

    435. bug in DR 25

    -Section: 21.3.7.9 [lib.string.io]  Status: Review  Submitter: Martin Sebor  Date: 15 Oct 2003

    +

    to:

    +

    -It has been pointed out that the proposed resolution in DR 25 may not be -quite up to snuff:
    -http://gcc.gnu.org/ml/libstdc++/2003-09/msg00147.html -http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#25
    +-1- Returns: A basic_string object whose content is equal to the +basic_stringbuf underlying character sequence. If the basic_stringbuf +was created only in input mode, the resultant basic_string contains +the character sequence in the range [eback(), egptr()). If the +basic_stringbuf was created with (which & ios_base::out) being true +then the resultant basic_string contains the character sequence in the +range [pbase(), high_mark) where high_mark represents the position one +past the highest initialized character in the buffer. Characters can +be initialized either through writing to the stream, or by +constructing the basic_stringbuf with a basic_string, or by calling +the str(basic_string) member function. In the case of calling the +str(basic_string) member function, all characters initialized prior to +the call are now considered uninitialized (except for those +characters re-initialized by the new basic_string). Otherwise the +basic_stringbuf has been created in neither input nor output mode and +a zero length basic_string is returned.

    +

    -It looks like Petur is right. The complete corrected text is copied below. -I think we may have have been confused by the reference to 22.2.2.2.2 and -the subsequent description of `n' which actually talks about the second -argument to sputn(), not about the number of fill characters to pad with. +27.7.1.2/2 Change:

    +

    -So the question is: was the original text correct? If the intent was to -follow classic iostreams then it most likely wasn't, since setting width() -to less than the length of the string doesn't truncate it on output. This -is also the behavior of most implementations (except for SGI's standard -iostreams where the operator does truncate). +-2- Effects: If the basic_stringbuf's underlying character sequence is +not empty, deallocates it. Then copies the content of s into the +basic_stringbuf underlying character sequence and initializes the +input and output sequences according to the mode stored when creating +the basic_stringbuf object. If (mode&ios_base::out) is true, then +initializes the output sequence with the underlying sequence. If +(mode&ios_base::in) is true, then initializes the input sequence with +the underlying sequence.

    -

    Proposed resolution:

    -

    Change the text in 21.3.7.9, p4 from

    -
    - If bool(k) is true, inserts characters as if by calling - os.rdbuf()->sputn(str.data(), n), padding as described in stage 3 - of lib.facet.num.put.virtuals, where n is the larger of os.width() - and str.size(); -
    -

    to

    -
    - If bool(k) is true, determines padding as described in - lib.facet.num.put.virtuals, and then inserts the resulting - sequence of characters as if by calling - os.rdbuf()->sputn(sequence, n), where n is the larger of - os.width() and str.size(); -
    +
    -

    [Kona: it appears that neither the original wording, DR25, nor the - proposed resolution, is quite what we want. We want to say that - the string will be output, padded to os.width() if necessary. We - don't want to duplicate the padding rules in clause 22, because - they're complicated, but we need to be careful because they weren't - quite written with quite this case in mind. We need to say what - the character sequence is, and then defer to clause 22. Post-Kona: - Benjamin provided wording.]

    +

    to:

    + +
    +

    +-2- Effects: Copies the content of s into the basic_stringbuf +underlying character sequence. If mode & ios_base::out is true, +initializes the output sequence such that pbase() points to the first +underlying character, epptr() points one past the last underlying +character, and if (mode & ios_base::ate) is true, +pptr() is set equal to epptr() else pptr() is set equal to pbase(). If +mode & ios_base::in is true, initializes the input sequence such that +eback() and gptr() point to the first underlying character and egptr() +points one past the last underlying character. +

    +
    + +

    Remove 27.2.1.2/3. (Same rationale as issue 238: incorrect and unnecessary.)

    + +

    27.7.1.3/1 Change:

    + +
    +

    +1- Returns: If the input sequence has a read position available, +returns traits::to_int_type(*gptr()). Otherwise, returns +traits::eof(). +

    +
    + +

    to:

    + +
    +

    +1- Returns: If the input sequence has a read position available, +returns traits::to_int_type(*gptr()). Otherwise, returns +traits::eof(). Any character in the underlying buffer which has been +initialized is considered to be part of the input sequence. +

    +
    + +

    27.7.1.3/9 Change:

    + +
    +

    +-9- Notes: The function can make a write position available only if ( +mode & ios_base::out) != 0. To make a write position available, the +function reallocates (or initially allocates) an array object with a +sufficient number of elements to hold the current array object (if +any), plus one additional write position. If ( mode & ios_base::in) != +0, the function alters the read end pointer egptr() to point just past +the new write position (as does the write end pointer epptr()). +

    +
    + +

    to:

    + +
    +

    +-9- The function can make a write position available only if ( mode & +ios_base::out) != 0. To make a write position available, the function +reallocates (or initially allocates) an array object with a sufficient +number of elements to hold the current array object (if any), plus one +additional write position. If ( mode & ios_base::in) != 0, the +function alters the read end pointer egptr() to point just past the +new write position. +

    +
    + +

    27.7.1.3/12 Change:

    + +
    +

    +-12- _ If (newoff + off) < 0, or (xend - xbeg) < (newoff + off), the +positioning operation fails. Otherwise, the function assigns xbeg + +newoff + off to the next pointer xnext . +

    +
    + +

    to:

    + +
    +

    +-12- _ If (newoff + off) < 0, or if (newoff + off) refers to an +uninitialized character (as defined in 27.7.1.2 [lib.stringbuf.members] +paragraph 1), the positioning operation fails. Otherwise, the function +assigns xbeg + newoff + off to the next pointer xnext . +

    +
    + +

    [post-Kona: Howard provided wording. At Kona the LWG agreed that + something along these lines was a good idea, but the original + proposed resolution didn't say enough about the effect of various + member functions on the underlying character sequences.]

    +

    Rationale:

    +

    The current basic_stringbuf description is over-constrained in such +a way as to prohibit vendors from making this the high-performance +in-memory stream it was meant to be. The fundamental problem is that +the pointers: eback(), gptr(), egptr(), pbase(), pptr(), epptr() are +observable from a derived client, and the current description +restricts the range [pbase(), epptr()) from being grown geometrically. +This change allows, but does not require, geometric growth of this +range.

    + +

    Backwards compatibility issues: These changes will break code that +derives from basic_stringbuf, observes epptr(), and depends upon +[pbase(), epptr()) growing by one character on each call to overflow() +(i.e. test suites). Otherwise there are no backwards compatibility +issues.

    + +

    27.7.1.1/2: The non-normative note is non-binding, and if it were +binding, would be over specification. The recommended change focuses +on the important observable fact.

    + +

    27.7.1.1/3: This change does two things: 1. It describes exactly +what must happen in terms of the sequences. The terms "input +sequence" and "output sequence" are not well defined. 2. It +introduces a common extension: open with app or ate mode. I concur +with issue 238 that paragraph 4 is both wrong and unnecessary.

    + +

    27.7.1.2/1: This change is the crux of the efficiency issue. The +resultant basic_string is not dependent upon epptr(), and thus +implementors are free to grow the underlying buffer geometrically +during overflow() *and* place epptr() at the end of that buffer.

    + +

    27.7.1.2/2: Made consistent with the proposed 27.7.1.1/3.

    + +

    27.7.1.3/1: Clarifies that characters written to the stream beyond +the initially specified string are available for reading in an i/o +basic_streambuf.

    + +

    27.7.1.3/9: Made normative by removing "Notes:", and removed the +trailing parenthetical comment concerning epptr().

    + +

    27.7.1.3/12: Restricting the positioning to [xbeg, xend) is no +longer allowable since [pbase(), epptr()) may now contain +uninitialized characters. Positioning is only allowable over the +initialized range.


    -

    436. are cv-qualified facet types valid facets?

    -Section: 22.1.1.1.2 [lib.locale.facet]  Status: Ready  Submitter: Martin Sebor  Date: 15 Oct 2003

    +

    434. bitset::to_string() hard to use

    Section: 23.3.5.2 [lib.bitset.members]  Status: Open  Submitter: Martin Sebor  Date: 15 Oct 2003

    -Is "const std::ctype<char>" a valid template argument to has_facet, use_facet, -and the locale template ctor? And if so, does it designate the same Facet as -the non-const "std::ctype<char>?" What about "volatile std::ctype<char>?" -Different implementations behave differently: some fail to compile, others -accept such types but behave inconsistently. +It has been pointed out a number of times that the bitset to_string() member +function template is tedious to use since callers must explicitly specify the +entire template argument list (3 arguments). At least two implementations +provide a number of overloads of this template to make it easier to use.

    Proposed resolution:

    -

    Change 22.1.1.1.2, p1 to read:

    +

    In order to allow callers to specify no template arguments at all, just the +first one (charT), or the first 2 (charT and traits), in addition to all +three template arguments, add the following three overloads to both the +interface (declarations only) of the class template bitset as well as to +section 23.3.5.2, immediately after p34, the Returns clause of the existing +to_string() member function template:

    + +
    +    template <class charT, class traits>
    +    basic_string<charT, traits, allocator<charT> >
    +    to_string () const;
    +
    +    -34.1- Returns: to_string<charT, traits, allocator<charT> >().
    +
    +    template <class charT>
    +    basic_string<charT, char_traits<charT>, allocator<charT> >
    +    to_string () const;
    +
    +    -34.2- Returns: to_string<charT, char_traits<charT>, allocator<charT> >().
    +
    +    basic_string<char, char_traits<char>, allocator<char> >
    +    to_string () const;
    +
    +    -34.3- Returns: to_string<char, char_traits<char>, allocator<char> >().
    +
    + +

    [Kona: the LWG agrees that this is an improvement over the + status quo. Dietmar will propose an alternative using a proxy + object, so that "s = b.to_string()" would work not just when s is + of type std::string, but when s is of type std::basic_string<C,T> + for arbitrary types C and T.]

    + +
    +

    435. bug in DR 25

    Section: 21.3.7.9 [lib.string.io]  Status: Ready  Submitter: Martin Sebor  Date: 15 Oct 2003

    + +

    +It has been pointed out that the proposed resolution in DR 25 may not be +quite up to snuff:
    +http://gcc.gnu.org/ml/libstdc++/2003-09/msg00147.html +http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#25
    +

    + +

    +It looks like Petur is right. The complete corrected text is copied below. +I think we may have have been confused by the reference to 22.2.2.2.2 and +the subsequent description of `n' which actually talks about the second +argument to sputn(), not about the number of fill characters to pad with. +

    -

    Template parameters in this clause which are required to be facets -are those named Facet in declarations. A program that passes a type -that is not a facet, or a type that refers to volatile-qualified -facet, as an (explicit or deduced) template parameter to a locale -function expecting a facet, is ill-formed. A const-qualified facet is -a valid template argument to any locale function that expects a Facet -template parameter.

    +

    +So the question is: was the original text correct? If the intent was to +follow classic iostreams then it most likely wasn't, since setting width() +to less than the length of the string doesn't truncate it on output. This +is also the behavior of most implementations (except for SGI's standard +iostreams where the operator does truncate). +

    +

    Proposed resolution:

    +

    Change the text in 21.3.7.9, p4 from

    +
    + If bool(k) is true, inserts characters as if by calling + os.rdbuf()->sputn(str.data(), n), padding as described in stage 3 + of lib.facet.num.put.virtuals, where n is the larger of os.width() + and str.size(); +
    +

    to

    +
    + If bool(k) is true, determines padding as described in + lib.facet.num.put.virtuals, and then inserts the resulting + sequence of characters seq as if by calling + os.rdbuf()->sputn(seq, n), where n is the larger of + os.width() and str.size(); +
    -

    [Kona: changed the last sentence from a footnote to normative -text.]

    +

    [Kona: it appears that neither the original wording, DR25, nor the + proposed resolution, is quite what we want. We want to say that + the string will be output, padded to os.width() if necessary. We + don't want to duplicate the padding rules in clause 22, because + they're complicated, but we need to be careful because they weren't + quite written with quite this case in mind. We need to say what + the character sequence is, and then defer to clause 22. Post-Kona: + Benjamin provided wording.]


    -

    438. Ambiguity in the "do the right thing" clause

    -Section: 23.1.1 [lib.sequence.reqmts]  Status: Review  Submitter: Howard Hinnant  Date: 20 Oct 2003

    +

    438. Ambiguity in the "do the right thing" clause

    Section: 23.1.1 [lib.sequence.reqmts]  Status: Review  Submitter: Howard Hinnant  Date: 20 Oct 2003

    -

    Section 23.1.1 [lib.sequence.reqmts], paragraphs 9-11, fixed up the problem +

    Section 23.1.1 [lib.sequence.reqmts], paragraphs 9-11, fixed up the problem noticed with statements like:

    -
    vector<int> v(10, 1);
    +
    +vector<int> v(10, 1);
     

    The intent of the above statement was to construct with:

    -
    vector(size_type, const value_type&);
    +
    +vector(size_type, const value_type&);
     

    but early implementations failed to compile as they bound to:

    -
    template <class InputIterator>
    +
    +template <class InputIterator>
     vector(InputIterator f, InputIterator l);
     

    instead.

    Paragraphs 9-11 say that if InputIterator is an integral type, then the member template constructor will have the same effect as:

    -
    vector<static_cast<size_type>(f), static_cast<value_type>(l));
    +
    +vector<static_cast<size_type>(f), static_cast<value_type>(l));
     

    (and similarly for the other member template functions of sequences).

    @@ -5922,7 +4577,8 @@ member template constructor will have the same effect as:

    This might look something like:

    -
    template <class T>
    +
    +template <class T>
     struct vector
     {
          typedef unsigned size_type;
    @@ -5964,7 +4620,8 @@ every call with the member template, detect the type of InputIterator,
     and then redirect to the correct logic.  Something like:
     

    -
    template <class T>
    +
    +template <class T>
     template <class I>
     vector<T>::vector(I f, I l)
     {
    @@ -5993,7 +4650,8 @@ vector<T>::choose_init(I f, I l, int2type<true>)
     
     

    Both of these solutions solve the case the standard specifically mentions:

    -
    vector<int> v(10, 1);  // ok, vector size 10, initialized to 1
    +
    +vector<int> v(10, 1);  // ok, vector size 10, initialized to 1
     

    @@ -6001,7 +4659,8 @@ However, (and here is the problem), the two solutions have different behavior in some cases where the value_type of the sequence is not an integral type. For example consider:

    -
         pair<char, char>                     p('a', 'b');
    +
    +     pair<char, char>                     p('a', 'b');
          vector<vector<pair<char, char> > >   d('a', 'b');
     

    @@ -6009,7 +4668,8 @@ The second line of this snippet is likely an error. Solution A catches the error and refuses to compile. The reason is that there is no specialization of the member template constructor that looks like:

    -
    template <>
    +
    +template <>
     template <>
     vector<vector<pair<char, char> > >::vector(char, char) { ... }
     
    @@ -6026,7 +4686,8 @@ unsigned integral type and used to size the outer vector. 'b' is static casted to the inner vector using it's explicit constructor:

    -
    explicit vector(size_type n);
    +
    +explicit vector(size_type n);
     

    @@ -6043,7 +4704,8 @@ explicit qualifier on the inner vector has been thwarted at any rate. The standard is not clear whether the expression:

    -
         vector<vector<pair<char, char> > >   d('a', 'b');
    +
    +     vector<vector<pair<char, char> > >   d('a', 'b');
     

    @@ -6078,7 +4740,8 @@ the expression above would be to change "static_cast" in paragraphs

    -
    template <class T, class U>
    +
    +template <class T, class U>
     inline
     T implicit_cast(const U& u)
     {
    @@ -6089,21 +4752,23 @@ T implicit_cast(const U& u)
     
     

    Proposed resolution:

    -Replace 23.1.1 [lib.sequence.reqmts] paragraphs 9 - 11 with: +Replace 23.1.1 [lib.sequence.reqmts] paragraphs 9 - 11 with:

    For every sequence defined in this clause and in clause lib.strings:

    • If the constructor

      -
             template <class InputIterator>
      +       
      +       template <class InputIterator>
              X(InputIterator f, InputIterator l,
                const allocator_type& a = allocator_type())
              

      is called with a type InputIterator that does not qualify as an input iterator, then the constructor will behave as if the overloaded constructor:

      -
             X(size_type, const value_type& = value_type(),
      +       
      +       X(size_type, const value_type& = value_type(),
                const allocator_type& = allocator_type())
              

      were called instead, with the arguments f, l and a, respectively.

      @@ -6111,7 +4776,8 @@ Replace 23.1.1 are called with a type InputIterator that does not qualify as an input iterator, then these functions will behave as if the overloaded member functions:

      -
             rt fx1(iterator, size_type, const value_type&);
      +       
      +       rt fx1(iterator, size_type, const value_type&);
       
              rt fx2(size_type, const value_type&);
       
      @@ -6137,27 +4804,37 @@ Replace 23.1.1 

      439. Should facets be copyable?

      -Section: 22.2 [lib.locale.categories]  Status: New  Submitter: Matt Austern  Date: 2 Nov 2003

      -

      The following facets classes have no copy constructors described in - the standard, which, according to the standard, means that they are - supposed to use the compiler-generated defaults. Default copy - behavior is probably inappropriate. We should either make these - classes uncopyable or else specify exactly what their constructors do.

      - -

      Related issue: 421.

      - -
              ctype_base
      -        ctype
      -        ctype_byname
      -        ctype<char>
      -        ctype_byname<char>
      -        codecvt_base
      -        codecvt
      -        codecvt_byname
      -        num_get
      -        num_put
      -        numpunct
      -        numpunct_byname
      -        collate
      -        collate_byname
      -        time_base
      -        time_get
      -        time_get_byname
      -        time_put
      -        time_put_byname
      -        money_get
      -        money_put
      -        money_base
      -        moneypunct
      -        moneypunct_byname
      -        messages_base
      -        messages
      -        messages_byname
      +

      441. Is fpos::state const?

      Section: 27.4.3 [lib.fpos]  Status: Ready  Submitter: Vincent Leloup  Date: 17 Nov 2003

      +

      +In section 27.4.3.1 [lib.fpos.members] fpos<stateT>::state() is declared +non const, but in section 27.4.3 [lib.fpos] it is declared const. +

      +

      Proposed resolution:

      +

      +In section 27.4.3.1 [lib.fpos.members], change the declaration of +fpos<stateT>::state() to const. +

      +
      +

      442. sentry::operator bool() inconsistent signature

      Section: 27.6.2.3 [lib.ostream::sentry]  Status: Ready  Submitter: Vincent Leloup  Date: 18 Nov 2003

      +

      +In section 27.6.2.3 [lib.ostream::sentry] paragraph 4, in description part +basic_ostream<charT, traits>::sentry::operator bool() is declared +as non const, but in section 27.6.2.3, in synopsis it is declared +const. +

      +

      Proposed resolution:

      +

      +In section 27.6.2.3 [lib.ostream::sentry] paragraph 4, change the declaration +of sentry::operator bool() to const. +

      +
      +

      443. filebuf::close() inconsistent use of EOF

      Section: 27.8.1.3 [lib.filebuf.members]  Status: Ready  Submitter: Vincent Leloup  Date: 20 Nov 2003

      +

      +In section 27.8.1.3 [lib.filebuf.members] par6, in effects description of +basic_filebuf<charT, traits>::close(), overflow(EOF) is used twice; +should be overflow(traits::eof()). +

      +

      Proposed resolution:

      +

      +Change overflow(EOF) to overflow(traits::eof()). +

      +
      +

      444. Bad use of casts in fstream

      Section: 27.8.1 [lib.fstreams]  Status: Open  Submitter: Vincent Leloup  Date: 20 Nov 2003

      +

      +27.8.1.7 [lib.ifstream.members] p1, 27.8.1.10 [lib.ofstream.members] p1, 27.8.1.13 [lib.fstream.members] p1 seems have same problem as exposed in LWG issue +252. +

      +

      Proposed resolution:

      + +

      [Sydney: Genuine defect. 27.8.1.13 needs a cast to cast away + constness. The other two places are stylistic: we could change the + C-style casts to const_cast. Post-Sydney: Howard provided wording. +]

      + +

      Change 27.8.1.7/1 from:

      +
      + Returns: (basic_filebuf<charT,traits>*)&sb. +
      + +

      to:

      +
      + Returns: const_cast<basic_filebuf<charT,traits>*>(&sb). +
      + +

      Change 27.8.1.10/1 from:

      +
      + Returns: (basic_filebuf<charT,traits>*)&sb. +
      + +

      to:

      +
      + Returns: const_cast<basic_filebuf<charT,traits>*>(&sb). +
      + +

      Change 27.8.1.13/1 from:

      +
      + Returns: &sb. +
      + +

      to:

      +
      + Returns: const_cast<basic_filebuf<charT,traits>*>(&sb). +
      + + + +
      +

      445. iterator_traits::reference unspecified for some iterator categories

      Section: 24.3.1 [lib.iterator.traits]  Status: Open  Submitter: Dave Abrahams  Date: 9 Dec 2003

      +

      +The standard places no restrictions at all on the reference type +of input, output, or forward iterators (for forward iterators it +only specifies that *x must be value_type& and doesn't mention +the reference type). Bidirectional iterators' reference type is +restricted only by implication, since the base iterator's +reference type is used as the return type of reverse_iterator's +operator*, which must be T& in order to be a conforming forward +iterator. +

      + +

      +Here's what I think we ought to be able to expect from an input +or forward iterator's reference type R, where a is an iterator +and V is its value_type +

      + +
        +
      • + *a is convertible to R +
      • + +
      • + R is convertible to V +
      • + +
      • + static_cast<V>(static_cast<R>(*a)) is equivalent to + static_cast<V>(*a) +
      • +
      + +

      A mutable forward iterator ought to satisfy, for x of type V:

      +
    • + { R r = *a; r = x; } is equivalent to *a = x; +
    • + +

      +I think these requirements capture existing container iterators +(including vector<bool>'s), but render istream_iterator invalid; +its reference type would have to be changed to a constant +reference. +

      + +

      Proposed resolution:

      + +

      [ +Sydney: Agreed that this is underspecified, but it's not the only +place where iterators are underspecified. We may need a more complete +review. One nice simple rule that would solve this problem: *a is +always reference by definition, and a-> is +always pointer by definition. If we do that, then we'll also +have to change a few existing iterators (e.g. istreambuf_iterator) so +they conform to that rule. We need a review of how extensive those +changes would be. Or instead of fixing pointer we could +remove it. (Which would require changing reverse_iterator as part of +that change, since the present reverse_iterator relies on the +existence of pointer.) Jeremy will supply a more detailed +analysis for Redmond. +]

      + +
      +

      446. Iterator equality between different containers

      Section: 24.1 [lib.iterator.requirements], 23.1 [lib.container.requirements]  Status: Open  Submitter: Andy Koenig  Date: 16 Dec 2003

      +

      +What requirements does the standard place on equality comparisons between +iterators that refer to elements of different containers. For example, if +v1 and v2 are empty vectors, is v1.end() == v2.end() allowed to yield true? +Is it allowed to throw an exception? +

      + +

      +The standard appears to be silent on both questions. +

      +

      Proposed resolution:

      + +

      [Sydney: The intention is that comparing two iterators from +different containers is undefined, but it's not clear if we say that, +or even whether it's something we should be saying in clause 23 or in +clause 24. Intuitively we might want to say that equality is defined +only if one iterator is reachable from another, but figuring out how +to say it in any sensible way is a bit tricky: reachability is defined +in terms of equality, so we can't also define equality in terms of +reachability. +]

      + +
      +

      448. Random Access Iterators over abstract classes

      Section: 24.1.5 [lib.random.access.iterators]  Status: Ready  Submitter: Dave Abrahams  Date: 7 Jan 2004

      +

      +Table 76, the random access iterator requirement table, says that the +return type of a[n] must be "convertible to T". When an iterator's +value_type T is an abstract class, nothing is convertible to T. +Surely this isn't an intended restriction? +

      +

      Proposed resolution:

      +

      +Change the return type to "convertible to T const&". +

      +
      +

      449. Library Issue 306 Goes Too Far

      Section: 18.1 [lib.support.types]  Status: Ready  Submitter: Pete Becker  Date: 15 Jan 2004

      +

      Original text:

      +
      +The macro offsetof accepts a restricted set of type arguments in this +International Standard. type shall be a POD structure or a POD union +(clause 9). The result of applying the offsetof macro to a field that +is a static data member or a function member is undefined." +
      + +

      Revised text:

      +
      +"If type is not a POD structure or a POD union the results are undefined." +
      + +

      +Looks to me like the revised text should have replaced only the second +sentence. It doesn't make sense standing alone. +

      + +

      Proposed resolution:

      +

      Change 18.1, paragraph 5, to:

      + +
      +The macro offsetof accepts a restricted set of type arguments in this +International Standard. If type is not a POD structure or a POD union +the results are undefined. The result of applying the offsetof macro +to a field that is a static data member or a function member is +undefined." +
      +
      +

      452.  locale::combine should be permitted to generate a named locale

      Section: 22.1.1.3 [lib.locale.members]  Status: Open  Submitter: Bill Plauger  Date: 30 Jan 2004

      +
      +template<class Facet>
      +	locale::combine(const locale&) const;
      +
      +

      +is obliged to create a locale that has no name. This is overspecification +and overkill. The resulting locale should follow the usual rules -- it +has a name if the locale argument has a name and Facet is one of the +standard facets. +

      + +

      [ + Sydney and post-Sydney (see c++std-lib-13439, c++std-lib-13440, + c++std-lib-13443): agreed that it's overkill to say that the locale + is obligated to be nameless. However, we also can't require it to + have a name. At the moment, locale names are based on categories + and not on individual facets. If a locale contains two different + facets of different names from the same category, then this would + not fit into existing naming schemes. We need to give + implementations more freedom. Bill will provide wording. +]

      + +

      Proposed resolution:

      +

      Rationale:

      +
      +

      453. basic_stringbuf::seekoff need not always fail for an empty stream

      Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: Open  Submitter: Bill Plauger  Date: 30 Jan 2004

      +
      +  pos_type basic_stringbuf::seekoff(off_type, ios_base::seekdir,
      +                                    ios_base::openmode);
       
      +

      +is obliged to fail if nothing has been inserted into the stream. This +is unnecessary and undesirable. It should be permissible to seek to +an effective offset of zero.

      + +

      [ + Sydney: Agreed that this is an annoying problem: seeking to zero should be + legal. Bill will provide wording. +]

      Proposed resolution:

      +
      +

      454. basic_filebuf::open should accept wchar_t names

      Section: 27.8.1.3 [lib.filebuf.members]  Status: Open  Submitter: Bill Plauger  Date: 30 Jan 2004

      +
      +    basic_filebuf *basic_filebuf::open(const char *, ios_base::open_mode);
      +
      + +

      should be supplemented with the overload:

      + +
      +    basic_filebuf *basic_filebuf::open(const wchar_t *, ios_base::open_mode);
      +
      +

      +Depending on the operating system, one of these forms is fundamental and +the other requires an implementation-defined mapping to determine the +actual filename.

      + +

      [Sydney: Yes, we want to allow wchar_t filenames. Bill will + provide wording.]

      + +

      Proposed resolution:

      +
      +

      455. cerr::tie() and wcerr::tie() are overspecified

      Section: 27.3 [lib.iostream.objects]  Status: Open  Submitter: Bill Plauger  Date: 30 Jan 2004

      +

      +Both cerr::tie() and wcerr::tie() are obliged to be null at program +startup. This is overspecification and overkill. It is both traditional +and useful to tie cerr to cout, to ensure that standard output is drained +whenever an error message is written. This behavior should at least be +permitted if not required. Same for wcerr::tie(). +

      +

      Proposed resolution:

      +

      [Sydney: straw poll (3-1): we should require, not just + permit, cout and cerr to be tied on startup. Bill will provide + wording.]

      +
      +

      456. Traditional C header files are overspecified

      Section: 17.4.1.2 [lib.headers]  Status: Open  Submitter: Bill Plauger  Date: 30 Jan 2004

      + +

      The C++ Standard effectively requires that the traditional C headers +(of the form <xxx.h>) be defined in terms of the newer C++ +headers (of the form <cxxx>). Clauses 17.4.1.2/4 and D.5 combine +to require that:

      + +
        +
      • Including the header <cxxx> declares a C name in namespace std.
      • + +
      • Including the header <xxx.h> declares a C name in namespace std + (effectively by including <cxxx>), then imports it into the global + namespace with an individual using declaration.
      • +
      + +

      +The rules were left in this form despited repeated and heated objections +from several compiler vendors. The C headers are often beyond the direct +control of C++ implementors. In some organizations, it's all they can do +to get a few #ifdef __cplusplus tests added. Third-party library vendors +can perhaps wrap the C headers. But neither of these approaches supports +the drastic restructuring required by the C++ Standard. As a result, it is +still widespread practice to ignore this conformance requirement, nearly +seven years after the committee last debated this topic. Instead, what is +often implemented is: +

      + +
        +
      • Including the header <xxx.h> declares a C name in the + global namespace.
      • + +
      • Including the header <cxxx> declares a C name in the + global namespace (effectively by including <xxx.h>), then + imports it into namespace std with an individual using declaration.
      • +
      + +

      +The practical benefit for implementors with the second approach is that +they can use existing C library headers, as they are pretty much obliged +to do. The practical cost for programmers facing a mix of implementations +is that they have to assume weaker rules:

      + +
        +
      • If you want to assuredly declare a C name in the global + namespace, include <xxx.h>. You may or may not also get the + declaration in namespace std.
      • + +
      • If you want to assuredly declare a C name in namespace std, + include <cxxx.h>. You may or may not also get the declaration in + the global namespace.
      • +
      + +

      +There also exists the possibility of subtle differences due to +Koenig lookup, but there are so few non-builtin types defined in the C +headers that I've yet to see an example of any real problems in this +area. +

      + +

      +It is worth observing that the rate at which programmers fall afoul of +these differences has remained small, at least as measured by newsgroup +postings and our own bug reports. (By an overwhelming margin, the +commonest problem is still that programmers include <string> and can't +understand why the typename string isn't defined -- this a decade after +the committee invented namespace std, nominally for the benefit of all +programmers.) +

      + +

      +We should accept the fact that we made a serious mistake and rectify it, +however belatedly, by explicitly allowing either of the two schemes for +declaring C names in headers. +

      + +

      [Sydney: This issue has been debated many times, and will + certainly have to be discussed in full committee before any action + can be taken. However, the preliminary sentiment of the LWG was in + favor of the change. (6 yes, 0 no, 2 abstain) Robert Klarer + suggests that we might also want to undeprecate the + C-style .h headers.]

      + +

      Proposed resolution:


      -

      440. Should std::complex use unqualified transcendentals?

      -Section: 26.2.8 [lib.complex.transcendentals]  Status: New  Submitter: Matt Austern  Date: 5 Nov 2003

      +

      457. bitset constructor: incorrect number of initialized bits

      Section: 23.3.5.1 [lib.bitset.cons]  Status: Review  Submitter: Dag Henriksson  Date: 30 Jan 2004

      -Operations like pow and exp on -complex<T> are typically implemented in terms of -operations like sin and cos on T. -Should implementations write this as std::sin, or as plain -unqualified sin? +The constructor from unsigned long says it initializes "the first M +bit positions to the corresponding bit values in val. M is the smaller +of N and the value CHAR_BIT * sizeof(unsigned long)."

      -

      The issue, of course, is whether we want to use -argument-dependent lookup in the case where T is a -user-defined type. This is similar to the issue of valarray -transcendentals, as discussed in issue 226.

      +

      +Object-representation vs. value-representation strikes again. CHAR_BIT * +sizeof (unsigned long) does not give us the number of bits an unsigned long +uses to hold the value. Thus, the first M bit position above is not +guaranteed to have any corresponding bit values in val. +

      +

      Proposed resolution:

      +

      In 23.3.5.1 [lib.bitset.cons] paragraph 2, change "M is the smaller of + N and the value CHAR_BIT * sizeof (unsigned long). (249)" to + "M is the smaller of N and the number of bits in + the value representation (section 3.9 [basic.types]) of unsigned + long." +

      +
      +

      458. 24.1.5 contains unintented limitation for operator-

      Section: 24.1.5 [lib.random.access.iterators]  Status: Open  Submitter: Daniel Frey  Date: 27 Feb 2004

      +

      +In 24.1.5 [lib.random.access.iterators], table 76 the operational +semantics for the expression "r -= n" are defined as "return r += -n". +This means, that the expression -n must be valid, which is not the case +for unsigned types. +

      -

      This issue differs from valarray transcendentals in two important -ways. First, "the effect of instantiating the template -complex for types other than float, double or long double is -unspecified." (26.2.1 [lib.complex.synopsis]) Second, the standard does not -dictate implementation, so there is no guarantee that a particular -real math function is used in the implementation of a particular -complex function.

      +

      [ +Sydney: Possibly not a real problem, since difference type is required +to be a signed integer type. However, the wording in the standard may +be less clear than we would like. +]

      +

      Proposed resolution:

      +

      +To remove this limitation, I suggest to change the +operational semantics for this column to: +

      + + { Distance m = n; + if (m >= 0) + while (m--) --r; + else + while (m++) ++r; + return r; } + + +
      +

      459. Requirement for widening in stage 2 is overspecification

      Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: Open  Submitter: Martin Sebor  Date: 16 Mar 2004

      +

      When parsing strings of wide-character digits, the standard + requires the library to widen narrow-character "atoms" and compare + the widened atoms against the characters that are being parsed. + Simply narrowing the wide characters would be far simpler, and + probably more efficient. The two choices are equivalent except in + convoluted test cases, and many implementations already ignore the + standard and use narrow instead of widen.

      + +

      +First, I disagree that using narrow() instead of widen() would +necessarily have unfortunate performance implications. A possible +implementation of narrow() that allows num_get to be implemented +in a much simpler and arguably comparably efficient way as calling +widen() allows, i.e. without making a virtual call to do_narrow every +time, is as follows: +

      + +
      +  inline char ctype<wchar_t>::narrow (wchar_t wc, char dflt) const
      +  {
      +      const unsigned wi = unsigned (wc);
      +
      +      if (wi > UCHAR_MAX)
      +          return typeid (*this) == typeid (ctype<wchar_t>) ?
      +                 dflt : do_narrow (wc, dflt);
      +
      +      if (narrow_ [wi] < 0) {
      +         const char nc = do_narrow (wc, dflt);
      +         if (nc == dflt)
      +             return dflt;
      +         narrow_ [wi] = nc;
      +      }
      +
      +      return char (narrow_ [wi]);
      +  }
      +
      + +

      +Second, I don't think the change proposed in the issue (i.e., to use +narrow() instead of widen() during Stage 2) would be at all +drastic. Existing implementations with the exception of libstdc++ +currently already use narrow() so the impact of the change on programs +would presumably be isolated to just a single implementation. Further, +since narrow() is not required to translate alternate wide digit +representations such as those mentioned in issue 303 to +their narrow equivalents (i.e., the portable source characters '0' +through '9'), the change does not necessarily imply that these +alternate digits would be treated as ordinary digits and accepted as +part of numbers during parsing. In fact, the requirement in 22.2.1.1.2 [lib.locale.ctype.virtuals], p13 forbids narrow() to translate an alternate +digit character, wc, to an ordinary digit in the basic source +character set unless the expression +(ctype<charT>::is(ctype_base::digit, wc) == true) holds. This in +turn is prohibited by the C standard (7.25.2.1.5, 7.25.2.1.5, and +5.2.1, respectively) for charT of either char or wchar_t. +

      + +

      [Sydney: To a large extent this is a nonproblem. As long as +you're only trafficking in char and wchar_t we're only dealing with a +stable character set, so you don't really need either 'widen' or +'narrow': can just use literals. Finally, it's not even clear whether +widen-vs-narrow is the right question; arguably we should be using +codecvt instead.]

      + +

      Proposed resolution:

      +

      Change stage 2 so that implementations are permitted to use either +technique to perform the comparison:

      +
        +
      1. call widen on the atoms and compare (either by using + operator== or char_traits<charT>::eq) the input with + the widened atoms, or
      2. +
      3. call narrow on the input and compare the narrow input + with the atoms
      4. +
      5. do (1) or (2) only if charT is not char or wchar_t, + respectively; i.e., avoid calling widen or narrow + if it the source and destination types are the same
      6. +
      +
      +

      460. Default modes missing from basic_fstream member specifications

      Section: 27.8.1 [lib.fstreams]  Status: New  Submitter: Ben Hutchings  Date: 1 Apr 2004

      +

      +The second parameters of the non-default constructor and of the open +member function for basic_fstream, named "mode", are optional +according to the class declaration in 27.8.1.11 [lib.fstream]. The +specifications of these members in 27.8.1.12 [lib.fstream.cons] and +27.8.1.13 lib.fstream.members] disagree with this, though the +constructor declaration has the "explicit" function-specifier implying +that it is intended to be callable with one argument. +

      +

      Proposed resolution:

      +

      +

      +
      +

      461. time_get hard or impossible to implement

      Section: 22.2.5.1 [lib.locale.time.get]  Status: New  Submitter: Bill Plauger  Date: 23 Mar 2004

      +

      +Template time_get currently contains difficult, if not impossible, +requirements for do_date_order, do_get_time, and do_get_date. All require +the implementation to scan a field generated by the %x or %X conversion +specifier in strftime. Yes, do_date_order can always return no_order, but +that doesn't help the other functions. The problem is that %x can be +nearly anything, and it can vary widely with locales. It's horribly +onerous to have to parse "third sunday after Michaelmas in the year of +our Lord two thousand and three," but that's what we currently ask of +do_get_date. More practically, it leads some people to think that if +%x produces 10.2.04, we should know to look for dots as separators. Still +not easy. +

      + +

      +Note that this is the opposite effect from the intent stated in the +footnote earlier in this subclause: +

      + +
      +"In other words, user confirmation is required for reliable parsing of +user-entered dates and times, but machine-generated formats can be +parsed reliably. This allows parsers to be aggressive about interpreting +user variations on standard formats." +
      + +

      +We should give both implementers and users an easier and more reliable +alternative: provide a (short) list of alternative delimiters and say +what the default date order is for no_order. For backward compatibility, +and maximum latitude, we can permit an implementation to parse whatever +%x or %X generates, but we shouldn't require it. +

      +

      Proposed resolution:

      +

      +

      +
      +

      462. Destroying objects with static storage duration

      Section: 3.6.3 [basic.start.term], 18.3 [lib.support.start.term]  Status: New  Submitter: Bill Plauger  Date: 23 Mar 2004

      +

      +3.6.3 Termination spells out in detail the interleaving of static +destructor calls and calls to functions registered with atexit. To +match this behavior requires intimate cooperation between the code +that calls destructors and the exit/atexit machinery. The former +is tied tightly to the compiler; the latter is a primitive mechanism +inherited from C that traditionally has nothing to do with static +construction and destruction. The benefits of intermixing destructor +calls with atexit handler calls is questionable at best, and very +difficult to get right, particularly when mixing third-party C++ +libraries with different third-party C++ compilers and C libraries +supplied by still other parties. +

      + +

      +I believe the right thing to do is defer all static destruction +until after all atexit handlers are called. This is a change in +behavior, but one that is likely visible only to perverse test +suites. At the very least, we should permit deferred destruction +even if we don't require it. +

      Proposed resolution:

      ----- End of document -----

      - \ No newline at end of file + + diff --git a/libstdc++-v3/docs/html/ext/lwg-defects.html b/libstdc++-v3/docs/html/ext/lwg-defects.html index dc11dc47eb1..b35b9e04ccc 100644 --- a/libstdc++-v3/docs/html/ext/lwg-defects.html +++ b/libstdc++-v3/docs/html/ext/lwg-defects.html @@ -1,14 +1,15 @@ -C++ Standard Library Defect Report List - - + + +C++ Standard Library Defect Report List + - + - + - + @@ -18,35 +19,43 @@ -
      Doc. no.N1538=03-0121N1636=04-0076
      Date:13 Nov 200312 Apr 2004
      Project:Reply to: Matt Austern <austern@apple.com>
      -

      C++ Standard Library Defect Report List (Revision 28)

      + +

      C++ Standard Library Defect Report List (Revision 30)

      Reference ISO/IEC IS 14882:1998(E)

      Also see:

      This document contains only library issues which have been closed by the Library Working Group (LWG) after being found to be defects - in the standard. That is, issues which have a status of DR, TC, or RR. See the - Library Closed Issues List for issues closed as non-defects. See the - Library Active Issues List for active issues and more information. The + in the standard. That is, issues which have a status of DR, TC, or RR. See the + Library Closed Issues List for issues closed as non-defects. See the + Library Active Issues List for active issues and more information. The introductory material in that document also applies to this document.

      Revision History

        +
      • R30: +Post-Sydney mailing: reflects decisions made at the Sydney meeting. +Voted all "Ready" issues from R29 into the working paper. +Added new issues 460-462. +
      • +
      • R29: +Pre-Sydney mailing. Added new issues 441-457. +
      • R28: -Post-Kona mailing: reflects decisiosn made at the Kona meeting. -Added new issues 432-440. +Post-Kona mailing: reflects decisions made at the Kona meeting. +Added new issues 432-440.
      • R27: -Pre-Kona mailing. Added new issues 404-431. +Pre-Kona mailing. Added new issues 404-431.
      • R26: Post-Oxford mailing: reflects decisions made at the Oxford meeting. @@ -54,139 +63,139 @@ All issues in Ready status were voted into DR status. All issues in DR status were voted into WP status.
      • R25: -Pre-Oxford mailing. Added new issues 390-402. +Pre-Oxford mailing. Added new issues 390-402.
      • R24: Post-Santa Cruz mailing: reflects decisions made at the Santa Cruz -meeting. All Ready issues from R23 with the exception of 253, which has been given a new proposed resolution, were -moved to DR status. Added new issues 383-389. (Issues 387-389 were discussed -at the meeting.) Made progress on issues 225, 226, 229: 225 and 229 have been moved to Ready status, and the only remaining -concerns with 226 involve wording. +meeting. All Ready issues from R23 with the exception of 253, which has been given a new proposed resolution, were +moved to DR status. Added new issues 383-389. (Issues 387-389 were discussed +at the meeting.) Made progress on issues 225, 226, 229: 225 and 229 have been moved to Ready status, and the only remaining +concerns with 226 involve wording.
      • R23: -Pre-Santa Cruz mailing. Added new issues 367-382. +Pre-Santa Cruz mailing. Added new issues 367-382. Moved issues in the TC to TC status.
      • R22: -Post-Curaçao mailing. Added new issues 362-366. +Post-Curaçao mailing. Added new issues 362-366.
      • R21: -Pre-Curaçao mailing. Added new issues 351-361. +Pre-Curaçao mailing. Added new issues 351-361.
      • R20: Post-Redmond mailing; reflects actions taken in Redmond. Added -new issues 336-350, of which issues -347-350 were added since Redmond, hence +new issues 336-350, of which issues +347-350 were added since Redmond, hence not discussed at the meeting. All Ready issues were moved to DR status, with the exception of issues -284, 241, and 267. +284, 241, and 267. Noteworthy issues discussed at Redmond include -120 202, 226, 233, -270, 253, 254, 323. +120 202, 226, 233, +270, 253, 254, 323.
      • R19: Pre-Redmond mailing. Added new issues -323-335. +323-335.
      • R18: Post-Copenhagen mailing; reflects actions taken in Copenhagen. -Added new issues 312-317, and discussed -new issues 271-314. +Added new issues 312-317, and discussed +new issues 271-314. Changed status of issues -103 118 136 153 -165 171 183 184 -185 186 214 221 -234 237 243 248 -251 252 256 260 -261 262 263 265 -268 +103 118 136 153 +165 171 183 184 +185 186 214 221 +234 237 243 248 +251 252 256 260 +261 262 263 265 +268 to DR. Changed status of issues -49 109 117 182 -228 230 232 235 -238 241 242 250 -259 264 266 267 -271 272 273 275 -281 284 285 286 -288 292 295 297 -298 301 303 306 -307 308 312 +49 109 117 182 +228 230 232 235 +238 241 242 250 +259 264 266 267 +271 272 273 275 +281 284 285 286 +288 292 295 297 +298 301 303 306 +307 308 312 to Ready. Closed issues -111 277 279 287 -289 293 302 313 -314 +111 277 279 287 +289 293 302 313 +314 as NAD.
      • R17: Pre-Copenhagen mailing. Converted issues list to XML. Added proposed -resolutions for issues 49, 76, 91, 235, 250, 267. -Added new issues 278-311. +resolutions for issues 49, 76, 91, 235, 250, 267. +Added new issues 278-311.
      • R16: post-Toronto mailing; reflects actions taken in Toronto. Added new -issues 265-277. Changed status of issues -3, 8, 9, 19, -26, 31, 61, -63, 86, 108, -112, 114, 115, -122, 127, 129, -134, 137, 142, -144, 146, 147, -159, 164, 170, -181, 199, 208, -209, 210, 211, -212, 217, 220, -222, 223, 224, -227 to "DR". Reopened issue 23. Reopened -issue 187. Changed issues 2 and -4 to NAD. Fixed a typo in issue 17. Fixed -issue 70: signature should be changed both places it -appears. Fixed issue 160: previous version didn't fix +issues 265-277. Changed status of issues +3, 8, 9, 19, +26, 31, 61, +63, 86, 108, +112, 114, 115, +122, 127, 129, +134, 137, 142, +144, 146, 147, +159, 164, 170, +181, 199, 208, +209, 210, 211, +212, 217, 220, +222, 223, 224, +227 to "DR". Reopened issue 23. Reopened +issue 187. Changed issues 2 and +4 to NAD. Fixed a typo in issue 17. Fixed +issue 70: signature should be changed both places it +appears. Fixed issue 160: previous version didn't fix the bug in enough places.
      • R15: pre-Toronto mailing. Added issues -233-264. Some small HTML formatting +233-264. Some small HTML formatting changes so that we pass Weblint tests.
      • R14: post-Tokyo II mailing; reflects committee actions taken in -Tokyo. Added issues 228 to 232. (00-0019R1/N1242) +Tokyo. Added issues 228 to 232. (00-0019R1/N1242)
      • R13: -pre-Tokyo II updated: Added issues 212 to 227. +pre-Tokyo II updated: Added issues 212 to 227.
      • R12: -pre-Tokyo II mailing: Added issues 199 to -211. Added "and paragraph 5" to the proposed resolution -of issue 29. Add further rationale to issue -178. +pre-Tokyo II mailing: Added issues 199 to +211. Added "and paragraph 5" to the proposed resolution +of issue 29. Add further rationale to issue +178.
      • R11: post-Kona mailing: Updated to reflect LWG and full committee actions in Kona (99-0048/N1224). Note changed resolution of issues -4 and 38. Added issues 196 -to 198. Closed issues list split into "defects" and +4 and 38. Added issues 196 +to 198. Closed issues list split into "defects" and "closed" documents. Changed the proposed resolution of issue -4 to NAD, and changed the wording of proposed resolution -of issue 38. +4 to NAD, and changed the wording of proposed resolution +of issue 38.
      • R10: -pre-Kona updated. Added proposed resolutions 83, -86, 91, 92, -109. Added issues 190 to -195. (99-0033/D1209, 14 Oct 99) +pre-Kona updated. Added proposed resolutions 83, +86, 91, 92, +109. Added issues 190 to +195. (99-0033/D1209, 14 Oct 99)
      • R9: -pre-Kona mailing. Added issues 140 to -189. Issues list split into separate "active" and +pre-Kona mailing. Added issues 140 to +189. Issues list split into separate "active" and "closed" documents. (99-0030/N1206, 25 Aug 99)
      • R8: @@ -194,48 +203,47 @@ post-Dublin mailing. Updated to reflect LWG and full committee actions in Dublin. (99-0016/N1193, 21 Apr 99)
      • R7: -pre-Dublin updated: Added issues 130, 131, -132, 133, 134, -135, 136, 137, -138, 139 (31 Mar 99) +pre-Dublin updated: Added issues 130, 131, +132, 133, 134, +135, 136, 137, +138, 139 (31 Mar 99)
      • R6: -pre-Dublin mailing. Added issues 127, 128, -and 129. (99-0007/N1194, 22 Feb 99) +pre-Dublin mailing. Added issues 127, 128, +and 129. (99-0007/N1194, 22 Feb 99)
      • R5: -update issues 103, 112; added issues -114 to 126. Format revisions to prepare +update issues 103, 112; added issues +114 to 126. Format revisions to prepare for making list public. (30 Dec 98)
      • R4: -post-Santa Cruz II updated: Issues 110, -111, 112, 113 added, several +post-Santa Cruz II updated: Issues 110, +111, 112, 113 added, several issues corrected. (22 Oct 98)
      • R3: -post-Santa Cruz II: Issues 94 to 109 +post-Santa Cruz II: Issues 94 to 109 added, many issues updated to reflect LWG consensus (12 Oct 98)
      • R2: -pre-Santa Cruz II: Issues 73 to 93 added, -issue 17 updated. (29 Sep 98) +pre-Santa Cruz II: Issues 73 to 93 added, +issue 17 updated. (29 Sep 98)
      • R1: -Correction to issue 55 resolution, 60 code -format, 64 title. (17 Sep 98) +Correction to issue 55 resolution, 60 code +format, 64 title. (17 Sep 98)

      Defect Reports


      -

      1. C library linkage editing oversight

      -Section: 17.4.2.2 [lib.using.linkage]  Status: TC  Submitter: Beman Dawes  Date: 16 Nov 1997

      +

      1. C library linkage editing oversight

      Section: 17.4.2.2 [lib.using.linkage]  Status: TC  Submitter: Beman Dawes  Date: 16 Nov 1997

      The change specified in the proposed resolution below did not make it into the Standard. This change was accepted in principle at the London meeting, and the exact wording below was accepted at the Morristown meeting.

      Proposed resolution:

      -

      Change 17.4.2.2 [lib.using.linkage] paragraph 2 +

      Change 17.4.2.2 [lib.using.linkage] paragraph 2 from:

      @@ -253,8 +261,7 @@ from:

      use extern "C++" linkage for this purpose.


      -

      3. Atexit registration during atexit() call is not described

      -Section: 18.3 [lib.support.start.term]  Status: TC  Submitter: Steve Clamage  Date: 12 Dec 1997

      +

      3. Atexit registration during atexit() call is not described

      Section: 18.3 [lib.support.start.term]  Status: TC  Submitter: Steve Clamage  Date: 12 Dec 1997

      We appear not to have covered all the possibilities of exit processing with respect to atexit registration.
      @@ -373,8 +380,7 @@ committee decides.

      See 99-0039/N1215, October 22, 1999, by Stephen D. Clamage for the analysis supporting to the proposed resolution.


      -

      5. String::compare specification questionable

      -Section: 21.3.6.8 [lib.string::compare]  Status: TC  Submitter: Jack Reeves  Date: 11 Dec 1997

      +

      5. String::compare specification questionable

      Section: 21.3.6.8 [lib.string::compare]  Status: TC  Submitter: Jack Reeves  Date: 11 Dec 1997

      At the very end of the basic_string class definition is the signature: int compare(size_type pos1, size_type n1, const charT* s, size_type n2 = npos) const; In the following text this is defined as: returns @@ -394,7 +400,7 @@ something like: str.compare(1, str.size()-1, s, strlen(s)-1);

      pos1, size_type n1, const charT* s) const int compare(size_type pos1, size_type n1, const charT* s, size_type n2) const; each defined in terms of the corresponding constructor.

      Proposed resolution:

      -

      Replace the compare signature in 21.3 [lib.basic.string] +

      Replace the compare signature in 21.3 [lib.basic.string] (at the very end of the basic_string synopsis) which reads:

      @@ -413,26 +419,23 @@ charT* s, size_type n2) const; each defined in terms of the corresponding constr size_type n2) const;

      -

      Replace the portion of 21.3.6.8 [lib.string::compare] +

      Replace the portion of 21.3.6.8 [lib.string::compare] paragraphs 5 and 6 which read:

      -

      -int compare(size_type pos, size_type n1,
      +

      int compare(size_type pos, size_type n1,
                  charT * s, size_type n2 = npos) const;
      Returns:
      basic_string<charT,traits,Allocator>(*this, pos, n1).compare(
                   - basic_string<charT,traits,Allocator>( s, n2))
      -

      + basic_string<charT,traits,Allocator>( s, n2))

      with:

      -

      -int compare(size_type pos, size_type n1,
      +

      int compare(size_type pos, size_type n1,
                  const charT * s) const;
      Returns:
      basic_string<charT,traits,Allocator>(*this, pos, n1).compare(
      @@ -445,8 +448,7 @@ paragraphs 5 and 6 which read:

      Returns:
      basic_string<charT,traits,Allocator>(*this, pos, n1).compare(
                   - basic_string<charT,traits,Allocator>( s, n2))
      -

      + basic_string<charT,traits,Allocator>( s, n2))

      Editors please note that in addition to splitting the signature, the third argument @@ -456,9 +458,8 @@ becomes const, matching the existing synopsis.

      the Standard which must be fixed.  The same problem was also identified in issues 7 (item 5) and 87.


      -

      7. String clause minor problems

      -Section: 21 [lib.strings]  Status: TC  Submitter: Matt Austern  Date: 15 Dec 1997

      -

      (1) In 21.3.5.4 [lib.string::insert], the description of template +

      7. String clause minor problems

      Section: 21 [lib.strings]  Status: TC  Submitter: Matt Austern  Date: 15 Dec 1997

      +

      (1) In 21.3.5.4 [lib.string::insert], the description of template <class InputIterator> insert(iterator, InputIterator, InputIterator) makes no sense. It refers to a member function that doesn't exist. It also talks about the return value of a void @@ -479,10 +480,9 @@ possible const charT&.

      charT* in the description. Second, given what it says in RETURNS, leaving out the final argument will always result in an exception getting thrown. This is paragraphs 5 and 6 of -21.3.6.8 [lib.string::compare] -

      +21.3.6.8 [lib.string::compare]

      -

      (6) In table 37, in section 21.1.1 [lib.char.traits.require], +

      (6) In table 37, in section 21.1.1 [lib.char.traits.require], there's a note for X::move(s, p, n). It says "Copies correctly even where p is in [s, s+n)". This is correct as far as it goes, but it doesn't go far enough; it should also guarantee that the copy @@ -527,8 +527,7 @@ with:
           "Copies correctly even where the ranges [p, p+n) and [s, s+n) overlap."


      -

      8. Locale::global lacks guarantee

      -Section: 22.1.1.5 [lib.locale.statics]  Status: TC  Submitter: Matt Austern  Date: 24 Dec 1997

      +

      8. Locale::global lacks guarantee

      Section: 22.1.1.5 [lib.locale.statics]  Status: TC  Submitter: Matt Austern  Date: 24 Dec 1997

      It appears there's an important guarantee missing from clause 22. We're told that invoking locale::global(L) sets the C locale if L has a name. However, we're not told whether or not invoking @@ -537,7 +536,7 @@ setlocale(s) sets the global C++ locale.

      The intent, I think, is that it should not, but I can't find any such words anywhere.

      Proposed resolution:

      -

      Add a sentence at the end of 22.1.1.5 [lib.locale.statics], +

      Add a sentence at the end of 22.1.1.5 [lib.locale.statics], paragraph 2: 

      @@ -546,8 +545,7 @@ paragraph 2: 


      -

      9. Operator new(0) calls should not yield the same pointer

      -Section: 18.4.1 [lib.new.delete]  Status: TC  Submitter: Steve Clamage  Date: 4 Jan 1998

      +

      9. Operator new(0) calls should not yield the same pointer

      Section: 18.4.1 [lib.new.delete]  Status: TC  Submitter: Steve Clamage  Date: 4 Jan 1998

      Scott Meyers, in a comp.std.c++ posting: I just noticed that section 3.7.3.1 of CD2 seems to allow for the possibility that all calls to operator new(0) yield the same pointer, an implementation @@ -601,8 +599,7 @@ list maintainer's note: the IS is the same.]

      See 99-0040/N1216, October 22, 1999, by Stephen D. Clamage for the analysis supporting to the proposed resolution.


      -

      11. Bitset minor problems

      -Section: 23.3.5 [lib.template.bitset]  Status: TC  Submitter: Matt Austern  Date: 22 Jan 1998

      +

      11. Bitset minor problems

      Section: 23.3.5 [lib.template.bitset]  Status: TC  Submitter: Matt Austern  Date: 22 Jan 1998

      (1) bitset<>::operator[] is mentioned in the class synopsis (23.3.5), but it is not documented in 23.3.5.2.

      @@ -616,7 +613,7 @@ go in the Effects clause.

      Proposed resolution:

      ITEMS 1 AND 2:

      -In the bitset synopsis (23.3.5 [lib.template.bitset]), +In the bitset synopsis (23.3.5 [lib.template.bitset]), replace the member function

          reference operator[](size_t pos);
      @@ -626,12 +623,11 @@ with the two member functions
          bool operator[](size_t pos) const;
          reference operator[](size_t pos);

      -Add the following text at the end of 23.3.5.2 [lib.bitset.members], +Add the following text at the end of 23.3.5.2 [lib.bitset.members], immediately after paragraph 45:

      -

      -bool operator[](size_t pos) const;
      +

      bool operator[](size_t pos) const;
      Requires: pos is valid
      Throws: nothing
      Returns: test(pos)
      @@ -641,25 +637,22 @@ immediately after paragraph 45:

      Throws: nothing
      Returns: An object of type bitset<N>::reference such that (*this)[pos] == this->test(pos), and such that (*this)[pos] = val is equivalent to this->set(pos, - val); -

      + val);

      Rationale:

      The LWG believes Item 3 is not a defect. "Formatted -input" implies the desired semantics. See 27.6.1.2 [lib.istream.formatted]. +input" implies the desired semantics. See 27.6.1.2 [lib.istream.formatted].


      -

      13. Eos refuses to die

      -Section: 27.6.1.2.3 [lib.istream::extractors]  Status: TC  Submitter: William M. Miller  Date: 3 Mar 1998

      +

      13. Eos refuses to die

      Section: 27.6.1.2.3 [lib.istream::extractors]  Status: TC  Submitter: William M. Miller  Date: 3 Mar 1998

      In 27.6.1.2.3, there is a reference to "eos", which is the only one in the whole draft (at least using Acrobat search), so it's undefined.

      Proposed resolution:

      -

      In 27.6.1.2.3 [lib.istream::extractors], replace "eos" with +

      In 27.6.1.2.3 [lib.istream::extractors], replace "eos" with "charT()"


      -

      14. Locale::combine should be const

      -Section: 22.1.1.3 [lib.locale.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      +

      14. Locale::combine should be const

      Section: 22.1.1.3 [lib.locale.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      locale::combine is the only member function of locale (other than constructors and destructor) that is not const. There is no reason for it not to be const, and good reasons why it should have been const. Furthermore, leaving it non-const conflicts with 22.1.1 @@ -671,34 +664,31 @@ function. As constructors are never const, there was no "const" in the interface which was transformed into member "combine". It should have been added at that time, but the omission was not noticed.

      Proposed resolution:

      -

      In 22.1.1 [lib.locale] and also in 22.1.1.3 [lib.locale.members], add +

      In 22.1.1 [lib.locale] and also in 22.1.1.3 [lib.locale.members], add "const" to the declaration of member combine:

      template <class Facet> locale combine(const locale& other) const; 

      -

      15. Locale::name requirement inconsistent

      -Section: 22.1.1.3 [lib.locale.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      +

      15. Locale::name requirement inconsistent

      Section: 22.1.1.3 [lib.locale.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      locale::name() is described as returning a string that can be passed to a locale constructor, but there is no matching constructor.

      Proposed resolution:

      -

      In 22.1.1.3 [lib.locale.members], paragraph 5, replace +

      In 22.1.1.3 [lib.locale.members], paragraph 5, replace "locale(name())" with "locale(name().c_str())".


      -

      16. Bad ctype_byname<char> decl

      -Section: 22.2.1.4 [lib.locale.ctype.byname.special]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      +

      16. Bad ctype_byname<char> decl

      Section: 22.2.1.4 [lib.locale.ctype.byname.special]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      The new virtual members ctype_byname<char>::do_widen and do_narrow did not get edited in properly. Instead, the member do_widen appears four times, with wrong argument lists.

      Proposed resolution:

      The correct declarations for the overloaded members do_narrow and do_widen should be copied -from 22.2.1.3 [lib.facet.ctype.special].

      +from 22.2.1.3 [lib.facet.ctype.special].


      -

      17. Bad bool parsing

      -Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      +

      17. Bad bool parsing

      Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

      This section describes the process of parsing a text boolean value from the input stream. It does not say it recognizes either of the sequences "true" or "false" and returns the corresponding bool value; instead, it says it recognizes @@ -740,7 +730,7 @@ I believe the correct algorithm is "as if":

      when one is a substring of the other. The proposed text below captures the logic of the code above.

      Proposed resolution:

      -

      In 22.2.2.1.2 [lib.facet.num.get.virtuals], in the first line of paragraph 14, +

      In 22.2.2.1.2 [lib.facet.num.get.virtuals], in the first line of paragraph 14, change "&&" to "&".

      Then, replace paragraphs 15 and 16 as follows:

      @@ -777,19 +767,17 @@ change "&&" to "&".

      err==str.failbit. --end example]


    -

    18. Get(...bool&) omitted

    -Section: 22.2.2.1.1 [lib.facet.num.get.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    18. Get(...bool&) omitted

    Section: 22.2.2.1.1 [lib.facet.num.get.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the list of num_get<> non-virtual members on page 22-23, the member that parses bool values was omitted from the list of definitions of non-virtual members, though it is listed in the class definition and the corresponding virtual is listed everywhere appropriate.

    Proposed resolution:

    -

    Add at the beginning of 22.2.2.1.1 [lib.facet.num.get.members] +

    Add at the beginning of 22.2.2.1.1 [lib.facet.num.get.members] another get member for bool&, copied from the entry in -22.2.2.1 [lib.locale.num.get].

    +22.2.2.1 [lib.locale.num.get].


    -

    19. "Noconv" definition too vague

    -Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    19. "Noconv" definition too vague

    Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the definitions of codecvt<>::do_out and do_in, they are specified to return noconv if "no conversion is @@ -799,11 +787,10 @@ normatively what is done with the buffers.

    Proposed resolution:

    Change the entry for noconv in the table under paragraph 4 in section -22.2.1.5.2 [lib.locale.codecvt.virtuals] to read: +22.2.1.5.2 [lib.locale.codecvt.virtuals] to read:

    -

    -noconv: internT and externT are the same type, +

    noconv: internT and externT are the same type, and input sequence is identical to converted sequence.

    Change the Note in paragraph 2 to normative text as follows:

    @@ -814,24 +801,22 @@ Change the entry for noconv in the table under paragraph 4 in section unchanged, and there are no changes to the values in [to, to_limit).


    -

    20. Thousands_sep returns wrong type

    -Section: 22.2.3.1.2 [lib.facet.numpunct.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    20. Thousands_sep returns wrong type

    Section: 22.2.3.1.2 [lib.facet.numpunct.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The synopsis for numpunct<>::do_thousands_sep, and the definition of numpunct<>::thousands_sep which calls it, specify that it returns a value of type char_type. Here it is erroneously described as returning a "string_type".

    Proposed resolution:

    -

    In 22.2.3.1.2 [lib.facet.numpunct.virtuals], above paragraph 2, change +

    In 22.2.3.1.2 [lib.facet.numpunct.virtuals], above paragraph 2, change "string_type" to "char_type".


    -

    21. Codecvt_byname<> instantiations

    -Section: 22.1.1.1.1 [lib.locale.category]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    21. Codecvt_byname<> instantiations

    Section: 22.1.1.1.1 [lib.locale.category]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the second table in the section, captioned "Required instantiations", the instantiations for codecvt_byname<> have been omitted. These are necessary to allow users to construct a locale by name from facets.

    Proposed resolution:

    -

    Add in 22.1.1.1.1 [lib.locale.category] to the table captioned +

    Add in 22.1.1.1.1 [lib.locale.category] to the table captioned "Required instantiations", in the category "ctype" the lines

    @@ -840,8 +825,7 @@ the lines

    codecvt_byname<wchar_t,char,mbstate_t>

    -

    22. Member open vs. flags

    -Section: 27.8.1.7 [lib.ifstream.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    22. Member open vs. flags

    Section: 27.8.1.7 [lib.ifstream.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The description of basic_istream<>::open leaves unanswered questions about how it responds to or changes flags in the error status for the stream. A strict reading indicates that it ignores the bits and does not change them, which confuses users who do @@ -849,7 +833,7 @@ not expect eofbit and failbit to remain set after a successful open. There are t reasonable resolutions: 1) status quo 2) fail if fail(), ignore eofbit 3) clear failbit and eofbit on call to open().

    Proposed resolution:

    -

    In 27.8.1.7 [lib.ifstream.members] paragraph 3, and in 27.8.1.10 [lib.ofstream.members] paragraph 3, under open() effects, add a footnote: +

    In 27.8.1.7 [lib.ifstream.members] paragraph 3, and in 27.8.1.10 [lib.ofstream.members] paragraph 3, under open() effects, add a footnote:

    @@ -867,24 +851,22 @@ one case. The resolution of this issue clarifies what the LWG believes to have been the original intent.


    -

    24. "do_convert" doesn't exist

    -Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    24. "do_convert" doesn't exist

    Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The description of codecvt<>::do_out and do_in mentions a symbol "do_convert" which is not defined in the standard. This is a leftover from an edit, and should be "do_in and do_out".

    Proposed resolution:

    -

    In 22.2.1.5 [lib.locale.codecvt], paragraph 3, change -"do_convert" to "do_in or do_out". Also, in 22.2.1.5.2 [lib.locale.codecvt.virtuals], change "do_convert()" to "do_in +

    In 22.2.1.5 [lib.locale.codecvt], paragraph 3, change +"do_convert" to "do_in or do_out". Also, in 22.2.1.5.2 [lib.locale.codecvt.virtuals], change "do_convert()" to "do_in or do_out".


    -

    25. String operator<< uses width() value wrong

    -Section: 21.3.7.9 [lib.string.io]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    25. String operator<< uses width() value wrong

    Section: 21.3.7.9 [lib.string.io]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the description of operator<< applied to strings, the standard says that uses the smaller of os.width() and str.size(), to pad "as described in stage 3" elsewhere; but this is inconsistent, as this allows no possibility of space for padding.

    Proposed resolution:

    -

    Change 21.3.7.9 [lib.string.io] paragraph 4 from:
    +

    Change 21.3.7.9 [lib.string.io] paragraph 4 from:

        "... where n is the smaller of os.width() and str.size(); ..."
    @@ -894,8 +876,7 @@ to:
        "... where n is the larger of os.width() and str.size(); ..."


    -

    26. Bad sentry example

    -Section: 27.6.1.1.2 [lib.istream::sentry]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    26. Bad sentry example

    Section: 27.6.1.1.2 [lib.istream::sentry]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In paragraph 6, the code in the example:

      template <class charT, class traits = char_traits<charT> >
    @@ -919,7 +900,7 @@ particular, it fails to use traits operators, and specifies incorrect
     semantics. (E.g. it specifies skipping over the first character in the
     sequence without examining it.) 

    Proposed resolution:

    -

    Remove the example above from 27.6.1.1.2 [lib.istream::sentry] +

    Remove the example above from 27.6.1.1.2 [lib.istream::sentry] paragraph 6.

    Rationale:

    The originally proposed replacement code for the example was not @@ -929,14 +910,13 @@ code ran over one page in length and was quite complicated. The LWG decided that it would be counter-productive to include such a lengthy example, which might well still contain errors.


    -

    27. String::erase(range) yields wrong iterator

    -Section: 21.3.5.5 [lib.string::erase]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    27. String::erase(range) yields wrong iterator

    Section: 21.3.5.5 [lib.string::erase]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The string::erase(iterator first, iterator last) is specified to return an element one place beyond the next element after the last one erased. E.g. for the string "abcde", erasing the range ['b'..'d') would yield an iterator for element 'e', while 'd' has not been erased.

    Proposed resolution:

    -

    In 21.3.5.5 [lib.string::erase], paragraph 10, change:

    +

    In 21.3.5.5 [lib.string::erase], paragraph 10, change:

    Returns: an iterator which points to the element immediately following _last_ prior to @@ -950,8 +930,7 @@ while 'd' has not been erased.

    other elements being erased.


    -

    28. Ctype<char>is ambiguous

    -Section: 22.2.1.3.2 [lib.facet.ctype.char.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    28. Ctype<char>is ambiguous

    Section: 22.2.1.3.2 [lib.facet.ctype.char.members]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The description of the vector form of ctype<char>::is can be interpreted to mean something very different from what was intended. Paragraph 4 says

    @@ -963,23 +942,22 @@ something very different from what was intended. Paragraph 4 says

    This is intended to copy the value indexed from table()[] into the place identified in vec[].

    Proposed resolution:

    -

    Change 22.2.1.3.2 [lib.facet.ctype.char.members], paragraph 4, to read

    +

    Change 22.2.1.3.2 [lib.facet.ctype.char.members], paragraph 4, to read

    Effects: The second form, for all *p in the range [low, high), assigns into vec[p-low] the value table()[(unsigned char)*p].


    -

    29. Ios_base::init doesn't exist

    -Section: 27.3.1 [lib.narrow.stream.objects]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    -

    Sections 27.3.1 [lib.narrow.stream.objects] and 27.3.2 [lib.wide.stream.objects] mention +

    29. Ios_base::init doesn't exist

    Section: 27.3.1 [lib.narrow.stream.objects]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    Sections 27.3.1 [lib.narrow.stream.objects] and 27.3.2 [lib.wide.stream.objects] mention a function ios_base::init, which is not defined. Probably they mean -basic_ios<>::init, defined in 27.4.4.1 [lib.basic.ios.cons], +basic_ios<>::init, defined in 27.4.4.1 [lib.basic.ios.cons], paragraph 3.

    Proposed resolution:

    [R12: modified to include paragraph 5.]

    -

    In 27.3.1 [lib.narrow.stream.objects] paragraph 2 and 5, change

    +

    In 27.3.1 [lib.narrow.stream.objects] paragraph 2 and 5, change

    ios_base::init

    @@ -991,29 +969,27 @@ paragraph 3.

    basic_ios<char>::init

    -

    Also, make a similar change in 27.3.2 [lib.wide.stream.objects] except it +

    Also, make a similar change in 27.3.2 [lib.wide.stream.objects] except it should read

    basic_ios<wchar_t>::init


    -

    30. Wrong header for LC_*

    -Section: 22.1.1.1.1 [lib.locale.category]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    30. Wrong header for LC_*

    Section: 22.1.1.1.1 [lib.locale.category]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    Paragraph 2 implies that the C macros LC_CTYPE etc. are defined in <cctype>, where they are in fact defined elsewhere to appear in <clocale>.

    Proposed resolution:

    -

    In 22.1.1.1.1 [lib.locale.category], paragraph 2, change +

    In 22.1.1.1.1 [lib.locale.category], paragraph 2, change "<cctype>" to read "<clocale>".


    -

    31. Immutable locale values

    -Section: 22.1.1 [lib.locale]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    31. Immutable locale values

    Section: 22.1.1 [lib.locale]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    Paragraph 6, says "An instance of locale is immutable; once a facet reference is obtained from it, ...". This has caused some confusion, because locale variables are manifestly assignable.

    Proposed resolution:

    -

    In 22.1.1 [lib.locale] replace paragraph 6

    +

    In 22.1.1 [lib.locale] replace paragraph 6

    An instance of locale is immutable; once a facet @@ -1030,8 +1006,7 @@ are manifestly assignable.

    long as some locale object refers to that facet.


    -

    32. Pbackfail description inconsistent

    -Section: 27.5.2.4.4 [lib.streambuf.virt.pback]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    32. Pbackfail description inconsistent

    Section: 27.5.2.4.4 [lib.streambuf.virt.pback]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The description of the required state before calling virtual member basic_streambuf<>::pbackfail requirements is inconsistent with the conditions described in 27.5.2.2.4 [lib.streambuf.pub.pback] where member sputbackc calls it. @@ -1045,7 +1020,7 @@ Specifically, the latter says it calls pbackfail if:

    It appears that the pbackfail description is wrong.

    Proposed resolution:

    -

    In 27.5.2.4.4 [lib.streambuf.virt.pback], paragraph 1, change:

    +

    In 27.5.2.4.4 [lib.streambuf.virt.pback], paragraph 1, change:

    "traits::eq(*gptr(),traits::to_char_type( c))"

    @@ -1061,8 +1036,7 @@ Specifically, the latter says it calls pbackfail if:

    Note deliberate reordering of arguments for clarity in addition to the correction of the argument value.


    -

    33. Codecvt<> mentions from_type

    -Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    33. Codecvt<> mentions from_type

    Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the table defining the results from do_out and do_in, the specification for the result error says

    @@ -1073,20 +1047,19 @@ result error says

    but from_type is not defined. This clearly is intended to be an externT for do_in, or an internT for do_out.

    Proposed resolution:

    -

    In 22.2.1.5.2 [lib.locale.codecvt.virtuals] paragraph 4, replace the definition +

    In 22.2.1.5.2 [lib.locale.codecvt.virtuals] paragraph 4, replace the definition in the table for the case of _error_ with

    encountered a character in [from,from_end) that it could not convert.


    -

    34. True/falsename() not in ctype<>

    -Section: 22.2.2.2.2 [lib.facet.num.put.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    34. True/falsename() not in ctype<>

    Section: 22.2.2.2.2 [lib.facet.num.put.virtuals]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In paragraph 19, Effects:, members truename() and falsename are used from facet ctype<charT>, but it has no such members. Note that this is also a problem in 22.2.2.1.2, addressed in (4).

    Proposed resolution:

    -

    In 22.2.2.2.2 [lib.facet.num.put.virtuals], paragraph 19, in the Effects: +

    In 22.2.2.2.2 [lib.facet.num.put.virtuals], paragraph 19, in the Effects: clause for member put(...., bool), replace the initialization of the string_type value s as follows:

    @@ -1095,13 +1068,12 @@ string_type value s as follows:

    string_type s = val ? np.truename() : np.falsename();

    -

    35. No manipulator unitbuf in synopsis

    -Section: 27.4 [lib.iostreams.base]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    -

    In 27.4.5.1 [lib.fmtflags.manip], we have a definition for a manipulator +

    35. No manipulator unitbuf in synopsis

    Section: 27.4 [lib.iostreams.base]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    In 27.4.5.1 [lib.fmtflags.manip], we have a definition for a manipulator named "unitbuf". Unlike other manipulators, it's not listed in synopsis. Similarly for "nounitbuf".

    Proposed resolution:

    -

    Add to the synopsis for <ios> in 27.4 [lib.iostreams.base], after +

    Add to the synopsis for <ios> in 27.4 [lib.iostreams.base], after the entry for "nouppercase", the prototypes:

    @@ -1109,8 +1081,7 @@ the entry for "nouppercase", the prototypes:

    ios_base& nounitbuf(ios_base& str);

    -

    36. Iword & pword storage lifetime omitted

    -Section: 27.4.2.5 [lib.ios.base.storage]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    36. Iword & pword storage lifetime omitted

    Section: 27.4.2.5 [lib.ios.base.storage]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the definitions for ios_base::iword and pword, the lifetime of the storage is specified badly, so that an implementation which only keeps the last value stored appears to conform. In particular, it says:

    @@ -1120,7 +1091,7 @@ member with a different index ...

    This is not idle speculation; at least one implementation was done this way.

    Proposed resolution:

    -

    Add in 27.4.2.5 [lib.ios.base.storage], in both paragraph 2 and also in +

    Add in 27.4.2.5 [lib.ios.base.storage], in both paragraph 2 and also in paragraph 4, replace the sentence:

    @@ -1139,8 +1110,7 @@ paragraph 4, replace the sentence:

    substituting "iword" or "pword" as appropriate.


    -

    37. Leftover "global" reference

    -Section: 22.1.1 [lib.locale]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    37. Leftover "global" reference

    Section: 22.1.1 [lib.locale]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    In the overview of locale semantics, paragraph 4, is the sentence

    @@ -1151,15 +1121,14 @@ paragraph 4, replace the sentence:

    This is not supported by the definition of use_facet<>, and represents semantics from an old draft.

    Proposed resolution:

    -

    In 22.1.1 [lib.locale], paragraph 4, delete the parenthesized +

    In 22.1.1 [lib.locale], paragraph 4, delete the parenthesized expression

    (or, failing that, in the global locale)


    -

    38. Facet definition incomplete

    -Section: 22.1.2 [lib.locale.global.templates]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    38. Facet definition incomplete

    Section: 22.1.2 [lib.locale.global.templates]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    It has been noticed by Esa Pulkkinen that the definition of "facet" is incomplete. In particular, a class derived from another facet, but which does not define a member id, cannot @@ -1178,7 +1147,7 @@ reads:

    Requires: Facet is a facet class whose definition - contains the public static member id as defined in 22.1.1.1.2 [lib.locale.facet].

    + contains the public static member id as defined in 22.1.1.1.2 [lib.locale.facet].

    [ @@ -1189,8 +1158,7 @@ contains (not inherits) the public static member ]


    -

    39. istreambuf_iterator<>::operator++(int) definition garbled

    -Section: 24.5.3.4 [lib.istreambuf.iterator::op++]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    39. istreambuf_iterator<>::operator++(int) definition garbled

    Section: 24.5.3.4 [lib.istreambuf.iterator::op++]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    Following the definition of istreambuf_iterator<>::operator++(int) in paragraph 3, the standard contains three lines of garbage text left over from a previous edit.

    @@ -1200,28 +1168,26 @@ sbuf_->sbumpc(); return(tmp);

    Proposed resolution:

    -

    In 24.5.3.4 [lib.istreambuf.iterator::op++], delete the three lines of code at the +

    In 24.5.3.4 [lib.istreambuf.iterator::op++], delete the three lines of code at the end of paragraph 3.


    -

    40. Meaningless normative paragraph in examples

    -Section: 22.2.8 [lib.facets.examples]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    40. Meaningless normative paragraph in examples

    Section: 22.2.8 [lib.facets.examples]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    Paragraph 3 of the locale examples is a description of part of an implementation technique that has lost its referent, and doesn't mean anything.

    Proposed resolution:

    -

    Delete 22.2.8 [lib.facets.examples] paragraph 3 which begins "This +

    Delete 22.2.8 [lib.facets.examples] paragraph 3 which begins "This initialization/identification system depends...", or (at the editor's option) replace it with a place-holder to keep the paragraph numbering the same.


    -

    41. Ios_base needs clear(), exceptions()

    -Section: 27.4.2 [lib.ios.base]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    -

    The description of ios_base::iword() and pword() in 27.4.2.4 [lib.ios.members.static], say that if they fail, they "set badbit, +

    41. Ios_base needs clear(), exceptions()

    Section: 27.4.2 [lib.ios.base]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    The description of ios_base::iword() and pword() in 27.4.2.4 [lib.ios.members.static], say that if they fail, they "set badbit, which may throw an exception". However, ios_base offers no interface to set or to test badbit; those interfaces are defined in basic_ios<>.

    Proposed resolution:

    -

    Change the description in 27.4.2.5 [lib.ios.base.storage] in +

    Change the description in 27.4.2.5 [lib.ios.base.storage] in paragraph 2, and also in paragraph 4, as follows. Replace

    @@ -1241,8 +1207,7 @@ paragraph 2, and also in paragraph 4, as follows. Replace

    setstate(badbit).]


    -

    42. String ctors specify wrong default allocator

    -Section: 21.3 [lib.basic.string]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    42. String ctors specify wrong default allocator

    Section: 21.3 [lib.basic.string]  Status: TC  Submitter: Nathan Myers  Date: 6 Aug 1998

    The basic_string<> copy constructor:

    basic_string(const basic_string& str, size_type pos = 0,
    @@ -1258,7 +1223,7 @@ vector) do not have this form of constructor, so it is inconsistent,
     and an evident source of confusion, for basic_string<> to have
     it, so it might better be removed. 

    Proposed resolution:

    -

    In 21.3 [lib.basic.string], replace the declaration of the copy +

    In 21.3 [lib.basic.string], replace the declaration of the copy constructor as follows:

    @@ -1267,7 +1232,7 @@ basic_string(const basic_string& str, size_type pos, size_type n = npos, const Allocator& a = Allocator());
    -

    In 21.3.1 [lib.string.cons], replace the copy constructor declaration +

    In 21.3.1 [lib.string.cons], replace the copy constructor declaration as above. Add to paragraph 5, Effects:

    @@ -1280,7 +1245,7 @@ just an unfortunate design choice.

    The LWG considered two other possible resolutions:

    -

    A. In 21.3 [lib.basic.string], replace the declaration of the copy +

    A. In 21.3 [lib.basic.string], replace the declaration of the copy constructor as follows:

    @@ -1290,7 +1255,7 @@ basic_string(const basic_string& str, size_type pos, size_type n, const Allocator& a);
    -

    In 21.3.1 [lib.string.cons], replace the copy constructor declaration +

    In 21.3.1 [lib.string.cons], replace the copy constructor declaration as above. Add to paragraph 5, Effects:

    @@ -1298,7 +1263,7 @@ as above. Add to paragraph 5, Effects:

    value str.get_allocator().

    -

    B. In 21.3 [lib.basic.string], and also in 21.3.1 [lib.string.cons], replace +

    B. In 21.3 [lib.basic.string], and also in 21.3.1 [lib.string.cons], replace the declaration of the copy constructor as follows:

    @@ -1315,11 +1280,276 @@ Kona: issue editing snafu fixed - the proposed resolution now correctly reflects the LWG consensus. ]


    -

    46. Minor Annex D errors

    -Section: D.7 [depr.str.strstreams]  Status: TC  Submitter: Brendan Kehoe  Date:  1 Jun 1998

    +

    44. Iostreams use operator== on int_type values

    Section: 27 [lib.input.output]  Status: WP  Submitter: Nathan Myers  Date: 6 Aug 1998

    +

    Many of the specifications for iostreams specify that character +values or their int_type equivalents are compared using operators == +or !=, though in other places traits::eq() or traits::eq_int_type is +specified to be used throughout. This is an inconsistency; we should +change uses of == and != to use the traits members instead.

    +

    Proposed resolution:

    + +

    [Pre-Kona: Dietmar supplied wording]

    + +

    List of changes to clause 27:

    +
      +
    1. + In lib.basic.ios.members paragraph 13 (postcondition clause for + 'fill(cT)') change + +
      + fillch == fill() +
      + + to + +
      + traits::eq(fillch, fill()) +
      + + +
    2. +
    3. + In lib.istream.unformatted paragraph 7 (effects clause for + 'get(cT,streamsize,cT)'), third bullet, change + +
      + c == delim for the next available input character c +
      + + to + +
      + traits::eq(c, delim) for the next available input character c +
      + +
    4. +
    5. + In lib.istream.unformatted paragraph 12 (effects clause for + 'get(basic_streambuf<cT,Tr>&,cT)'), third bullet, change + +
      + c == delim for the next available input character c +
      + + to + +
      + traits::eq(c, delim) for the next available input character c +
      + +
    6. +
    7. + In lib.istream.unformatted paragraph 17 (effects clause for + 'getline(cT,streamsize,cT)'), second bullet, change + +
      + c == delim for the next available input character c +
      + + to + +
      + traits::eq(c, delim) for the next available input character c +
      + +
    8. +
    9. + In lib.istream.unformatted paragraph 24 (effects clause for + 'ignore(int,int_type)'), second bullet, change + +
      + c == delim for the next available input character c +
      + + to + +
      + traits::eq_int_type(c, delim) for the next available input + character c +
      + +
    10. +
    11. + In lib.istream.unformatted paragraph 25 (notes clause for + 'ignore(int,int_type)'), second bullet, change + +
      + The last condition will never occur if delim == traits::eof() +
      + + to + +
      + The last condition will never occur if + traits::eq_int_type(delim, traits::eof()). +
      + +
    12. +
    13. + In lib.istream.sentry paragraph 6 (example implementation for the + sentry constructor) change + +
      + while ((c = is.rdbuf()->snextc()) != traits::eof()) { +
      + + to + +
      + while (!traits::eq_int_type(c = is.rdbuf()->snextc(), traits::eof())) { +
      + +
    14. +
    + +

    List of changes to Chapter 21:

    + +
      +
    1. + In lib.string::find paragraph 1 (effects clause for find()), + second bullet, change + +
      + at(xpos+I) == str.at(I) for all elements ... +
      + + to + +
      + traits::eq(at(xpos+I), str.at(I)) for all elements ... +
      + +
    2. +
    3. + In lib.string::rfind paragraph 1 (effects clause for rfind()), + second bullet, change + +
      + at(xpos+I) == str.at(I) for all elements ... +
      + + to + +
      + traits::eq(at(xpos+I), str.at(I)) for all elements ... +
      + +
    4. +
    5. + In lib.string::find.first.of paragraph 1 (effects clause for + find_first_of()), second bullet, change + +
      + at(xpos+I) == str.at(I) for all elements ... +
      + + to + +
      + traits::eq(at(xpos+I), str.at(I)) for all elements ... +
      + +
    6. +
    7. + In lib.string::find.last.of paragraph 1 (effects clause for + find_last_of()), second bullet, change + +
      + at(xpos+I) == str.at(I) for all elements ... +
      + + to + +
      + traits::eq(at(xpos+I), str.at(I)) for all elements ... +
      + +
    8. +
    9. + In lib.string::find.first.not.of paragraph 1 (effects clause for + find_first_not_of()), second bullet, change + +
      + at(xpos+I) == str.at(I) for all elements ... +
      + + to + +
      + traits::eq(at(xpos+I), str.at(I)) for all elements ... +
      +
    10. + +
    11. + In lib.string::find.last.not.of paragraph 1 (effects clause for + find_last_not_of()), second bullet, change + +
      + at(xpos+I) == str.at(I) for all elements ... +
      + + to + +
      + traits::eq(at(xpos+I), str.at(I)) for all elements ... +
      +
    12. + +
    13. + In lib.string.ios paragraph 5 (effects clause for getline()), + second bullet, change + +
      + c == delim for the next available input character c +
      + + to + +
      + traits::eq(c, delim) for the next available input character c +
      +
    14. + +
    + +

    Notes:

    +
      +
    • + Fixing this issue highlights another sloppyness in + lib.istream.unformatted paragraph 24: this clause mentions a "character" + which is then compared to an 'int_type' (see item 5. in the list + below). It is not clear whether this requires explicit words and + if so what these words are supposed to be. A similar issue exists, + BTW, for operator*() of istreambuf_iterator which returns the result + of sgetc() as a character type (see lib.istreambuf.iterator::op* + paragraph 1), and for operator++() of istreambuf_iterator which + passes the result of sbumpc() to a constructor taking a char_type + (see lib.istreambuf.iterator::operator++ paragraph 3). Similarily, the + assignment operator ostreambuf_iterator passes a char_type to a function + taking an int_type (see lib.ostreambuf.iter.ops paragraph 1). +
    • +
    • + It is inconsistent to use comparisons using the traits functions in + Chapter 27 while not using them in Chapter 21, especially as some + of the inconsistent uses actually involve streams (eg. getline() on + streams). To avoid leaving this issue open still longer due to this + inconsistency (it is open since 1998), a list of changes to Chapter + 21 is below. +
    • +
    • + In Chapter 24 there are several places with statements like "the end + of stream is reached (streambuf_type::sgetc() returns traits::eof())" + (lib.istreambuf.iterator paragraph 1, lib.ostreambuf.iter.ops + paragraph 5). It is unclear whether these should be clarified to use + traits::eq_int_type() for detecting traits::eof(). +
    • +
    + +
    +

    46. Minor Annex D errors

    Section: D.7 [depr.str.strstreams]  Status: TC  Submitter: Brendan Kehoe  Date:  1 Jun 1998

    See lib-6522 and edit-814.

    Proposed resolution:

    -

    Change D.7.1 [depr.strstreambuf] (since streambuf is a typedef of +

    Change D.7.1 [depr.strstreambuf] (since streambuf is a typedef of basic_streambuf<char>) from:

             virtual streambuf<char>* setbuf(char* s, streamsize n);
    @@ -1328,7 +1558,7 @@ basic_streambuf<char>) from:

             virtual streambuf* setbuf(char* s, streamsize n);
    -

    In D.7.4 [depr.strstream] insert the semicolon now missing after +

    In D.7.4 [depr.strstream] insert the semicolon now missing after int_type:

         namespace std {
    @@ -1340,30 +1570,27 @@ int_type:

    typedef typename char_traits<char>::int_type int_type typedef typename char_traits<char>::pos_type pos_type;

    -

    47. Imbue() and getloc() Returns clauses swapped

    -Section: 27.4.2.3 [lib.ios.base.locales]  Status: TC  Submitter: Matt Austern  Date: 21 Jun 1998

    +

    47. Imbue() and getloc() Returns clauses swapped

    Section: 27.4.2.3 [lib.ios.base.locales]  Status: TC  Submitter: Matt Austern  Date: 21 Jun 1998

    Section 27.4.2.3 specifies how imbue() and getloc() work. That section has two RETURNS clauses, and they make no sense as stated. They make perfect sense, though, if you swap them. Am I correct in thinking that paragraphs 2 and 4 just got mixed up by accident?

    Proposed resolution:

    -

    In 27.4.2.3 [lib.ios.base.locales] swap paragraphs 2 and 4.

    +

    In 27.4.2.3 [lib.ios.base.locales] swap paragraphs 2 and 4.


    -

    48. Use of non-existent exception constructor

    -Section: 27.4.2.1.1 [lib.ios::failure]  Status: TC  Submitter: Matt Austern  Date: 21 Jun 1998

    +

    48. Use of non-existent exception constructor

    Section: 27.4.2.1.1 [lib.ios::failure]  Status: TC  Submitter: Matt Austern  Date: 21 Jun 1998

    27.4.2.1.1, paragraph 2, says that class failure initializes the base class, exception, with exception(msg). Class exception (see 18.6.1) has no such constructor.

    Proposed resolution:

    -

    Replace 27.4.2.1.1 [lib.ios::failure], paragraph 2, with

    +

    Replace 27.4.2.1.1 [lib.ios::failure], paragraph 2, with

    EFFECTS: Constructs an object of class failure.


    -

    49. Underspecification of ios_base::sync_with_stdio

    -Section: 27.4.2.4 [lib.ios.members.static]  Status: WP  Submitter: Matt Austern  Date: 21 Jun 1998

    +

    49. Underspecification of ios_base::sync_with_stdio

    Section: 27.4.2.4 [lib.ios.members.static]  Status: WP  Submitter: Matt Austern  Date: 21 Jun 1998

    Two problems

    (1) 27.4.2.4 doesn't say what ios_base::sync_with_stdio(f) @@ -1376,53 +1603,57 @@ synchronized with stdio. Again, of course, I can make some guesses. (And I'm unhappy about the performance implications of those guesses, but that's another matter.)

    Proposed resolution:

    -

    Change the following sentence in 27.4.2.4 [lib.ios.members.static] +

    Change the following sentence in 27.4.2.4 [lib.ios.members.static] returns clause from:

    -

    -true if the standard iostream objects (27.3) are +

    true if the standard iostream objects (27.3) are synchronized and otherwise returns false.

    to:

    -

    -true if the previous state of the standard iostream +

    true if the previous state of the standard iostream objects (27.3) was synchronized and otherwise returns false.

    -

    Add the following immediately after 27.4.2.4 [lib.ios.members.static], +

    Add the following immediately after 27.4.2.4 [lib.ios.members.static], paragraph 2:

    When a standard iostream object str is synchronized with a standard stdio stream f, the effect of inserting a character c by

    -
      fputc(f, c);
    +
    +  fputc(f, c);
     

    is the same as the effect of

    -
      str.rdbuf()->sputc(c);
    +
    +  str.rdbuf()->sputc(c);
     

    for any sequence of characters; the effect of extracting a character c by

    -
      c = fgetc(f);
    +
    +  c = fgetc(f);
     

    is the same as the effect of:

    -
      c = str.rdbuf()->sbumpc(c);
    +
    +  c = str.rdbuf()->sbumpc(c);
     

    for any sequences of characters; and the effect of pushing back a character c by

    -
      ungetc(c, f);
    +
    +  ungetc(c, f);
     

    is the same as the effect of

    -
      str.rdbuf()->sputbackc(c);
    +
    +  str.rdbuf()->sputbackc(c);
     

    for any sequence of characters. [Footnote: This implies @@ -1439,8 +1670,7 @@ of "synchronization"]

    text was added in the non-normative footnote to say that operations on the two streams can be mixed arbitrarily.]


    -

    50. Copy constructor and assignment operator of ios_base

    -Section: 27.4.2 [lib.ios.base]  Status: TC  Submitter: Matt Austern  Date: 21 Jun 1998

    +

    50. Copy constructor and assignment operator of ios_base

    Section: 27.4.2 [lib.ios.base]  Status: TC  Submitter: Matt Austern  Date: 21 Jun 1998

    As written, ios_base has a copy constructor and an assignment operator. (Nothing in the standard says it doesn't have one, and all classes have copy constructors and assignment operators unless you @@ -1460,14 +1690,13 @@ that intention would have required a explicit description of the semantics (e.g. what happens to the iarray and parray stuff).

    Proposed resolution:

    -

    In 27.4.2 [lib.ios.base], class ios_base, specify the copy +

    In 27.4.2 [lib.ios.base], class ios_base, specify the copy constructor and operator= members as being private.

    Rationale:

    The LWG believes the difficulty of specifying correct semantics outweighs any benefit of allowing ios_base objects to be copyable.


    -

    51. Requirement to not invalidate iterators missing

    -Section: 23.1 [lib.container.requirements]  Status: TC  Submitter: David Vandevoorde  Date: 23 Jun 1998

    +

    51. Requirement to not invalidate iterators missing

    Section: 23.1 [lib.container.requirements]  Status: TC  Submitter: David Vandevoorde  Date: 23 Jun 1998

    The std::sort algorithm can in general only sort a given sequence by moving around values. The list<>::sort() member on the other hand could move around values or just update internal pointers. Either @@ -1513,16 +1742,15 @@ proposed resolution below is somewhat updated from CD2-23-011, particularly the addition of the phrase "or change the values of"


    -

    52. Small I/O problems

    -Section: 27.4.3.2 [lib.fpos.operations]  Status: TC  Submitter: Matt Austern  Date: 23 Jun 1998

    -

    First, 27.4.4.1 [lib.basic.ios.cons], table 89. This is pretty obvious: +

    52. Small I/O problems

    Section: 27.4.3.2 [lib.fpos.operations]  Status: TC  Submitter: Matt Austern  Date: 23 Jun 1998

    +

    First, 27.4.4.1 [lib.basic.ios.cons], table 89. This is pretty obvious: it should be titled "basic_ios<>() effects", not "ios_base() effects".

    -

    [The second item is a duplicate; see issue 6 for +

    [The second item is a duplicate; see issue 6 for resolution.]

    -

    Second, 27.4.3.2 [lib.fpos.operations] table 88 . There are a couple +

    Second, 27.4.3.2 [lib.fpos.operations] table 88 . There are a couple different things wrong with it, some of which I've already discussed with Jerry, but the most obvious mechanical sort of error is that it uses expressions like P(i) and p(i), without ever defining what sort @@ -1537,48 +1765,43 @@ streampos arithmetic, but that it wasn't actually supposed to do anything meaningful except on platforms, like Unix, where genuine arithmetic is possible.)

    Proposed resolution:

    -

    Change 27.4.4.1 [lib.basic.ios.cons] table 89 title from +

    Change 27.4.4.1 [lib.basic.ios.cons] table 89 title from "ios_base() effects" to "basic_ios<>() effects".


    -

    53. Basic_ios destructor unspecified

    -Section: 27.4.4.1 [lib.basic.ios.cons]  Status: TC  Submitter: Matt Austern  Date: 23 Jun 1998

    +

    53. Basic_ios destructor unspecified

    Section: 27.4.4.1 [lib.basic.ios.cons]  Status: TC  Submitter: Matt Austern  Date: 23 Jun 1998

    There's nothing in 27.4.4 saying what basic_ios's destructor does. The important question is whether basic_ios::~basic_ios() destroys rdbuf().

    Proposed resolution:

    -

    Add after 27.4.4.1 [lib.basic.ios.cons] paragraph 2:

    +

    Add after 27.4.4.1 [lib.basic.ios.cons] paragraph 2:

    virtual ~basic_ios();

    -

    -Notes: The destructor does not destroy rdbuf().

    +

    Notes: The destructor does not destroy rdbuf().

    Rationale:

    The LWG reviewed the additional question of whether or not rdbuf(0) may set badbit. The answer is -clearly yes; it may be set via clear(). See 27.4.4.2 [lib.basic.ios.members], paragraph 6. This issue was reviewed at length +clearly yes; it may be set via clear(). See 27.4.4.2 [lib.basic.ios.members], paragraph 6. This issue was reviewed at length by the LWG, which removed from the original proposed resolution a footnote which incorrectly said "rdbuf(0) does not set badbit".


    -

    54. Basic_streambuf's destructor

    -Section: 27.5.2.1 [lib.streambuf.cons]  Status: TC  Submitter: Matt Austern  Date: 25 Jun 1998

    +

    54. Basic_streambuf's destructor

    Section: 27.5.2.1 [lib.streambuf.cons]  Status: TC  Submitter: Matt Austern  Date: 25 Jun 1998

    The class synopsis for basic_streambuf shows a (virtual) destructor, but the standard doesn't say what that destructor does. My assumption is that it does nothing, but the standard should say so explicitly.

    Proposed resolution:

    -

    Add after 27.5.2.1 [lib.streambuf.cons] paragraph 2:

    +

    Add after 27.5.2.1 [lib.streambuf.cons] paragraph 2:

    virtual  ~basic_streambuf();

    -

    -Effects: None.

    +

    Effects: None.


    -

    55. Invalid stream position is undefined

    -Section: 27 [lib.input.output]  Status: TC  Submitter: Matt Austern  Date: 26 Jun 1998

    +

    55. Invalid stream position is undefined

    Section: 27 [lib.input.output]  Status: TC  Submitter: Matt Austern  Date: 26 Jun 1998

    Several member functions in clause 27 are defined in certain circumstances to return an "invalid stream position", a term that is defined nowhere in the standard. Two places (27.5.2.4.2, @@ -1599,54 +1822,52 @@ should not be changed. Here are the three places where "invalid stream position" should not be changed:

    -

    27.7.1.3 [lib.stringbuf.virtuals], paragraph 14
    - 27.8.1.4 [lib.filebuf.virtuals], paragraph 14
    - D.7.1.3 [depr.strstreambuf.virtuals], paragraph 17 +

    27.7.1.3 [lib.stringbuf.virtuals], paragraph 14
    + 27.8.1.4 [lib.filebuf.virtuals], paragraph 14
    + D.7.1.3 [depr.strstreambuf.virtuals], paragraph 17

    Proposed resolution:

    -

    In 27.5.2.4.2 [lib.streambuf.virt.buffer], paragraph 4, change "Returns an +

    In 27.5.2.4.2 [lib.streambuf.virt.buffer], paragraph 4, change "Returns an object of class pos_type that stores an invalid stream position (_lib.iostreams.definitions_)" to "Returns pos_type(off_type(-1))".

    -

    In 27.5.2.4.2 [lib.streambuf.virt.buffer], paragraph 6, change "Returns +

    In 27.5.2.4.2 [lib.streambuf.virt.buffer], paragraph 6, change "Returns an object of class pos_type that stores an invalid stream position" to "Returns pos_type(off_type(-1))".

    -

    In 27.7.1.3 [lib.stringbuf.virtuals], paragraph 13, change "the object +

    In 27.7.1.3 [lib.stringbuf.virtuals], paragraph 13, change "the object stores an invalid stream position" to "the return value is pos_type(off_type(-1))".

    -

    In 27.8.1.4 [lib.filebuf.virtuals], paragraph 13, change "returns an +

    In 27.8.1.4 [lib.filebuf.virtuals], paragraph 13, change "returns an invalid stream position (27.4.3)" to "returns pos_type(off_type(-1))"

    -

    In 27.8.1.4 [lib.filebuf.virtuals], paragraph 15, change "Otherwise +

    In 27.8.1.4 [lib.filebuf.virtuals], paragraph 15, change "Otherwise returns an invalid stream position (_lib.iostreams.definitions_)" to "Otherwise returns pos_type(off_type(-1))"

    -

    In D.7.1.3 [depr.strstreambuf.virtuals], paragraph 15, change "the object +

    In D.7.1.3 [depr.strstreambuf.virtuals], paragraph 15, change "the object stores an invalid stream position" to "the return value is pos_type(off_type(-1))"

    -

    In D.7.1.3 [depr.strstreambuf.virtuals], paragraph 18, change "the object +

    In D.7.1.3 [depr.strstreambuf.virtuals], paragraph 18, change "the object stores an invalid stream position" to "the return value is pos_type(off_type(-1))"


    -

    56. Showmanyc's return type

    -Section: 27.5.2 [lib.streambuf]  Status: TC  Submitter: Matt Austern  Date: 29 Jun 1998

    +

    56. Showmanyc's return type

    Section: 27.5.2 [lib.streambuf]  Status: TC  Submitter: Matt Austern  Date: 29 Jun 1998

    The class summary for basic_streambuf<>, in 27.5.2, says that showmanyc has return type int. However, 27.5.2.4.3 says that its return type is streamsize.

    Proposed resolution:

    Change showmanyc's return type in the -27.5.2 [lib.streambuf] class summary to streamsize.

    +27.5.2 [lib.streambuf] class summary to streamsize.


    -

    57. Mistake in char_traits

    -Section: 21.1.3.2 [lib.char.traits.specializations.wchar.t]  Status: TC  Submitter: Matt Austern  Date: 1 Jul 1998

    +

    57. Mistake in char_traits

    Section: 21.1.3.2 [lib.char.traits.specializations.wchar.t]  Status: TC  Submitter: Matt Austern  Date: 1 Jul 1998

    21.1.3.2, paragraph 3, says "The types streampos and wstreampos may be different if the implementation supports no shift encoding in narrow-oriented iostreams but supports one or more shift @@ -1660,12 +1881,11 @@ to clause 21, we see in 21.1.3.1 and 21.1.3.2 that char_traits<char>::state_type and char_traits<wchar_t>::state_type must both be mbstate_t.

    Proposed resolution:

    -

    Remove the sentence in 21.1.3.2 [lib.char.traits.specializations.wchar.t] paragraph 3 which +

    Remove the sentence in 21.1.3.2 [lib.char.traits.specializations.wchar.t] paragraph 3 which begins "The types streampos and wstreampos may be different..." .


    -

    59. Ambiguity in specification of gbump

    -Section: 27.5.2.3.1 [lib.streambuf.get.area]  Status: TC  Submitter: Matt Austern  Date: 28 Jul 1998

    +

    59. Ambiguity in specification of gbump

    Section: 27.5.2.3.1 [lib.streambuf.get.area]  Status: TC  Submitter: Matt Austern  Date: 28 Jul 1998

    27.5.2.3.1 says that basic_streambuf::gbump() "Advances the next pointer for the input sequence by n."

    @@ -1678,7 +1898,7 @@ pbump.

    (The "classic" AT&T implementation used the former interpretation.)

    Proposed resolution:

    -

    Change 27.5.2.3.1 [lib.streambuf.get.area] paragraph 4 gbump effects from:

    +

    Change 27.5.2.3.1 [lib.streambuf.get.area] paragraph 4 gbump effects from:

    Effects: Advances the next pointer for the input sequence by n.

    @@ -1690,11 +1910,10 @@ former interpretation.)

    Effects: Adds n to the next pointer for the input sequence.

    -

    Make the same change to 27.5.2.3.2 [lib.streambuf.put.area] paragraph 4 pbump +

    Make the same change to 27.5.2.3.2 [lib.streambuf.put.area] paragraph 4 pbump effects.


    -

    60. What is a formatted input function?

    -Section: 27.6.1.2.1 [lib.istream.formatted.reqmts]  Status: TC  Submitter: Matt Austern  Date: 3 Aug 1998

    +

    60. What is a formatted input function?

    Section: 27.6.1.2.1 [lib.istream.formatted.reqmts]  Status: TC  Submitter: Matt Austern  Date: 3 Aug 1998

    Paragraph 1 of 27.6.1.2.1 contains general requirements for all formatted input functions. Some of the functions defined in section 27.6.1.2 explicitly say that those requirements apply ("Behaves @@ -1725,17 +1944,17 @@ that the "Common requirements" listed in section 27.6.1.2.1 (for basic_istream) and section 27.6.2.5.1 (for basic_ostream) do not apply to them.

    -

    Additional comments from Dietmar Kühl: It appears to be somewhat -nonsensical to consider the functions defined in 27.6.1.2.3 [lib.istream::extractors] paragraphs 1 to 5 to be "Formatted input +

    Additional comments from Dietmar Kühl: It appears to be somewhat +nonsensical to consider the functions defined in 27.6.1.2.3 [lib.istream::extractors] paragraphs 1 to 5 to be "Formatted input function" but since these functions are defined in a section labeled "Formatted input functions" it is unclear to me whether these operators are considered formatted input functions which -have to conform to the "common requirements" from 27.6.1.2.1 [lib.istream.formatted.reqmts]: If this is the case, all manipulators, not +have to conform to the "common requirements" from 27.6.1.2.1 [lib.istream.formatted.reqmts]: If this is the case, all manipulators, not just ws, would skip whitespace unless noskipws is set (... but setting noskipws using the manipulator syntax would also skip whitespace :-)

    It is not clear which functions are to be considered unformatted input functions. As written, it seems -that all functions in 27.6.1.3 [lib.istream.unformatted] are unformatted input +that all functions in 27.6.1.3 [lib.istream.unformatted] are unformatted input functions. However, it does not really make much sense to construct a sentry object for gcount(), sync(), ... Also it is unclear what happens to the gcount() if @@ -1990,8 +2209,7 @@ unformatted output function (as described in 27.6.2.6, paragraph 1)." by Judy Ward and Matt Austern. This proposed resolution is section VI of that paper.


    -

    61. Ambiguity in iostreams exception policy

    -Section: 27.6.1.3 [lib.istream.unformatted]  Status: TC  Submitter: Matt Austern  Date: 6 Aug 1998

    +

    61. Ambiguity in iostreams exception policy

    Section: 27.6.1.3 [lib.istream.unformatted]  Status: TC  Submitter: Matt Austern  Date: 6 Aug 1998

    The introduction to the section on unformatted input (27.6.1.3) says that every unformatted input function catches all exceptions that were thrown during input, sets badbit, and then conditionally rethrows @@ -2026,8 +2244,7 @@ parenthetical comment: "(Exceptions thrown from

    The LWG looked to two alternative wordings, and choose the proposed resolution as better standardese.


    -

    62. Sync's return value

    -Section: 27.6.1.3 [lib.istream.unformatted]  Status: TC  Submitter: Matt Austern  Date: 6 Aug 1998

    +

    62. Sync's return value

    Section: 27.6.1.3 [lib.istream.unformatted]  Status: TC  Submitter: Matt Austern  Date: 6 Aug 1998

    The Effects clause for sync() (27.6.1.3, paragraph 36) says that it "calls rdbuf()->pubsync() and, if that function returns -1 ... returns traits::eof()."

    @@ -2035,12 +2252,11 @@ resolution as better standardese.

    That looks suspicious, because traits::eof() is of type traits::int_type while the return type of sync() is int.

    Proposed resolution:

    -

    In 27.6.1.3 [lib.istream.unformatted], paragraph 36, change "returns +

    In 27.6.1.3 [lib.istream.unformatted], paragraph 36, change "returns traits::eof()" to "returns -1".


    -

    63. Exception-handling policy for unformatted output

    -Section: 27.6.2.6 [lib.ostream.unformatted]  Status: TC  Submitter: Matt Austern  Date: 11 Aug 1998

    +

    63. Exception-handling policy for unformatted output

    Section: 27.6.2.6 [lib.ostream.unformatted]  Status: TC  Submitter: Matt Austern  Date: 11 Aug 1998

    Clause 27 details an exception-handling policy for formatted input, unformatted input, and formatted output. It says nothing for unformatted output (27.6.2.6). 27.6.2.6 should either include the same @@ -2070,13 +2286,12 @@ input, unformatted input, and formatted output.


    64. Exception handling in basic_istream::operator>>(basic_streambuf*) -

    -Section: 27.6.1.2.3 [lib.istream::extractors]  Status: TC  Submitter: Matt Austern  Date: 11 Aug 1998

    +

    Section: 27.6.1.2.3 [lib.istream::extractors]  Status: TC  Submitter: Matt Austern  Date: 11 Aug 1998

    27.6.1.2.3, paragraph 13, is ambiguous. It can be interpreted two different ways, depending on whether the second sentence is read as an elaboration of the first.

    Proposed resolution:

    -

    Replace 27.6.1.2.3 [lib.istream::extractors], paragraph 13, which begins +

    Replace 27.6.1.2.3 [lib.istream::extractors], paragraph 13, which begins "If the function inserts no characters ..." with:

    @@ -2088,27 +2303,24 @@ elaboration of the first.

    (27.4.4.3), then the caught exception is rethrown.


    -

    66. Strstreambuf::setbuf

    -Section: D.7.1.3 [depr.strstreambuf.virtuals]  Status: TC  Submitter: Matt Austern  Date: 18 Aug 1998

    +

    66. Strstreambuf::setbuf

    Section: D.7.1.3 [depr.strstreambuf.virtuals]  Status: TC  Submitter: Matt Austern  Date: 18 Aug 1998

    D.7.1.3, paragraph 19, says that strstreambuf::setbuf "Performs an operation that is defined separately for each class derived from strstreambuf". This is obviously an incorrect cut-and-paste from basic_streambuf. There are no classes derived from strstreambuf.

    Proposed resolution:

    -

    D.7.1.3 [depr.strstreambuf.virtuals], paragraph 19, replace the setbuf effects +

    D.7.1.3 [depr.strstreambuf.virtuals], paragraph 19, replace the setbuf effects clause which currently says "Performs an operation that is defined separately for each class derived from strstreambuf" with:

    -

    -Effects: implementation defined, except that +

    Effects: implementation defined, except that setbuf(0,0) has no effect.


    -

    68. Extractors for char* should store null at end

    -Section: 27.6.1.2.3 [lib.istream::extractors]  Status: TC  Submitter: Angelika Langer  Date: 14 Jul 1998

    +

    68. Extractors for char* should store null at end

    Section: 27.6.1.2.3 [lib.istream::extractors]  Status: TC  Submitter: Angelika Langer  Date: 14 Jul 1998

    Extractors for char* (27.6.1.2.3) do not store a null character after the extracted character sequence whereas the unformatted functions like get() do. Why is this?

    @@ -2118,7 +2330,7 @@ glitch. You'll notice that the last item of the list of what stops extraction doesn't make any sense. It was supposed to be the line that said a null is stored.

    Proposed resolution:

    -

    27.6.1.2.3 [lib.istream::extractors], paragraph 7, change the last list +

    27.6.1.2.3 [lib.istream::extractors], paragraph 7, change the last list item from:

    @@ -2134,8 +2346,7 @@ item from:

    extracted.

    -

    69. Must elements of a vector be contiguous?

    -Section: 23.2.4 [lib.vector]  Status: TC  Submitter: Andrew Koenig  Date: 29 Jul 1998

    +

    69. Must elements of a vector be contiguous?

    Section: 23.2.4 [lib.vector]  Status: TC  Submitter: Andrew Koenig  Date: 29 Jul 1998

    The issue is this: Must the elements of a vector be in contiguous memory?

    (Please note that this is entirely separate from the question of @@ -2143,7 +2354,7 @@ whether a vector iterator is required to be a pointer; the answer to that question is clearly "no," as it would rule out debugging implementations)

    Proposed resolution:

    -

    Add the following text to the end of 23.2.4 [lib.vector], +

    Add the following text to the end of 23.2.4 [lib.vector], paragraph 1.

    @@ -2160,16 +2371,15 @@ directly defined in the standard. Discussion included:


    -

    70. Uncaught_exception() missing throw() specification

    -Section: 18.6 [lib.support.exception], 18.6.4 [lib.uncaught]  Status: TC  Submitter: Steve Clamage  Date: Unknown

    +

    70. Uncaught_exception() missing throw() specification

    Section: 18.6 [lib.support.exception], 18.6.4 [lib.uncaught]  Status: TC  Submitter: Steve Clamage  Date: Unknown

    In article 3E04@pratique.fr, Valentin Bonnard writes:

    uncaught_exception() doesn't have a throw specification.

    @@ -2180,31 +2390,29 @@ handle exceptions thrown from uncaught_exception() ?

    uncaught_exception() is called in exception handling contexts where exception safety is very important.

    Proposed resolution:

    -

    In 15.5.3 [except.uncaught], paragraph 1, 18.6 [lib.support.exception], and 18.6.4 [lib.uncaught], add "throw()" to uncaught_exception().

    +

    In 15.5.3 [except.uncaught], paragraph 1, 18.6 [lib.support.exception], and 18.6.4 [lib.uncaught], add "throw()" to uncaught_exception().


    -

    71. Do_get_monthname synopsis missing argument

    -Section: 22.2.5.1 [lib.locale.time.get]  Status: TC  Submitter: Nathan Myers  Date: 13 Aug 1998

    +

    71. Do_get_monthname synopsis missing argument

    Section: 22.2.5.1 [lib.locale.time.get]  Status: TC  Submitter: Nathan Myers  Date: 13 Aug 1998

    The locale facet member time_get<>::do_get_monthname -is described in 22.2.5.1.2 [lib.locale.time.get.virtuals] with five arguments, +is described in 22.2.5.1.2 [lib.locale.time.get.virtuals] with five arguments, consistent with do_get_weekday and with its specified use by member get_monthname. However, in the synopsis, it is specified instead with four arguments. The missing argument is the "end" iterator value.

    Proposed resolution:

    -

    In 22.2.5.1 [lib.locale.time.get], add an "end" argument to +

    In 22.2.5.1 [lib.locale.time.get], add an "end" argument to the declaration of member do_monthname as follows:

      virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&,
                                          ios_base::iostate& err, tm* t) const;

    74. Garbled text for codecvt::do_max_length -

    -Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Matt Austern  Date: 8 Sep 1998

    +

    Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: TC  Submitter: Matt Austern  Date: 8 Sep 1998

    The text of codecvt::do_max_length's "Returns" clause (22.2.1.5.2, paragraph 11) is garbled. It has unbalanced parentheses and a spurious n.

    Proposed resolution:

    -

    Replace 22.2.1.5.2 [lib.locale.codecvt.virtuals] paragraph 11 with the +

    Replace 22.2.1.5.2 [lib.locale.codecvt.virtuals] paragraph 11 with the following:

    @@ -2215,8 +2423,7 @@ following:

    mbstate_t>::do_max_length() returns 1.

    -

    75. Contradiction in codecvt::length's argument types

    -Section: 22.2.1.5 [lib.locale.codecvt]  Status: TC  Submitter:  Matt +

    75. Contradiction in codecvt::length's argument types

    Section: 22.2.1.5 [lib.locale.codecvt]  Status: TC  Submitter:  Matt Austern  Date:  18 Sep 1998

    The class synopses for classes codecvt<> (22.2.1.5) and codecvt_byname<> (22.2.1.6) say that the first @@ -2230,7 +2437,7 @@ synopsis or the summary must be changed.

    then we must also add text saying how do_length changes its stateT argument.

    Proposed resolution:

    -

    In 22.2.1.5 [lib.locale.codecvt], and also in 22.2.1.6 [lib.locale.codecvt.byname], +

    In 22.2.1.5 [lib.locale.codecvt], and also in 22.2.1.6 [lib.locale.codecvt.byname], change the stateT argument type on both member length() and member do_length() from

    @@ -2244,7 +2451,7 @@ change the stateT argument type on both member

    stateT&

    -

    In 22.2.1.5.2 [lib.locale.codecvt.virtuals], add to the definition for member +

    In 22.2.1.5.2 [lib.locale.codecvt.virtuals], add to the definition for member do_length a paragraph:

    @@ -2254,8 +2461,7 @@ change the stateT argument type on both member max elements.


    -

    76. Can a codecvt facet always convert one internal character at a time?

    -Section: 22.2.1.5 [lib.locale.codecvt]  Status: WP  Submitter: Matt Austern  Date: 25 Sep 1998

    +

    76. Can a codecvt facet always convert one internal character at a time?

    Section: 22.2.1.5 [lib.locale.codecvt]  Status: WP  Submitter: Matt Austern  Date: 25 Sep 1998

    This issue concerns the requirements on classes derived from codecvt, including user-defined classes. What are the restrictions on the conversion from external characters @@ -2290,8 +2496,8 @@ sequence of M external characters that maps to a sequence of subsequence that maps to N-1 internal characters.)

    Some of the wording in the standard, such as the description of -codecvt::do_max_length (22.2.1.5.2 [lib.locale.codecvt.virtuals], -paragraph 11) and basic_filebuf::underflow (27.8.1.4 [lib.filebuf.virtuals], paragraph 3) suggests that it must always be +codecvt::do_max_length (22.2.1.5.2 [lib.locale.codecvt.virtuals], +paragraph 11) and basic_filebuf::underflow (27.8.1.4 [lib.filebuf.virtuals], paragraph 3) suggests that it must always be possible to pick off internal characters one at a time from a sequence of external characters. However, this is never explicitly stated one way or the other.

    @@ -2304,21 +2510,25 @@ be aware of the assumptions that the library makes. This issue affects positioning operations on basic_filebuf, unbuffered input, and several of codecvt's member functions.

    Proposed resolution:

    -

    Add the following text as a new paragraph, following 22.2.1.5.2 [lib.locale.codecvt.virtuals] paragraph 2:

    +

    Add the following text as a new paragraph, following 22.2.1.5.2 [lib.locale.codecvt.virtuals] paragraph 2:

    A codecvt facet that is used by basic_filebuf -(27.8 [lib.file.streams]) must have the property that if

    -
        do_out(state, from, from_end, from_next, to, to_lim, to_next)
    +(27.8  [lib.file.streams]) must have the property that if

    +
    +    do_out(state, from, from_end, from_next, to, to_lim, to_next)
     
    would return ok, where from != from_end, then -
        do_out(state, from, from + 1, from_next, to, to_end, to_next)
    +
    +    do_out(state, from, from + 1, from_next, to, to_end, to_next)
     
    must also return ok, and that if -
        do_in(state, from, from_end, from_next, to, to_lim, to_next)
    +
    +    do_in(state, from, from_end, from_next, to, to_lim, to_next)
     
    would return ok, where to != to_lim, then -
        do_in(state, from, from_end, from_next, to, to + 1, to_next)
    +
    +    do_in(state, from, from_end, from_next, to, to + 1, to_next)
     

    must also return ok. [Footnote: Informally, this means that basic_filebuf assumes that the mapping from @@ -2363,38 +2573,34 @@ return value.]

    does not expect basic_filebuf to be able to use it.


    -

    78. Typo: event_call_back

    -Section: 27.4.2 [lib.ios.base]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    78. Typo: event_call_back

    Section: 27.4.2 [lib.ios.base]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    typo: event_call_back should be event_callback  

    Proposed resolution:

    -

    In the 27.4.2 [lib.ios.base] synopsis change +

    In the 27.4.2 [lib.ios.base] synopsis change "event_call_back" to "event_callback".


    -

    79. Inconsistent declaration of polar()

    -Section: 26.2.1 [lib.complex.synopsis], 26.2.7 [lib.complex.value.ops]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    -

    In 26.2.1 [lib.complex.synopsis] polar is declared as follows:

    +

    79. Inconsistent declaration of polar()

    Section: 26.2.1 [lib.complex.synopsis], 26.2.7 [lib.complex.value.ops]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    In 26.2.1 [lib.complex.synopsis] polar is declared as follows:

       template<class T> complex<T> polar(const T&, const T&); 
    -

    In 26.2.7 [lib.complex.value.ops] it is declared as follows:

    +

    In 26.2.7 [lib.complex.value.ops] it is declared as follows:

       template<class T> complex<T> polar(const T& rho, const T& theta = 0); 

    Thus whether the second parameter is optional is not clear.

    Proposed resolution:

    -

    In 26.2.1 [lib.complex.synopsis] change:

    +

    In 26.2.1 [lib.complex.synopsis] change:

       template<class T> complex<T> polar(const T&, const T&);

    to:

       template<class T> complex<T> polar(const T& rho, const T& theta = 0); 

    -

    80. Global Operators of complex declared twice

    -Section: 26.2.1 [lib.complex.synopsis], 26.2.2 [lib.complex]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    80. Global Operators of complex declared twice

    Section: 26.2.1 [lib.complex.synopsis], 26.2.2 [lib.complex]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    Both 26.2.1 and 26.2.2 contain declarations of global operators for class complex. This redundancy should be removed.

    Proposed resolution:

    Reduce redundancy according to the general style of the standard.


    -

    83. String::npos vs. string::max_size()

    -Section: 21.3 [lib.basic.string]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    83. String::npos vs. string::max_size()

    Section: 21.3 [lib.basic.string]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    Many string member functions throw if size is getting or exceeding npos. However, I wonder why they don't throw if size is getting or exceeding max_size() instead of npos. May be npos is known at compile @@ -2402,7 +2608,7 @@ time, while max_size() is known at runtime. However, what happens if size exceeds max_size() but not npos, then? It seems the standard lacks some clarifications here.

    Proposed resolution:

    -

    After 21.3 [lib.basic.string] paragraph 4 ("The functions +

    After 21.3 [lib.basic.string] paragraph 4 ("The functions described in this clause...") add a new paragraph:

    @@ -2413,8 +2619,7 @@ described in this clause...") add a new paragraph:

    Rationale:

    The LWG believes length_error is the correct exception to throw.


    -

    86. String constructors don't describe exceptions

    -Section: 21.3.1 [lib.string.cons]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    86. String constructors don't describe exceptions

    Section: 21.3.1 [lib.string.cons]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    The constructor from a range:

    template<class InputIterator> 
    @@ -2425,16 +2630,15 @@ described in this clause...") add a new paragraph:

    according to the other constructors if the numbers of characters in the range equals npos (or exceeds max_size(), see above).

    Proposed resolution:

    -

    In 21.3.1 [lib.string.cons], Strike throws paragraphs for +

    In 21.3.1 [lib.string.cons], Strike throws paragraphs for constructors which say "Throws: length_error if n == npos."

    Rationale:

    Throws clauses for length_error if n == npos are no longer needed because they are subsumed by the general wording added by the -resolution for issue 83.

    +resolution for issue 83.


    -

    90. Incorrect description of operator >> for strings

    -Section: 21.3.7.9 [lib.string.io]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    90. Incorrect description of operator >> for strings

    Section: 21.3.7.9 [lib.string.io]  Status: TC  Submitter: Nico Josuttis  Date: 29 Sep 1998

    The effect of operator >> for strings contain the following item:

        isspace(c,getloc()) is true for the next available input @@ -2442,28 +2646,25 @@ character c.

    Here getloc() has to be replaced by is.getloc().

    Proposed resolution:

    -

    In 21.3.7.9 [lib.string.io] paragraph 1 Effects clause replace:

    +

    In 21.3.7.9 [lib.string.io] paragraph 1 Effects clause replace:

    -

    -isspace(c,getloc()) is true for the next available input character c.

    +

    isspace(c,getloc()) is true for the next available input character c.

    with:

    -

    -isspace(c,is.getloc()) is true for the next available input character c.

    +

    isspace(c,is.getloc()) is true for the next available input character c.


    -

    91. Description of operator>> and getline() for string<> might cause endless loop

    -Section: 21.3.7.9 [lib.string.io]  Status: WP  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    91. Description of operator>> and getline() for string<> might cause endless loop

    Section: 21.3.7.9 [lib.string.io]  Status: WP  Submitter: Nico Josuttis  Date: 29 Sep 1998

    Operator >> and getline() for strings read until eof() in the input stream is true. However, this might never happen, if the stream can't read anymore without reaching EOF. So shouldn't it be changed into that it reads until !good() ?

    Proposed resolution:

    -

    In 21.3.7.9 [lib.string.io], paragraph 1, replace:

    +

    In 21.3.7.9 [lib.string.io], paragraph 1, replace:

    Effects: Begins by constructing a sentry object k as if k were constructed by typename basic_istream<charT,traits>::sentry k( is). If @@ -2475,7 +2676,7 @@ extracted and appended until any of the following occurs:

    with:

    -Effects: Behaves as a formatted input function (27.6.1.2.1 [lib.istream.formatted.reqmts]). After constructing a sentry object, if the +Effects: Behaves as a formatted input function (27.6.1.2.1 [lib.istream.formatted.reqmts]). After constructing a sentry object, if the sentry converts to true, calls str.erase() and then extracts characters from is and appends them to str as if by calling str.append(1,c). If is.width() is greater than zero, the maximum @@ -2484,7 +2685,7 @@ str.max_size(). Characters are extracted and appended until any of the following occurs:
    -

    In 21.3.7.9 [lib.string.io], paragraph 6, replace

    +

    In 21.3.7.9 [lib.string.io], paragraph 6, replace

    Effects: Begins by constructing a sentry object k as if by typename basic_istream<charT,traits>::sentry k( is, true). If bool( k) is true, @@ -2494,7 +2695,7 @@ following occurs:

    with:

    -Effects: Behaves as an unformatted input function (27.6.1.3 [lib.istream.unformatted]), except that it does not affect the value returned +Effects: Behaves as an unformatted input function (27.6.1.3 [lib.istream.unformatted]), except that it does not affect the value returned by subsequent calls to basic_istream<>::gcount(). After constructing a sentry object, if the sentry converts to true, calls str.erase() and then extracts characters from is and appends them to @@ -2508,7 +2709,7 @@ should be a formatted input function, not an unformatted input function. there is no mechanism for gcount to be set except by one of basic_istream's member functions.]

    -

    [Curaçao: Nico agrees with proposed resolution.]

    +

    [Curaçao: Nico agrees with proposed resolution.]

    Rationale:

    The real issue here is whether or not these string input functions @@ -2518,8 +2719,134 @@ returning eof or by throwing an exception; there are no other possibilities. The proposed resolution makes it clear that these two functions do get characters from a streambuf.


    -

    103. set::iterator is required to be modifiable, but this allows modification of keys

    -Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: AFNOR  Date: 7 Oct 1998

    +

    92. Incomplete Algorithm Requirements

    Section: 25 [lib.algorithms]  Status: WP  Submitter: Nico Josuttis  Date: 29 Sep 1998

    +

    The standard does not state, how often a function object is copied, +called, or the order of calls inside an algorithm. This may lead to +surprising/buggy behavior. Consider the following example:

    + +
    class Nth {    // function object that returns true for the nth element 
    +  private: 
    +    int nth;     // element to return true for 
    +    int count;   // element counter 
    +  public: 
    +    Nth (int n) : nth(n), count(0) { 
    +    } 
    +    bool operator() (int) { 
    +        return ++count == nth; 
    +    } 
    +}; 
    +.... 
    +// remove third element 
    +    list<int>::iterator pos; 
    +    pos = remove_if(coll.begin(),coll.end(),  // range 
    +                    Nth(3)),                  // remove criterion 
    +    coll.erase(pos,coll.end()); 
    + +

    This call, in fact removes the 3rd AND the 6th element. This +happens because the usual implementation of the algorithm copies the +function object internally:

    + +
    template <class ForwIter, class Predicate> 
    +ForwIter std::remove_if(ForwIter beg, ForwIter end, Predicate op) 
    +{ 
    +    beg = find_if(beg, end, op); 
    +    if (beg == end) { 
    +        return beg; 
    +    } 
    +    else { 
    +        ForwIter next = beg; 
    +        return remove_copy_if(++next, end, beg, op); 
    +    } 
    +} 
    + +

    The algorithm uses find_if() to find the first element that should +be removed. However, it then uses a copy of the passed function object +to process the resulting elements (if any). Here, Nth is used again +and removes also the sixth element. This behavior compromises the +advantage of function objects being able to have a state. Without any +cost it could be avoided (just implement it directly instead of +calling find_if()).

    +

    Proposed resolution:

    + +

    Add a new paragraph following 25 [lib.algorithms] paragraph 8:

    +
    +[Note: Unless otherwise specified, algorithms that take function +objects as arguments are permitted to copy those function objects +freely. Programmers for whom object identity is important should +consider using a wrapper class that points to a noncopied +implementation object, or some equivalent solution.] +
    + +

    [Dublin: Pete Becker felt that this may not be a defect, +but rather something that programmers need to be educated about. +There was discussion of adding wording to the effect that the number +and order of calls to function objects, including predicates, not +affect the behavior of the function object.]

    + +

    [Pre-Kona: Nico comments: It seems the problem is that we don't +have a clear statement of "predicate" in the +standard. People including me seemed to think "a function +returning a Boolean value and being able to be called by an STL +algorithm or be used as sorting criterion or ... is a +predicate". But a predicate has more requirements: It should +never change its behavior due to a call or being copied. IMHO we have +to state this in the standard. If you like, see section 8.1.4 of my +library book for a detailed discussion.]

    + +

    [Kona: Nico will provide wording to the effect that "unless +otherwise specified, the number of copies of and calls to function +objects by algorithms is unspecified".  Consider placing in +25 [lib.algorithms] after paragraph 9.]

    + +

    [Santa Cruz: The standard doesn't currently guarantee that + functions object won't be copied, and what isn't forbidden is + allowed. It is believed (especially since implementations that were + written in concert with the standard do make copies of function + objects) that this was intentional. Thus, no normative change is + needed. What we should put in is a non-normative note suggesting to + programmers that if they want to guarantee the lack of copying they + should use something like the ref wrapper.]

    + +

    [Oxford: Matt provided wording.]

    + + +
    +

    98. Input iterator requirements are badly written

    Section: 24.1.1 [lib.input.iterators]  Status: WP  Submitter: AFNOR  Date: 7 Oct 1998

    +

    Table 72 in 24.1.1 [lib.input.iterators] specifies semantics for +*r++ of:

    + +

       { T tmp = *r; ++r; return tmp; }

    + +

    There are two problems with this. First, the return type is +specified to be "T", as opposed to something like "convertible to T". +This is too specific: we want to allow *r++ to return an lvalue.

    + +

    Second, writing the semantics in terms of code misleadingly +suggests that the effects *r++ should precisely replicate the behavior +of this code, including side effects. (Does this mean that *r++ +should invoke the copy constructor exactly as many times as the sample +code above would?) See issue 334 for a similar +problem.

    + +

    Proposed resolution:

    +In Table 72 in 24.1.1 [lib.input.iterators], change the return type +for *r++ from T to "convertible to T". +

    Rationale:

    +

    This issue has two parts: the return type, and the number of times + the copy constructor is invoked.

    + +

    The LWG believes the the first part is a real issue. It's + inappropriate for the return type to be specified so much more + precisely for *r++ than it is for *r. In particular, if r is of + (say) type int*, then *r++ isn't int, + but int&.

    + +

    The LWG does not believe that the number of times the copy + constructor is invoked is a real issue. This can vary in any case, + because of language rules on copy constructor elision. That's too + much to read into these semantics clauses.

    +
    +

    103. set::iterator is required to be modifiable, but this allows modification of keys

    Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: AFNOR  Date: 7 Oct 1998

    Set::iterator is described as implementation-defined with a reference to the container requirement; the container requirement says that const_iterator is an iterator pointing to const T and iterator an @@ -2534,7 +2861,7 @@ const_iterator. Set, for example, has the following:

    typedef implementation defined iterator;
           // See _lib.container.requirements_

    -

    23.1 [lib.container.requirements] actually requires that iterator type pointing +

    23.1 [lib.container.requirements] actually requires that iterator type pointing to T (table 65). Disallowing user modification of keys by changing the standard to require an iterator for associative container to be the same as const_iterator would be overkill since that will unnecessarily @@ -2545,10 +2872,9 @@ that have nothing to do with ordering), or using const_cast, which defeats requiring iterator to be const_iterator. The proposed solution goes in line with trusting user knows what he is doing.

    -

    -Other Options Evaluated:

    +

    Other Options Evaluated:

    -

    Option A.   In 23.1.2 [lib.associative.reqmts], paragraph 2, after +

    Option A.   In 23.1.2 [lib.associative.reqmts], paragraph 2, after first sentence, and before "In addition,...", add one line:

    @@ -2556,7 +2882,7 @@ first sentence, and before "In addition,...", add one line:

    Modification of keys shall not change their strict weak ordering.

    -

    Option B. Add three new sentences to 23.1.2 [lib.associative.reqmts]:

    +

    Option B. Add three new sentences to 23.1.2 [lib.associative.reqmts]:

    At the end of paragraph 5: "Keys in an associative container @@ -2568,7 +2894,7 @@ first sentence, and before "In addition,...", add one line: type."

    -

    Option C. To 23.1.2 [lib.associative.reqmts], paragraph 3, which +

    Option C. To 23.1.2 [lib.associative.reqmts], paragraph 3, which currently reads:

    @@ -2591,7 +2917,7 @@ currently reads:

    different than it was the previous time k2 was in the container.]

    Proposed resolution:

    -

    Add the following to 23.1.2 [lib.associative.reqmts] at +

    Add the following to 23.1.2 [lib.associative.reqmts] at the indicated location:

    @@ -2629,8 +2955,7 @@ conversion from iterator to const_iterator.

    [Tokyo: The LWG crafted the proposed resolution and rationale.]


    -

    106. Numeric library private members are implementation defined

    -Section: 26.3.5 [lib.template.slice.array]  Status: TC  Submitter: AFNOR  Date: 7 Oct 1998

    +

    106. Numeric library private members are implementation defined

    Section: 26.3.5 [lib.template.slice.array]  Status: TC  Submitter: AFNOR  Date: 7 Oct 1998

    This is the only place in the whole standard where the implementation has to document something private.

    Proposed resolution:

    @@ -2639,24 +2964,23 @@ Remove the comment which says "// remainder implementation defined" from:


    -

    108. Lifetime of exception::what() return unspecified

    -Section: 18.6.1 [lib.exception]  Status: TC  Submitter: AFNOR  Date: 7 Oct 1998

    +

    108. Lifetime of exception::what() return unspecified

    Section: 18.6.1 [lib.exception]  Status: TC  Submitter: AFNOR  Date: 7 Oct 1998

    In 18.6.1, paragraphs 8-9, the lifetime of the return value of exception::what() is left unspecified. This issue has implications with exception safety of exception handling: some exceptions should not throw bad_alloc.

    Proposed resolution:

    -

    Add to 18.6.1 [lib.exception] paragraph 9 (exception::what notes +

    Add to 18.6.1 [lib.exception] paragraph 9 (exception::what notes clause) the sentence:

    @@ -2669,8 +2993,7 @@ to set internal state that should affect the contents of the string returned by what().


    -

    109. Missing binders for non-const sequence elements

    -Section: 20.3.6 [lib.binders]  Status: WP  Submitter: Bjarne Stroustrup  Date: 7 Oct 1998

    +

    109. Missing binders for non-const sequence elements

    Section: 20.3.6 [lib.binders]  Status: WP  Submitter: Bjarne Stroustrup  Date: 7 Oct 1998

    There are no versions of binders that apply to non-const elements of a sequence. This makes examples like for_each() using bind2nd() on @@ -2742,11 +3065,10 @@ public:

    Proposed resolution:

    -

    -Howard believes there is a flaw in this resolution. +

    Howard believes there is a flaw in this resolution. See c++std-lib-9127. We may need to reopen this issue.

    -

    In 20.3.6.1 [lib.binder.1st] in the declaration of binder1st after:

    +

    In 20.3.6.1 [lib.binder.1st] in the declaration of binder1st after:

    typename Operation::result_type
     operator()(const typename Operation::second_argument_type& x) const;

    @@ -2756,7 +3078,7 @@ See c++std-lib-9127. We may need to reopen this issue.

    typename Operation::result_type
     operator()(typename Operation::second_argument_type& x) const;

    -

    In 20.3.6.3 [lib.binder.2nd] in the declaration of binder2nd after:

    +

    In 20.3.6.3 [lib.binder.2nd] in the declaration of binder2nd after:

    typename Operation::result_type
     operator()(const typename Operation::first_argument_type& x) const;

    @@ -2777,13 +3099,12 @@ Strap poll: NAD - 0. Accept proposed resolution - 10. Leave open - 1.]


    -

    110. istreambuf_iterator::equal not const

    -Section: 24.5.3 [lib.istreambuf.iterator], 24.5.3.5 [lib.istreambuf.iterator::equal]  Status: TC  Submitter: Nathan Myers  Date: 15 Oct 1998

    +

    110. istreambuf_iterator::equal not const

    Section: 24.5.3 [lib.istreambuf.iterator], 24.5.3.5 [lib.istreambuf.iterator::equal]  Status: TC  Submitter: Nathan Myers  Date: 15 Oct 1998

    Member istreambuf_iterator<>::equal is not declared -"const", yet 24.5.3.6 [lib.istreambuf.iterator::op==] says that operator==, +"const", yet 24.5.3.6 [lib.istreambuf.iterator::op==] says that operator==, which is const, calls it. This is contradictory.

    Proposed resolution:

    -

    In 24.5.3 [lib.istreambuf.iterator] and also in 24.5.3.5 [lib.istreambuf.iterator::equal], +

    In 24.5.3 [lib.istreambuf.iterator] and also in 24.5.3.5 [lib.istreambuf.iterator::equal], replace:

    @@ -2796,14 +3117,13 @@ replace:

    bool equal(const istreambuf_iterator& b) const;

    -

    112. Minor typo in ostreambuf_iterator constructor

    -Section: 24.5.4.1 [lib.ostreambuf.iter.cons]  Status: TC  Submitter: Matt Austern  Date: 20 Oct 1998

    +

    112. Minor typo in ostreambuf_iterator constructor

    Section: 24.5.4.1 [lib.ostreambuf.iter.cons]  Status: TC  Submitter: Matt Austern  Date: 20 Oct 1998

    The requires clause for ostreambuf_iterator's constructor from an ostream_type (24.5.4.1, paragraph 1) reads "s is not null". However, s is a reference, and references can't be null.

    Proposed resolution:

    -

    In 24.5.4.1 [lib.ostreambuf.iter.cons]:

    +

    In 24.5.4.1 [lib.ostreambuf.iter.cons]:

    Move the current paragraph 1, which reads "Requires: s is not null.", from the first constructor to the second constructor.

    @@ -2812,12 +3132,10 @@ null.", from the first constructor to the second constructor.

    reading:

    -

    -Requires: s.rdbuf() is not null.

    +

    Requires: s.rdbuf() is not null.


    -

    114. Placement forms example in error twice

    -Section: 18.4.1.3 [lib.new.delete.placement]  Status: TC  Submitter: Steve Clamage  Date: 28 Oct 1998

    +

    114. Placement forms example in error twice

    Section: 18.4.1.3 [lib.new.delete.placement]  Status: TC  Submitter: Steve Clamage  Date: 28 Oct 1998

    Section 18.4.1.3 contains the following example:

    [Example: This can be useful for constructing an object at a known address:
    @@ -2835,15 +3153,14 @@ believes the () are correct.]

    likely to fail.

    Proposed resolution:

    Replace the first line of code in the example in -18.4.1.3 [lib.new.delete.placement] with: +18.4.1.3 [lib.new.delete.placement] with:

    void* place = operator new(sizeof(Something));

    -

    115. Typo in strstream constructors

    -Section: D.7.4.1 [depr.strstream.cons]  Status: TC  Submitter: Steve Clamage  Date: 2 Nov 1998

    +

    115. Typo in strstream constructors

    Section: D.7.4.1 [depr.strstream.cons]  Status: TC  Submitter: Steve Clamage  Date: 2 Nov 1998

    D.7.4.1 strstream constructors paragraph 2 says:

    @@ -2860,12 +3177,11 @@ likely to fail.

    should be "If mode&app==app", or "mode&app!=0", meaning that the append bit is set.

    Proposed resolution:

    -

    In D.7.3.1 [depr.ostrstream.cons] paragraph 2 and D.7.4.1 [depr.strstream.cons] +

    In D.7.3.1 [depr.ostrstream.cons] paragraph 2 and D.7.4.1 [depr.strstream.cons] paragraph 2, change the first condition to (mode&app)==0 and the second condition to (mode&app)!=0.


    -

    117. basic_ostream uses nonexistent num_put member functions

    -Section: 27.6.2.5.2 [lib.ostream.inserters.arithmetic]  Status: WP  Submitter: Matt Austern  Date: 20 Nov 1998

    +

    117. basic_ostream uses nonexistent num_put member functions

    Section: 27.6.2.5.2 [lib.ostream.inserters.arithmetic]  Status: WP  Submitter: Matt Austern  Date: 20 Nov 1998

    The effects clause for numeric inserters says that insertion of a value x, whose type is either bool, short, unsigned short, int, unsigned @@ -2894,7 +3210,7 @@ functions that are actually there. I prefer the latter.

    -The classes num_get<> and num_put<> handle locale­dependent numeric +The classes num_get<> and num_put<> handle locale­dependent numeric formatting and parsing. These inserter functions use the imbued locale value to perform numeric formatting. When val is of type bool, long, unsigned long, double, long double, or const void*, the @@ -2902,7 +3218,8 @@ formatting conversion occurs as if it performed the following code fragment:

    -
    bool failed = use_facet<
    +
    +bool failed = use_facet<
        num_put<charT,ostreambuf_iterator<charT,traits> >
        >(getloc()).put(*this, *this, fill(), val). failed();
     
    @@ -2912,7 +3229,8 @@ When val is of type short the formatting conversion occurs as if it performed the following code fragment:

    -
    ios_base::fmtflags baseflags = ios_base::flags() & ios_base::basefield;
    +
    +ios_base::fmtflags baseflags = ios_base::flags() & ios_base::basefield;
     bool failed = use_facet<
        num_put<charT,ostreambuf_iterator<charT,traits> >
        >(getloc()).put(*this, *this, fill(),
    @@ -2926,7 +3244,8 @@ When val is of type int the formatting conversion occurs as if it performed
     the following code fragment:
     

    -
    ios_base::fmtflags baseflags = ios_base::flags() & ios_base::basefield;
    +
    +ios_base::fmtflags baseflags = ios_base::flags() & ios_base::basefield;
     bool failed = use_facet<
        num_put<charT,ostreambuf_iterator<charT,traits> >
        >(getloc()).put(*this, *this, fill(),
    @@ -2940,7 +3259,8 @@ When val is of type unsigned short or unsigned int the formatting conversion
     occurs as if it performed the following code fragment:
     

    -
    bool failed = use_facet<
    +
    +bool failed = use_facet<
        num_put<charT,ostreambuf_iterator<charT,traits> >
        >(getloc()).put(*this, *this, fill(), static_cast<unsigned long>(val)).
     failed();
    @@ -2951,7 +3271,8 @@ When val is of type float the formatting conversion occurs as if it
     performed the following code fragment:
     

    -
    bool failed = use_facet<
    +
    +bool failed = use_facet<
        num_put<charT,ostreambuf_iterator<charT,traits> >
        >(getloc()).put(*this, *this, fill(), static_cast<double>(val)).
     failed();
    @@ -2971,8 +3292,7 @@ complicated, but gives more expected results for hex and octal output
     of signed short and signed int.  (On a system with 16-bit short, for
     example, printing short(-1) in hex format should yield 0xffff.)


    -

    118. basic_istream uses nonexistent num_get member functions

    -Section: 27.6.1.2.2 [lib.istream.formatted.arithmetic]  Status: WP  Submitter: Matt Austern  Date: 20 Nov 1998

    +

    118. basic_istream uses nonexistent num_get member functions

    Section: 27.6.1.2.2 [lib.istream.formatted.arithmetic]  Status: WP  Submitter: Matt Austern  Date: 20 Nov 1998

    Formatted input is defined for the types short, unsigned short, int, unsigned int, long, unsigned long, float, double, long double, bool, and void*. According to section 27.6.1.2.2, @@ -2983,7 +3303,7 @@ iostate err = 0; use_facet< numget >(loc).get(*this, 0, *this, err, val); setstate(err);

    -

    According to section 22.2.2.1.1 [lib.facet.num.get.members], however, +

    According to section 22.2.2.1.1 [lib.facet.num.get.members], however, num_get<>::get() is only overloaded for the types bool, long, unsigned short, unsigned int, unsigned long, unsigned long, @@ -2992,7 +3312,7 @@ int, unsigned long, unsigned long, that 27.6.1.2.2 is using a nonexistent function for types short and int.

    Proposed resolution:

    -

    In 27.6.1.2.2 [lib.istream.formatted.arithmetic] Arithmetic Extractors, remove the +

    In 27.6.1.2.2 [lib.istream.formatted.arithmetic] Arithmetic Extractors, remove the two lines (1st and 3rd) which read:

    operator>>(short& val);
    @@ -3029,9 +3349,8 @@ operator>>(int& val);

    [Post-Tokyo: PJP provided the above wording.]


    -

    119. Should virtual functions be allowed to strengthen the exception specification?

    -Section: 17.4.4.8 [lib.res.on.exception.handling]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    -

    Section 17.4.4.8 [lib.res.on.exception.handling] states:

    +

    119. Should virtual functions be allowed to strengthen the exception specification?

    Section: 17.4.4.8 [lib.res.on.exception.handling]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    +

    Section 17.4.4.8 [lib.res.on.exception.handling] states:

    "An implementation may strengthen the exception-specification for a function by removing listed exceptions."

    @@ -3053,7 +3372,7 @@ public: // overridden virtual function ios_base::failure::~failure() };

    Proposed resolution:

    -

    Change Section 17.4.4.8 [lib.res.on.exception.handling] from:

    +

    Change Section 17.4.4.8 [lib.res.on.exception.handling] from:

         "may strengthen the exception-specification for a function"

    @@ -3063,8 +3382,107 @@ exception-specification for a function"

         "may strengthen the exception-specification for a non-virtual function".


    -

    122. streambuf/wstreambuf description should not say they are specializations

    -Section: 27.5.2 [lib.streambuf]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    +

    120. Can an implementor add specializations?

    Section: 17.4.3.1 [lib.reserved.names]  Status: WP  Submitter: Judy Ward  Date: 15 Dec 1998

    + +

    The original issue asked whether a library implementor could +specialize standard library templates for built-in types. (This was +an issue because users are permitted to explicitly instantiate +standard library templates.)

    + +

    Specializations are no longer a problem, because of the resolution +to core issue 259. Under the proposed resolution, it will be legal +for a translation unit to contain both a specialization and an +explicit instantiation of the same template, provided that the +specialization comes first. In such a case, the explicit +instantiation will be ignored. Further discussion of library issue +120 assumes that the core 259 resolution will be adopted.

    + +

    However, as noted in lib-7047, one piece of this issue still +remains: what happens if a standard library implementor explicitly +instantiates a standard library templates? It's illegal for a program +to contain two different explicit instantiations of the same template +for the same type in two different translation units (ODR violation), +and the core working group doesn't believe it is practical to relax +that restriction.

    + +

    The issue, then, is: are users allowed to explicitly instantiate +standard library templates for non-user defined types? The status quo +answer is 'yes'. Changing it to 'no' would give library implementors +more freedom.

    + +

    This is an issue because, for performance reasons, library +implementors often need to explicitly instantiate standard library +templates. (for example, std::basic_string<char>) Does giving +users freedom to explicitly instantiate standard library templates for +non-user defined types make it impossible or painfully difficult for +library implementors to do this?

    + +

    John Spicer suggests, in lib-8957, that library implementors have a +mechanism they can use for explicit instantiations that doesn't +prevent users from performing their own explicit instantiations: put +each explicit instantiation in its own object file. (Different +solutions might be necessary for Unix DSOs or MS-Windows DLLs.) On +some platforms, library implementors might not need to do anything +special: the "undefined behavior" that results from having two +different explicit instantiations might be harmless.

    + +

    Proposed resolution:

    +

    Append to 17.4.3.1 [lib.reserved.names] paragraph 1:

    +
    + A program may explicitly instantiate any templates in the standard + library only if the declaration depends on the name of a user-defined + type of external linkage and the instantiation meets the standard library + requirements for the original template. +
    + +

    [Kona: changed the wording from "a user-defined name" to "the name of + a user-defined type"]

    + +

    Rationale:

    +

    The LWG considered another possible resolution:

    +
    +

    In light of the resolution to core issue 259, no normative changes + in the library clauses are necessary. Add the following non-normative + note to the end of 17.4.3.1 [lib.reserved.names] paragraph 1:

    +
    + [Note: A program may explicitly instantiate standard library + templates, even when an explicit instantiation does not depend on + a user-defined name. --end note] +
    +
    + +

    The LWG rejected this because it was believed that it would make + it unnecessarily difficult for library implementors to write + high-quality implementations. A program may not include an + explicit instantiation of the same template, for the same template + arguments, in two different translation units. If users are + allowed to provide explicit instantiations of Standard Library + templates for built-in types, then library implementors aren't, + at least not without nonportable tricks.

    + +

    The most serious problem is a class template that has writeable + static member variables. Unfortunately, such class templates are + important and, in existing Standard Library implementations, are + often explicitly specialized by library implementors: locale facets, + which have a writeable static member variable id. If a + user's explicit instantiation collided with the implementations + explicit instantiation, iostream initialization could cause locales + to be constructed in an inconsistent state.

    + +

    One proposed implementation technique was for Standard Library + implementors to provide explicit instantiations in separate object + files, so that they would not be picked up by the linker when the + user also provides an explicit instantiation. However, this + technique only applies for Standard Library implementations that + are packaged as static archives. Most Standard Library + implementations nowadays are packaged as dynamic libraries, so this + technique would not apply.

    + +

    The Committee is now considering standardization of dynamic + linking. If there are such changes in the future, it may be + appropriate to revisit this issue later.

    +
    +

    122. streambuf/wstreambuf description should not say they are specializations

    Section: 27.5.2 [lib.streambuf]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    Section 27.5.2 describes the streambuf classes this way:

    @@ -3081,117 +3499,131 @@ specialized for the type wchar_t.

    It doesn't seem this was intended, since Section 27.5 has them declared as typedefs.

    Proposed resolution:

    -

    Remove 27.5.2 [lib.streambuf] paragraphs 2 and 3 (the above two +

    Remove 27.5.2 [lib.streambuf] paragraphs 2 and 3 (the above two sentences).

    Rationale:

    The streambuf synopsis already has a declaration for the typedefs and that is sufficient.


    -

    123. Should valarray helper arrays fill functions be const?

    -Section: 26.3.5.4 [lib.slice.arr.fill], 26.3.7.4 [lib.gslice.array.fill], 26.3.8.4 [lib.mask.array.fill], 26.3.9.4 [lib.indirect.array.fill]  Status: WP  Submitter: Judy Ward  Date: 15 Dec 1998

    +

    123. Should valarray helper arrays fill functions be const?

    Section: 26.3.5.4 [lib.slice.arr.fill], 26.3.7.4 [lib.gslice.array.fill], 26.3.8.4 [lib.mask.array.fill], 26.3.9.4 [lib.indirect.array.fill]  Status: WP  Submitter: Judy Ward  Date: 15 Dec 1998

    One of the operator= in the valarray helper arrays is const and one is not. For example, look at slice_array. This operator= in Section -26.3.5.2 [lib.slice.arr.assign] is const:

    +26.3.5.2 [lib.slice.arr.assign] is const:

        void operator=(const valarray<T>&) const;

    -

    but this one in Section 26.3.5.4 [lib.slice.arr.fill] is not:

    +

    but this one in Section 26.3.5.4 [lib.slice.arr.fill] is not:

    -

        void operator=(const T&); -

    +

        void operator=(const T&);

    The description of the semantics for these two functions is similar.

    Proposed resolution:

    -

    26.3.5 [lib.template.slice.array] Template class slice_array

    +

    26.3.5 [lib.template.slice.array] Template class slice_array

    In the class template definition for slice_array, replace the member function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    with

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.5.4 [lib.slice.arr.fill] slice_array fill function

    +

    26.3.5.4 [lib.slice.arr.fill] slice_array fill function

    Change the function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    to

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.7 [lib.template.gslice.array] Template class gslice_array

    +

    26.3.7 [lib.template.gslice.array] Template class gslice_array

    In the class template definition for gslice_array, replace the member function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    with

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.7.4 [lib.gslice.array.fill] gslice_array fill function

    +

    26.3.7.4 [lib.gslice.array.fill] gslice_array fill function

    Change the function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    to

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.8 [lib.template.mask.array] Template class mask_array

    +

    26.3.8 [lib.template.mask.array] Template class mask_array

    In the class template definition for mask_array, replace the member function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    with

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.8.4 [lib.mask.array.fill] mask_array fill function

    +

    26.3.8.4 [lib.mask.array.fill] mask_array fill function

    Change the function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    to

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.9 [lib.template.indirect.array] Template class indirect_array

    +

    26.3.9 [lib.template.indirect.array] Template class indirect_array

    In the class template definition for indirect_array, replace the member function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    with

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    -

    26.3.9.4 [lib.indirect.array.fill] indirect_array fill function

    +

    26.3.9.4 [lib.indirect.array.fill] indirect_array fill function

    Change the function declaration

    -
          void operator=(const T&);
    +    
    +      void operator=(const T&);
         

    to

    -
          void operator=(const T&) const;
    +    
    +      void operator=(const T&) const;
         
    @@ -3200,35 +3632,32 @@ is not. For example, look at slice_array. This operator= in Section

    Rationale:

    There's no good reason for one version of operator= being const and -another one not. Because of issue 253, this now +another one not. Because of issue 253, this now matters: these functions are now callable in more circumstances. In many existing implementations, both versions are already const.


    -

    124. ctype_byname<charT>::do_scan_is & do_scan_not return type should be const charT*

    -Section: 22.2.1.2 [lib.locale.ctype.byname]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    -

    In Section 22.2.1.2 [lib.locale.ctype.byname] +

    124. ctype_byname<charT>::do_scan_is & do_scan_not return type should be const charT*

    Section: 22.2.1.2 [lib.locale.ctype.byname]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    +

    In Section 22.2.1.2 [lib.locale.ctype.byname] ctype_byname<charT>::do_scan_is() and do_scan_not() are declared to return a const char* not a const charT*.

    Proposed resolution:

    -

    Change Section 22.2.1.2 [lib.locale.ctype.byname] do_scan_is() and +

    Change Section 22.2.1.2 [lib.locale.ctype.byname] do_scan_is() and do_scan_not() to return a const charT*.


    -

    125. valarray<T>::operator!() return type is inconsistent

    -Section: 26.3.2 [lib.template.valarray]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    -

    In Section 26.3.2 [lib.template.valarray] valarray<T>::operator!() is -declared to return a valarray<T>, but in Section 26.3.2.5 [lib.valarray.unary] it is declared to return a valarray<bool>. The +

    125. valarray<T>::operator!() return type is inconsistent

    Section: 26.3.2 [lib.template.valarray]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    +

    In Section 26.3.2 [lib.template.valarray] valarray<T>::operator!() is +declared to return a valarray<T>, but in Section 26.3.2.5 [lib.valarray.unary] it is declared to return a valarray<bool>. The latter appears to be correct.

    Proposed resolution:

    -

    Change in Section 26.3.2 [lib.template.valarray] the declaration of +

    Change in Section 26.3.2 [lib.template.valarray] the declaration of operator!() so that the return type is valarray<bool>.


    -

    126. typos in Effects clause of ctype::do_narrow()

    -Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    +

    126. typos in Effects clause of ctype::do_narrow()

    Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: TC  Submitter: Judy Ward  Date: 15 Dec 1998

    Typos in 22.2.1.1.2 need to be fixed.

    Proposed resolution:

    -

    In Section 22.2.1.1.2 [lib.locale.ctype.virtuals] change:

    +

    In Section 22.2.1.1.2 [lib.locale.ctype.virtuals] change:

       do_widen(do_narrow(c),0) == c
    @@ -3244,16 +3673,14 @@ latter appears to be correct.

       (is(M,c) || !ctc.is(M, do_narrow(c,dfault)) )

    -

    127. auto_ptr<> conversion issues

    -Section: 20.4.5 [lib.auto.ptr]  Status: TC  Submitter: Greg Colvin  Date: 17 Feb 1999

    +

    127. auto_ptr<> conversion issues

    Section: 20.4.5 [lib.auto.ptr]  Status: TC  Submitter: Greg Colvin  Date: 17 Feb 1999

    There are two problems with the current auto_ptr wording in the standard:

    First, the auto_ptr_ref definition cannot be nested because auto_ptr<Derived>::auto_ptr_ref is unrelated to auto_ptr<Base>::auto_ptr_ref. Also submitted by -Nathan Myers, with the same proposed resolution. -

    +Nathan Myers, with the same proposed resolution.

    Second, there is no auto_ptr assignment operator taking an auto_ptr_ref argument.

    @@ -3283,23 +3710,23 @@ object parameter may be bound to an rvalue [13.3.3.1.4/3]

    Tokyo: The LWG removed the following from the proposed resolution:

    -

    In 20.4.5 [lib.auto.ptr], paragraph 2, and 20.4.5.3 [lib.auto.ptr.conv], +

    In 20.4.5 [lib.auto.ptr], paragraph 2, and 20.4.5.3 [lib.auto.ptr.conv], paragraph 2, make the conversion to auto_ptr_ref const:

    template<class Y> operator auto_ptr_ref<Y>() const throw();

    Proposed resolution:

    -

    In 20.4.5 [lib.auto.ptr], paragraph 2, move +

    In 20.4.5 [lib.auto.ptr], paragraph 2, move the auto_ptr_ref definition to namespace scope.

    -

    In 20.4.5 [lib.auto.ptr], paragraph 2, add +

    In 20.4.5 [lib.auto.ptr], paragraph 2, add a public assignment operator to the auto_ptr definition:

    auto_ptr& operator=(auto_ptr_ref<X> r) throw();
    -

    Also add the assignment operator to 20.4.5.3 [lib.auto.ptr.conv]:

    +

    Also add the assignment operator to 20.4.5.3 [lib.auto.ptr.conv]:

    auto_ptr& operator=(auto_ptr_ref<X> r) throw()
    @@ -3310,8 +3737,7 @@ a public assignment operator to the auto_ptr definition:


    -

    129. Need error indication from seekp() and seekg()

    -Section: 27.6.1.3 [lib.istream.unformatted], 27.6.2.4 [lib.ostream.seeks]  Status: TC  Submitter: Angelika Langer  Date: 22 Feb 1999

    +

    129. Need error indication from seekp() and seekg()

    Section: 27.6.1.3 [lib.istream.unformatted], 27.6.2.4 [lib.ostream.seeks]  Status: TC  Submitter: Angelika Langer  Date: 22 Feb 1999

    Currently, the standard does not specify how seekg() and seekp() indicate failure. They are not required to set failbit, and they can't return an error indication because they must return *this, i.e. the @@ -3324,8 +3750,8 @@ stream must perform a state-dependent code conversion, etc.

    stream state in case of failure.

    Proposed resolution:

    Add to the Effects: clause of  seekg() in -27.6.1.3 [lib.istream.unformatted] and to the Effects: clause of seekp() in -27.6.2.4 [lib.ostream.seeks]:

    +27.6.1.3 [lib.istream.unformatted] and to the Effects: clause of seekp() in +27.6.2.4 [lib.ostream.seeks]:

    In case of failure, the function calls setstate(failbit) (which may throw ios_base::failure). @@ -3334,8 +3760,7 @@ stream state in case of failure.

    Rationale:

    Setting failbit is the usual error reporting mechanism for streams


    -

    132. list::resize description uses random access iterators

    -Section: 23.2.2.2 [lib.list.capacity]  Status: TC  Submitter: Howard Hinnant  Date: 6 Mar 1999

    +

    132. list::resize description uses random access iterators

    Section: 23.2.2.2 [lib.list.capacity]  Status: TC  Submitter: Howard Hinnant  Date: 6 Mar 1999

    The description reads:

    -1- Effects:

    @@ -3366,24 +3791,22 @@ stream state in case of failure.

    with David Abrahams. They had a discussion and believe there is no issue of exception safety with the proposed resolution.]


    -

    133. map missing get_allocator()

    -Section: 23.3.1 [lib.map]  Status: TC  Submitter: Howard Hinnant  Date: 6 Mar 1999

    +

    133. map missing get_allocator()

    Section: 23.3.1 [lib.map]  Status: TC  Submitter: Howard Hinnant  Date: 6 Mar 1999

    The title says it all.

    Proposed resolution:

    -

    Insert in 23.3.1 [lib.map], paragraph 2, +

    Insert in 23.3.1 [lib.map], paragraph 2, after operator= in the map declaration:

        allocator_type get_allocator() const;

    -

    134. vector constructors over specified

    -Section: 23.2.4.1 [lib.vector.cons]  Status: TC  Submitter: Howard Hinnant  Date: 6 Mar 1999

    +

    134. vector constructors over specified

    Section: 23.2.4.1 [lib.vector.cons]  Status: TC  Submitter: Howard Hinnant  Date: 6 Mar 1999

    The complexity description says: "It does at most 2N calls to the copy constructor of T and logN reallocations if they are just input iterators ...".

    This appears to be overly restrictive, dictating the precise memory/performance tradeoff for the implementor.

    Proposed resolution:

    -

    Change 23.2.4.1 [lib.vector.cons], paragraph 1 to:

    +

    Change 23.2.4.1 [lib.vector.cons], paragraph 1 to:

    -1- Complexity: The constructor template <class InputIterator> vector(InputIterator first, InputIterator last) @@ -3398,8 +3821,7 @@ order logN reallocations if they are just input iterators. is greater than or equal to 2.


    -

    136. seekp, seekg setting wrong streams?

    -Section: 27.6.1.3 [lib.istream.unformatted]  Status: WP  Submitter: Howard Hinnant  Date: 6 Mar 1999

    +

    136. seekp, seekg setting wrong streams?

    Section: 27.6.1.3 [lib.istream.unformatted]  Status: WP  Submitter: Howard Hinnant  Date: 6 Mar 1999

    I may be misunderstanding the intent, but should not seekg set only the input stream and seekp set only the output stream? The description seems to say that each should set both input and output streams. If @@ -3441,7 +3863,7 @@ Effects: If fail() != true, executes rdbuf()->pubseekoff(off, dir, ios_base::

    -4- Effects: If fail() != true, executes rdbuf()->pubseekoff(off, dir, ios_base::out). 
    -

    [Dublin: Dietmar Kühl thinks this is probably correct, but would +

    [Dublin: Dietmar Kühl thinks this is probably correct, but would like the opinion of more iostream experts before taking action.]

    [Tokyo: Reviewed by the LWG. PJP noted that although his docs are @@ -3460,9 +3882,8 @@ This requirement is a bit weird. There's no similar requirement for basic_streambuf<>::seekpos, or for basic_filebuf<>::seekoff or basic_filebuf<>::seekpos.]


    -

    137. Do use_facet and has_facet look in the global locale?

    -Section: 22.1.1 [lib.locale]  Status: TC  Submitter: Angelika Langer  Date: 17 Mar 1999

    -

    Section 22.1.1 [lib.locale] says:

    +

    137. Do use_facet and has_facet look in the global locale?

    Section: 22.1.1 [lib.locale]  Status: TC  Submitter: Angelika Langer  Date: 17 Mar 1999

    +

    Section 22.1.1 [lib.locale] says:

    -4- In the call to use_facet<Facet>(loc), the type argument chooses a facet, making available all members of the named type. If @@ -3472,7 +3893,7 @@ check if a locale implements a particular facet with the template function has_facet<Facet>().

    This contradicts the specification given in section -22.1.2 [lib.locale.global.templates]: +22.1.2 [lib.locale.global.templates]:

    template <class  Facet> const  Facet& use_facet(const locale&  loc);
    @@ -3489,8 +3910,7 @@ from section 22.1.1.

    Needed for consistency with the way locales are handled elsewhere in the standard.


    -

    139. Optional sequence operation table description unclear

    -Section: 23.1.1 [lib.sequence.reqmts]  Status: TC  Submitter: Andrew Koenig  Date: 30 Mar 1999

    +

    139. Optional sequence operation table description unclear

    Section: 23.1.1 [lib.sequence.reqmts]  Status: TC  Submitter: Andrew Koenig  Date: 30 Mar 1999

    The sentence introducing the Optional sequence operation table (23.1.1 paragraph 12) has two problems:

    @@ -3513,13 +3933,11 @@ with:

    amortized constant time.


    -

    141. basic_string::find_last_of, find_last_not_of say pos instead of xpos

    -Section: 21.3.6.4 [lib.string::find.last.of], 21.3.6.6 [lib.string::find.last.not.of]  Status: TC  Submitter: Arch Robison  Date: 28 Apr 1999

    +

    141. basic_string::find_last_of, find_last_not_of say pos instead of xpos

    Section: 21.3.6.4 [lib.string::find.last.of], 21.3.6.6 [lib.string::find.last.not.of]  Status: TC  Submitter: Arch Robison  Date: 28 Apr 1999

    Sections 21.3.6.4 paragraph 1 and 21.3.6.6 paragraph 1 surely have misprints where they say:

    -— xpos <= pos and pos < size(); -

    +— xpos <= pos and pos < size();

    Surely the document meant to say ``xpos < size()'' in both places.

    @@ -3528,15 +3946,13 @@ proposed resolution.]

    Proposed resolution:

    Change Sections 21.3.6.4 paragraph 1 and 21.3.6.6 paragraph 1, the line which says:

    -— xpos <= pos and pos < size();
    +— xpos <= pos and pos < size();

    to:

    -
    xpos <= pos and xpos < size(); -

    +xpos <= pos and xpos < size();


    -

    142. lexicographical_compare complexity wrong

    -Section: 25.3.8 [lib.alg.lex.comparison]  Status: TC  Submitter: Howard Hinnant  Date: 20 Jun 1999

    +

    142. lexicographical_compare complexity wrong

    Section: 25.3.8 [lib.alg.lex.comparison]  Status: TC  Submitter: Howard Hinnant  Date: 20 Jun 1999

    The lexicographical_compare complexity is specified as:

         "At most min((last1 - first1), (last2 - first2)) @@ -3549,7 +3965,7 @@ equality you have to check both < and >? Yes, IMO you are right! (and Matt states this complexity in his book)

    Proposed resolution:

    -

    Change 25.3.8 [lib.alg.lex.comparison] complexity to:

    +

    Change 25.3.8 [lib.alg.lex.comparison] complexity to:

    At most 2*min((last1 - first1), (last2 - first2)) applications of the corresponding comparison. @@ -3569,8 +3985,7 @@ right! (and Matt states this complexity in his book)

    --end example]

    -

    144. Deque constructor complexity wrong

    -Section: 23.2.1.1 [lib.deque.cons]  Status: TC  Submitter: Herb Sutter  Date: 9 May 1999

    +

    144. Deque constructor complexity wrong

    Section: 23.2.1.1 [lib.deque.cons]  Status: TC  Submitter: Herb Sutter  Date: 9 May 1999

    In 23.2.1.1 paragraph 6, the deque ctor that takes an iterator range appears to have complexity requirements which are incorrect, and which contradict the complexity requirements for insert(). I suspect that the text in question, @@ -3601,8 +4016,7 @@ typo):

    Complexity: Makes last - first calls to the copy constructor of T.


    -

    146. complex<T> Inserter and Extractor need sentries

    -Section: 26.2.6 [lib.complex.ops]  Status: TC  Submitter: Angelika Langer  Date: 12 May 1999

    +

    146. complex<T> Inserter and Extractor need sentries

    Section: 26.2.6 [lib.complex.ops]  Status: TC  Submitter: Angelika Langer  Date: 12 May 1999

    The extractor for complex numbers is specified as: 

    @@ -3659,7 +4073,7 @@ consistency with the other inserters and extractors in the library. Regarding the issue of padding in the inserter, I don't know what the intent was. 

    Proposed resolution:

    -

    After 26.2.6 [lib.complex.ops] paragraph 14 (operator>>), add a +

    After 26.2.6 [lib.complex.ops] paragraph 14 (operator>>), add a Notes clause:

    @@ -3676,8 +4090,7 @@ follows an "all-or-none" rule.

    For inserters, the LWG believes there is no defect; the standard is correct as written.


    -

    147. Library Intro refers to global functions that aren't global

    -Section: 17.4.4.3 [lib.global.functions]  Status: TC  Submitter: Lois Goldthwaite  Date: 4 Jun 1999

    +

    147. Library Intro refers to global functions that aren't global

    Section: 17.4.4.3 [lib.global.functions]  Status: TC  Submitter: Lois Goldthwaite  Date: 4 Jun 1999

    The library had many global functions until 17.4.1.1 [lib.contents] paragraph 2 was added:

    @@ -3740,24 +4153,22 @@ Because operator new and delete are global, the proposed resolution was changed from "non-member" to "global or non-member.


    -

    148. Functions in the example facet BoolNames should be const

    -Section: 22.2.8 [lib.facets.examples]  Status: TC  Submitter: Jeremy Siek  Date: 3 Jun 1999

    -

    In 22.2.8 [lib.facets.examples] paragraph 13, the do_truename() and +

    148. Functions in the example facet BoolNames should be const

    Section: 22.2.8 [lib.facets.examples]  Status: TC  Submitter: Jeremy Siek  Date: 3 Jun 1999

    +

    In 22.2.8 [lib.facets.examples] paragraph 13, the do_truename() and do_falsename() functions in the example facet BoolNames should be const. The functions they are overriding in numpunct_byname<char> are const.

    Proposed resolution:

    -

    In 22.2.8 [lib.facets.examples] paragraph 13, insert "const" in +

    In 22.2.8 [lib.facets.examples] paragraph 13, insert "const" in two places:

    string do_truename() const { return "Oui Oui!"; }
    string do_falsename() const { return "Mais Non!"; }


    -

    150. Find_first_of says integer instead of iterator

    -Section: 25.1.4 [lib.alg.find.first.of]  Status: TC  Submitter: Matt McClure  Date: 30 Jun 1999

    +

    150. Find_first_of says integer instead of iterator

    Section: 25.1.4 [lib.alg.find.first.of]  Status: TC  Submitter: Matt McClure  Date: 30 Jun 1999

    Proposed resolution:

    -

    Change 25.1.4 [lib.alg.find.first.of] paragraph 2 from:

    +

    Change 25.1.4 [lib.alg.find.first.of] paragraph 2 from:

    Returns: The first iterator i in the range [first1, last1) such @@ -3771,8 +4182,7 @@ that for some integer j in the range [first2, last2) ...

    that for some iterator j in the range [first2, last2) ...


    -

    151. Can't currently clear() empty container

    -Section: 23.1.1 [lib.sequence.reqmts]  Status: TC  Submitter: Ed Brey  Date: 21 Jun 1999

    +

    151. Can't currently clear() empty container

    Section: 23.1.1 [lib.sequence.reqmts]  Status: TC  Submitter: Ed Brey  Date: 21 Jun 1999

    For both sequences and associative containers, a.clear() has the semantics of erase(a.begin(),a.end()), which is undefined for an empty container since erase(q1,q2) requires that q1 be dereferenceable @@ -3795,8 +4205,7 @@ iterators or certain kinds of iterators is unnecessary.

    to:

    p denotes a valid iterator to a, q denotes a valid dereferenceable iterator to a, [q1, q2) denotes a valid range - in a -

    + in a

    In 23.1.2, paragraph 7, change:

    @@ -3806,18 +4215,16 @@ iterators or certain kinds of iterators is unnecessary.

    to

    p is a valid iterator to a, q is a valid dereferenceable iterator to a, [q1, q2) is a valid range - into a -

    + into a


    -

    152. Typo in scan_is() semantics

    -Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    152. Typo in scan_is() semantics

    Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The semantics of scan_is() (paragraphs 4 and 6) is not exactly described because there is no function is() which only takes a character as argument. Also, in the effects clause (paragraph 3), the semantic is also kept vague.

    Proposed resolution:

    -

    In 22.2.1.1.2 [lib.locale.ctype.virtuals] paragraphs 4 and 6, change the returns +

    In 22.2.1.1.2 [lib.locale.ctype.virtuals] paragraphs 4 and 6, change the returns clause from:

    "... such that is(*p) @@ -3826,8 +4233,7 @@ would..."

    to:  "... such that is(m, *p) would...."


    -

    153. Typo in narrow() semantics

    -Section: 22.2.1.3.2 [lib.facet.ctype.char.members]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    153. Typo in narrow() semantics

    Section: 22.2.1.3.2 [lib.facet.ctype.char.members]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The description of the array version of narrow() (in paragraph 11) is flawed: There is no member do_narrow() which takes only three arguments because in addition to the range a default @@ -3838,7 +4244,7 @@ two signatures followed by a Returns clause that only addresses one of them.

    Proposed resolution:

    -

    Change the returns clause in 22.2.1.3.2 [lib.facet.ctype.char.members] +

    Change the returns clause in 22.2.1.3.2 [lib.facet.ctype.char.members] paragraph 10 from:

        Returns: do_widen(low, high, to).

    @@ -3846,7 +4252,7 @@ paragraph 10 from:

        Returns: do_widen(c) or do_widen(low, high, to), respectively.

    -

    Change 22.2.1.3.2 [lib.facet.ctype.char.members] paragraph 10 and 11 from:

    +

    Change 22.2.1.3.2 [lib.facet.ctype.char.members] paragraph 10 and 11 from:

            char        narrow(char c, char /*dfault*/) const;
             const char* narrow(const char* low, const char* high,
                                char /*dfault*/, char* to) const;
    @@ -3868,53 +4274,48 @@ version..." comment above. Perhaps it was a circuitous way of saying "dfault" needed to be uncommented?]

    [Post-Toronto: the issues list maintainer has merged in the -proposed resolution from issue 207, which addresses the +proposed resolution from issue 207, which addresses the same paragraphs.]


    -

    154. Missing double specifier for do_get() -

    -Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    154. Missing double specifier for do_get() +

    Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The table in paragraph 7 for the length modifier does not list the length modifier l to be applied if the type is double. Thus, the standard asks the implementation to do undefined things when using scanf() (the missing length modifier for scanf() when scanning doubles is actually a problem I found quite often in production code, too).

    Proposed resolution:

    -

    In 22.2.2.1.2 [lib.facet.num.get.virtuals], paragraph 7, add a row in the Length +

    In 22.2.2.1.2 [lib.facet.num.get.virtuals], paragraph 7, add a row in the Length Modifier table to say that for double a length modifier l is to be used.

    Rationale:

    The standard makes an embarrassing beginner's mistake.


    155. Typo in naming the class defining the class Init -

    -Section: 27.3 [lib.iostream.objects]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Section: 27.3 [lib.iostream.objects]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    There are conflicting statements about where the class -Init is defined. According to 27.3 [lib.iostream.objects] paragraph 2 -it is defined as basic_ios::Init, according to 27.4.2 [lib.ios.base] it is defined as ios_base::Init.

    +Init is defined. According to 27.3 [lib.iostream.objects] paragraph 2 +it is defined as basic_ios::Init, according to 27.4.2 [lib.ios.base] it is defined as ios_base::Init.

    Proposed resolution:

    -

    Change 27.3 [lib.iostream.objects] paragraph 2 from +

    Change 27.3 [lib.iostream.objects] paragraph 2 from "basic_ios::Init" to "ios_base::Init".

    Rationale:

    Although not strictly wrong, the standard was misleading enough to warrant the change.


    -

    156. Typo in imbue() description

    -Section: 27.4.2.3 [lib.ios.base.locales]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    156. Typo in imbue() description

    Section: 27.4.2.3 [lib.ios.base.locales]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    There is a small discrepancy between the declarations of -imbue(): in 27.4.2 [lib.ios.base] the argument is passed as -locale const& (correct), in 27.4.2.3 [lib.ios.base.locales] it +imbue(): in 27.4.2 [lib.ios.base] the argument is passed as +locale const& (correct), in 27.4.2.3 [lib.ios.base.locales] it is passed as locale const (wrong).

    Proposed resolution:

    -

    In 27.4.2.3 [lib.ios.base.locales] change the imbue argument +

    In 27.4.2.3 [lib.ios.base.locales] change the imbue argument from "locale const" to "locale -const&". -

    +const&".


    158. Underspecified semantics for setbuf() -

    -Section: 27.5.2.4.2 [lib.streambuf.virt.buffer]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Section: 27.5.2.4.2 [lib.streambuf.virt.buffer]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The default behavior of setbuf() is described only for the situation that gptr() != 0 && gptr() != egptr(): namely to do nothing. What has to be done in other situations  @@ -3926,12 +4327,11 @@ buffer management of derived classes unless these classes do it themselves, the default behavior of setbuf() should always be to do nothing.

    Proposed resolution:

    -

    Change 27.5.2.4.2 [lib.streambuf.virt.buffer], paragraph 3, Default behavior, +

    Change 27.5.2.4.2 [lib.streambuf.virt.buffer], paragraph 3, Default behavior, to: "Default behavior: Does nothing. Returns this."


    159. Strange use of underflow() -

    -Section: 27.5.2.4.3 [lib.streambuf.virt.get]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Section: 27.5.2.4.3 [lib.streambuf.virt.get]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The description of the meaning of the result of showmanyc() seems to be rather strange: It uses calls to underflow(). Using underflow() is strange because @@ -3939,20 +4339,19 @@ this function only reads the current character but does not extract it, uflow() would extract the current character. This should be fixed to use sbumpc() instead.

    Proposed resolution:

    -

    Change 27.5.2.4.3 [lib.streambuf.virt.get] paragraph 1, +

    Change 27.5.2.4.3 [lib.streambuf.virt.get] paragraph 1, showmanyc()returns clause, by replacing the word "supplied" with the words "extracted from the stream".


    160. Typo: Use of non-existing function exception() -

    -Section: 27.6.1.1 [lib.istream]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Section: 27.6.1.1 [lib.istream]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The paragraph 4 refers to the function exception() which is not defined. Probably, the referred function is basic_ios<>::exceptions().

    Proposed resolution:

    -

    In 27.6.1.1 [lib.istream], 27.6.1.3 [lib.istream.unformatted], paragraph 1, -27.6.2.1 [lib.ostream], paragraph 3, and 27.6.2.5.1 [lib.ostream.formatted.reqmts], +

    In 27.6.1.1 [lib.istream], 27.6.1.3 [lib.istream.unformatted], paragraph 1, +27.6.2.1 [lib.ostream], paragraph 3, and 27.6.2.5.1 [lib.ostream.formatted.reqmts], paragraph 1, change "exception()" to "exceptions()".

    @@ -3960,13 +4359,12 @@ paragraph 1, change "exception()" to is the correct spelling.]


    161. Typo: istream_iterator vs. istreambuf_iterator -

    -Section: 27.6.1.2.2 [lib.istream.formatted.arithmetic]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Section: 27.6.1.2.2 [lib.istream.formatted.arithmetic]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The note in the second paragraph pretends that the first argument is an object of type istream_iterator. This is wrong: It is an object of type istreambuf_iterator.

    Proposed resolution:

    -

    Change 27.6.1.2.2 [lib.istream.formatted.arithmetic] from:

    +

    Change 27.6.1.2.2 [lib.istream.formatted.arithmetic] from:

    The first argument provides an object of the istream_iterator class...

    @@ -3975,9 +4373,8 @@ an object of type istreambuf_iterator.

    The first argument provides an object of the istreambuf_iterator class...


    -

    164. do_put() has apparently unused fill argument

    -Section: 22.2.5.3.2 [lib.locale.time.put.virtuals]  Status: TC  Submitter: Angelika Langer  Date: 23 Jul 1999

    -

    In 22.2.5.3.2 [lib.locale.time.put.virtuals] the do_put() function is specified +

    164. do_put() has apparently unused fill argument

    Section: 22.2.5.3.2 [lib.locale.time.put.virtuals]  Status: TC  Submitter: Angelika Langer  Date: 23 Jul 1999

    +

    In 22.2.5.3.2 [lib.locale.time.put.virtuals] the do_put() function is specified as taking a fill character as an argument, but the description of the function does not say whether the character is used at all and, if so, in which way. The same holds for any format control parameters that @@ -3987,7 +4384,7 @@ character in any way? In any case, the specification of time_put.do_put() looks inconsistent to me.

    Is the signature of do_put() wrong, or is the effects clause incomplete?

    Proposed resolution:

    -

    Add the following note after 22.2.5.3.2 [lib.locale.time.put.virtuals] +

    Add the following note after 22.2.5.3.2 [lib.locale.time.put.virtuals] paragraph 2:

    [Note: the fill argument may be used in the implementation-defined formats, or by derivations. A space character is a reasonable default @@ -3998,8 +4395,7 @@ paragraph 2:

    users need some guidance on what to pass for the fill argument since the standard doesn't say how it's used.


    -

    165. xsputn(), pubsync() never called by basic_ostream members?

    -Section: 27.6.2.1 [lib.ostream]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    165. xsputn(), pubsync() never called by basic_ostream members?

    Section: 27.6.2.1 [lib.ostream]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    Paragraph 2 explicitly states that none of the basic_ostream functions falling into one of the groups "formatted output functions" and "unformatted output functions" calls any stream buffer function @@ -4045,13 +4441,77 @@ necessary be explicitly spelling out what virtuals are allowed to be called from what functions and eg to state specifically that flush() is allowed to call sync() while other functions are not.]


    -

    168. Typo: formatted vs. unformatted

    -Section: 27.6.2.6 [lib.ostream.unformatted]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    167. Improper use of traits_type::length() +

    Section: 27.6.2.5.4 [lib.ostream.inserters.character]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Paragraph 4 states that the length is determined using +traits::length(s). Unfortunately, this function is not +defined for example if the character type is wchar_t and the +type of s is char const*. Similar problems exist if +the character type is char and the type of s is +either signed char const* or unsigned char +const*.

    +

    Proposed resolution:

    +

    Change 27.6.2.5.4 [lib.ostream.inserters.character] paragraph 4 from:

    +
    +

    Effects: Behaves like an formatted inserter (as described in + lib.ostream.formatted.reqmts) of out. After a sentry object is + constructed it inserts characters. The number of characters starting + at s to be inserted is traits::length(s). Padding is determined as + described in lib.facet.num.put.virtuals. The traits::length(s) + characters starting at s are widened using out.widen + (lib.basic.ios.members). The widened characters and any required + padding are inserted into out. Calls width(0).

    +
    +

    to:

    +
    +

    Effects: Behaves like a formatted inserter (as described in + lib.ostream.formatted.reqmts) of out. After a sentry object is + constructed it inserts n characters starting at s, + where n is the number that would be computed as if by:

    +
      +
    • traits::length(s) for the overload where the first argument is of + type basic_ostream<charT, traits>& and the second is + of type const charT*, and also for the overload where the first + argument is of type basic_ostream<char, traits>& and + the second is of type const char*.
    • +
    • std::char_traits<char>::length(s) + for the overload where the first argument is of type + basic_ostream<charT, traits>& and the second is of type + const char*.
    • +
    • traits::length(reinterpret_cast<const char*>(s)) + for the other two overloads.
    • +
    +

    Padding is determined as described in + lib.facet.num.put.virtuals. The n characters starting at + s are widened using out.widen (lib.basic.ios.members). The + widened characters and any required padding are inserted into + out. Calls width(0).

    +
    + +

    [Santa Cruz: Matt supplied new wording]

    + +

    [Kona: changed "where n is" to " where n is the + number that would be computed as if by"]

    + +

    Rationale:

    +

    We have five separate cases. In two of them we can use the +user-supplied traits class without any fuss. In the other three we +try to use something as close to that user-supplied class as possible. +In two cases we've got a traits class that's appropriate for +char and what we've got is a const signed char* or a const +unsigned char*; that's close enough so we can just use a reinterpret +cast, and continue to use the user-supplied traits class. Finally, +there's one case where we just have to give up: where we've got a +traits class for some arbitrary charT type, and we somehow have to +deal with a const char*. There's nothing better to do but fall back +to char_traits<char>

    +
    +

    168. Typo: formatted vs. unformatted

    Section: 27.6.2.6 [lib.ostream.unformatted]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    The first paragraph begins with a descriptions what has to be done in formatted output functions. Probably this is a typo and the paragraph really want to describe unformatted output functions...

    Proposed resolution:

    -

    In 27.6.2.6 [lib.ostream.unformatted] paragraph 1, the first and last +

    In 27.6.2.6 [lib.ostream.unformatted] paragraph 1, the first and last sentences, change the word "formatted" to "unformatted":

    @@ -4060,19 +4520,18 @@ sentences, change the word "formatted" to function."


    -

    169. Bad efficiency of overflow() mandated

    -Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    169. Bad efficiency of overflow() mandated

    Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    Paragraph 8, Notes, of this section seems to mandate an extremely inefficient way of buffer handling for basic_stringbuf, especially in view of the restriction that basic_ostream -member functions are not allowed to use xsputn() (see 27.6.2.1 [lib.ostream]): For each character to be inserted, a new buffer +member functions are not allowed to use xsputn() (see 27.6.2.1 [lib.ostream]): For each character to be inserted, a new buffer is to be created.

    Of course, the resolution below requires some handling of simultaneous input and output since it is no longer possible to update egptr() whenever epptr() is changed. A possible solution is to handle this in underflow().

    Proposed resolution:

    -

    In 27.7.1.3 [lib.stringbuf.virtuals] paragraph 8, Notes, insert the words +

    In 27.7.1.3 [lib.stringbuf.virtuals] paragraph 8, Notes, insert the words "at least" as in the following:

    To make a write position available, the function reallocates (or initially @@ -4082,25 +4541,23 @@ solution is to handle this in underflow().


    170. Inconsistent definition of traits_type -

    -Section: 27.7.4 [lib.stringstream]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    -

    The classes basic_stringstream (27.7.4 [lib.stringstream]), -basic_istringstream (27.7.2 [lib.istringstream]), and -basic_ostringstream (27.7.3 [lib.ostringstream]) are inconsistent +

    Section: 27.7.4 [lib.stringstream]  Status: TC  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    The classes basic_stringstream (27.7.4 [lib.stringstream]), +basic_istringstream (27.7.2 [lib.istringstream]), and +basic_ostringstream (27.7.3 [lib.ostringstream]) are inconsistent in their definition of the type traits_type: For istringstream, this type is defined, for the other two it is not. This should be consistent.

    Proposed resolution:

    Proposed resolution:

    To the declarations of -basic_ostringstream (27.7.3 [lib.ostringstream]) and -basic_stringstream (27.7.4 [lib.stringstream]) add:

    +basic_ostringstream (27.7.3 [lib.ostringstream]) and +basic_stringstream (27.7.4 [lib.stringstream]) add:

    typedef traits traits_type;

    -

    171. Strange seekpos() semantics due to joint position

    -Section: 27.8.1.4 [lib.filebuf.virtuals]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    -

    Overridden virtual functions, seekpos()

    In 27.8.1.1 [lib.filebuf] paragraph 3, it is stated that a joint input and +

    171. Strange seekpos() semantics due to joint position

    Section: 27.8.1.4 [lib.filebuf.virtuals]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Jul 1999

    +

    Overridden virtual functions, seekpos()

    In 27.8.1.1 [lib.filebuf] paragraph 3, it is stated that a joint input and output position is maintained by basic_filebuf. Still, the description of seekpos() seems to talk about different file positions. In particular, it is unclear (at least to me) what is @@ -4152,19 +4609,17 @@ paragraph 14 from:

    [Post-Tokyo: Dietmar supplied the above wording.]


    172. Inconsistent types for basic_istream::ignore() -

    -Section: 27.6.1.3 [lib.istream.unformatted]  Status: TC  Submitter: Greg Comeau, Dietmar Kühl  Date: 23 Jul 1999

    -

    In 27.6.1.1 [lib.istream] the function +

    Section: 27.6.1.3 [lib.istream.unformatted]  Status: TC  Submitter: Greg Comeau, Dietmar Kühl  Date: 23 Jul 1999

    +

    In 27.6.1.1 [lib.istream] the function ignore() gets an object of type streamsize as first -argument. However, in 27.6.1.3 [lib.istream.unformatted] -paragraph 23 the first argument is of type int. -

    +argument. However, in 27.6.1.3 [lib.istream.unformatted] +paragraph 23 the first argument is of type int.

    As far as I can see this is not really a contradiction because everything is consistent if streamsize is typedef to be int. However, this is almost certainly not what was intended. The same thing happened to basic_filebuf::setbuf(), -as described in issue 173.

    +as described in issue 173.

    Darin Adler also submitted this issue, commenting: Either 27.6.1.1 should be modified @@ -4172,18 +4627,17 @@ to show a first parameter of type int, or 27.6.1.3 should be modified to show a first parameter of type streamsize and use numeric_limits<streamsize>::max.

    Proposed resolution:

    -

    In 27.6.1.3 [lib.istream.unformatted] paragraph 23 and 24, change both uses +

    In 27.6.1.3 [lib.istream.unformatted] paragraph 23 and 24, change both uses of int in the description of ignore() to streamsize.


    173. Inconsistent types for basic_filebuf::setbuf() -

    -Section: 27.8.1.4 [lib.filebuf.virtuals]  Status: TC  Submitter: Greg Comeau, Dietmar Kühl  Date: 23 Jul 1999

    +

    Section: 27.8.1.4 [lib.filebuf.virtuals]  Status: TC  Submitter: Greg Comeau, Dietmar Kühl  Date: 23 Jul 1999

    -In 27.8.1.1 [lib.filebuf] the function setbuf() gets an +In 27.8.1.1 [lib.filebuf] the function setbuf() gets an object of type streamsize as second argument. However, in -27.8.1.4 [lib.filebuf.virtuals] paragraph 9 the second argument is of type +27.8.1.4 [lib.filebuf.virtuals] paragraph 9 the second argument is of type int.

    @@ -4192,28 +4646,25 @@ As far as I can see this is not really a contradiction because everything is consistent if streamsize is typedef to be int. However, this is almost certainly not what was intended. The same thing happened to basic_istream::ignore(), -as described in issue 172. +as described in issue 172.

    Proposed resolution:

    -

    In 27.8.1.4 [lib.filebuf.virtuals] paragraph 9, change all uses of +

    In 27.8.1.4 [lib.filebuf.virtuals] paragraph 9, change all uses of int in the description of setbuf() to streamsize.


    174. Typo: OFF_T vs. POS_T -

    -Section: D.6 [depr.ios.members]  Status: TC  Submitter: Dietmar Kühl  Date: 23 Jul 1999

    +

    Section: D.6 [depr.ios.members]  Status: TC  Submitter: Dietmar Kühl  Date: 23 Jul 1999

    According to paragraph 1 of this section, streampos is the type OFF_T, the same type as streamoff. However, in -paragraph 6 the streampos gets the type POS_T -

    +paragraph 6 the streampos gets the type POS_T

    Proposed resolution:

    -

    Change D.6 [depr.ios.members] paragraph 1 from "typedef +

    Change D.6 [depr.ios.members] paragraph 1 from "typedef OFF_T streampos;" to "typedef POS_T streampos;"


    -

    175. Ambiguity for basic_streambuf::pubseekpos() and a few other functions.

    -Section: D.6 [depr.ios.members]  Status: TC  Submitter: Dietmar Kühl  Date: 23 Jul 1999

    +

    175. Ambiguity for basic_streambuf::pubseekpos() and a few other functions.

    Section: D.6 [depr.ios.members]  Status: TC  Submitter: Dietmar Kühl  Date: 23 Jul 1999

    According to paragraph 8 of this section, the methods basic_streambuf::pubseekpos(), basic_ifstream::open(), and basic_ofstream::open @@ -4226,26 +4677,23 @@ three cases. However, this generates an ambiguity with the overloaded version because now the arguments are absolutely identical if the last argument is not specified.

    Proposed resolution:

    -

    In D.6 [depr.ios.members] paragraph 8, remove the default arguments for +

    In D.6 [depr.ios.members] paragraph 8, remove the default arguments for basic_streambuf::pubseekpos(), basic_ifstream::open(), and -basic_ofstream::open(). -

    +basic_ofstream::open().


    -

    176. exceptions() in ios_base...?

    -Section: D.6 [depr.ios.members]  Status: TC  Submitter: Dietmar Kühl  Date: 23 Jul 1999

    +

    176. exceptions() in ios_base...?

    Section: D.6 [depr.ios.members]  Status: TC  Submitter: Dietmar Kühl  Date: 23 Jul 1999

    The "overload" for the function exceptions() in paragraph 8 gives the impression that there is another function of this function defined in class ios_base. However, this is not the case. Thus, it is hard to tell how the semantics (paragraph 9) can be implemented: "Call the corresponding member function specified -in clause 27 [lib.input.output]."

    +in clause 27 [lib.input.output]."

    Proposed resolution:

    -

    In D.6 [depr.ios.members] paragraph 8, move the declaration of the +

    In D.6 [depr.ios.members] paragraph 8, move the declaration of the function exceptions()into class basic_ios.


    -

    179. Comparison of const_iterators to iterators doesn't work

    -Section: 23.1 [lib.container.requirements]  Status: WP  Submitter: Judy Ward  Date: 2 Jul 1998

    +

    179. Comparison of const_iterators to iterators doesn't work

    Section: 23.1 [lib.container.requirements]  Status: WP  Submitter: Judy Ward  Date: 2 Jul 1998

    Currently the following will not compile on two well-known standard library implementations:

    @@ -4297,7 +4745,8 @@ return i == ci; The fix is to make the comparison operators templated on two types.

    -
        template <class Iterator1, class Iterator2>
    +    
    +    template <class Iterator1, class Iterator2>
         bool operator== (reverse_iterator<Iterator1> const& x,
                          reverse_iterator<Iterator2> const& y);
         
    @@ -4318,10 +4767,11 @@ return i == ci;

    Proposed resolution:

    -

    Insert this paragraph after 23.1 [lib.container.requirements] paragraph 7:

    +

    Insert this paragraph after 23.1 [lib.container.requirements] paragraph 7:

    In the expressions

    -
        i == j
    +  
    +    i == j
         i != j
         i < j
         i <= j
    @@ -4349,11 +4799,10 @@ the nested types X::iterator and X::const_iterator,
     where X is a container.  There is no requirement that
     X::reverse_iterator and X::const_reverse_iterator
     can be mixed.  If mixing them is considered important, that's a
    -separate issue.  (Issue 280.)
    +separate issue.  (Issue 280.)
     


    -

    181. make_pair() unintended behavior

    -Section: 20.2.2 [lib.pairs]  Status: TC  Submitter: Andrew Koenig  Date: 3 Aug 1999

    +

    181. make_pair() unintended behavior

    Section: 20.2.2 [lib.pairs]  Status: TC  Submitter: Andrew Koenig  Date: 3 Aug 1999

    The claim has surfaced in Usenet that expressions such as

           make_pair("abc", 3)
    @@ -4364,7 +4813,7 @@ parameter to const char (&)[4], which type is uncopyable.
    I doubt anyone intended that behavior...

    Proposed resolution:

    -

    In 20.2 [lib.utility], paragraph 1 change the following +

    In 20.2 [lib.utility], paragraph 1 change the following declaration of make_pair():

    template <class T1, class T2> pair<T1,T2> make_pair(const T1&, const T2&);
    @@ -4373,7 +4822,7 @@ declaration of make_pair():

    template <class T1, class T2> pair<T1,T2> make_pair(T1, T2);
    -

    In 20.2.2 [lib.pairs] paragraph 7 and the line before, change:

    +

    In 20.2.2 [lib.pairs] paragraph 7 and the line before, change:

    template <class T1, class T2>
     pair<T1, T2> make_pair(const T1& x, const T2& y);
    @@ -4391,7 +4840,7 @@ pair<T1, T2> make_pair(T1 x, T2 y);

    Rationale:

    Two potential fixes were suggested by Matt Austern and Dietmar -Kühl, respectively, 1) overloading with array arguments, and 2) use of +Kühl, respectively, 1) overloading with array arguments, and 2) use of a reference_traits class with a specialization for arrays. Andy Koenig suggested changing to pass by value. In discussion, it appeared that this was a much smaller change to the standard that the other two @@ -4399,19 +4848,18 @@ suggestions, and any efficiency concerns were more than offset by the advantages of the solution. Two implementors reported that the proposed resolution passed their test suites.


    -

    182. Ambiguous references to size_t

    -Section: 17 [lib.library]  Status: WP  Submitter: Al Stevens  Date: 15 Aug 1999

    +

    182. Ambiguous references to size_t

    Section: 17 [lib.library]  Status: WP  Submitter: Al Stevens  Date: 15 Aug 1999

    Many references to size_t throughout the document omit the std:: namespace qualification.

    For -example, 17.4.3.4 [lib.replacement.functions] paragraph 2:

    +example, 17.4.3.4 [lib.replacement.functions] paragraph 2:

    -
    — operator new(size_t)
    -— operator new(size_t, const std::nothrow_t&)
    -— operator new[](size_t)
    -— operator new[](size_t, const std::nothrow_t&)
    +
    — operator new(size_t)
    +— operator new(size_t, const std::nothrow_t&)
    +— operator new[](size_t)
    +— operator new[](size_t, const std::nothrow_t&)

    Proposed resolution:

    -

    In 17.4.3.4 [lib.replacement.functions] paragraph 2: replace:

    +

    In 17.4.3.4 [lib.replacement.functions] paragraph 2: replace:

    - operator new(size_t)
    - operator new(size_t, const std::nothrow_t&)
    @@ -4474,8 +4922,7 @@ X::length(p): "size_t" by "std::size_t".

        typedef ptrdiff_t difference_type;
    by:
        typedef std::ptrdiff_t difference_type;

    -

    In [lib.locale.ctype] 22.2.1.1 put namespace std { ...} around the -declaration of template <class charT> class ctype.
    +

    In [lib.locale.ctype] 22.2.1.1 put namespace std { ...} around the declaration of template <class charT> class ctype.

    In [lib.iterator.traits] 24.3.1, paragraph 2 put namespace std { ...} around the declaration of:

    @@ -4486,7 +4933,7 @@ declaration of template <class charT> class ctype.

    The LWG believes correcting names like size_t and ptrdiff_t to std::size_t and std::ptrdiff_t to be essentially editorial. There there can't be another size_t or -ptrdiff_t meant anyway because, according to 17.4.3.1.4 [lib.extern.types],

    +ptrdiff_t meant anyway because, according to 17.4.3.1.4 [lib.extern.types],

    For each type T from the Standard C library, the types ::T and std::T @@ -4500,7 +4947,7 @@ Editor's authority to make this change.

    [Post-Tokyo: Nico Josuttis provided the above wording at the request of the LWG.]

    -

    [Toronto: This is tangentially related to issue 229, but only tangentially: the intent of this issue is to +

    [Toronto: This is tangentially related to issue 229, but only tangentially: the intent of this issue is to address use of the name size_t in contexts outside of namespace std, such as in the description of ::operator new. The proposed changes should be reviewed to make sure they are @@ -4510,9 +4957,8 @@ correct.]

    them to be correct.]


    -

    183. I/O stream manipulators don't work for wide character streams

    -Section: 27.6.3 [lib.std.manip]  Status: WP  Submitter: Andy Sawyer  Date: 7 Jul 1999

    -

    27.6.3 [lib.std.manip] paragraph 3 says (clause numbering added for +

    183. I/O stream manipulators don't work for wide character streams

    Section: 27.6.3 [lib.std.manip]  Status: WP  Submitter: Andy Sawyer  Date: 7 Jul 1999

    +

    27.6.3 [lib.std.manip] paragraph 3 says (clause numbering added for exposition):

    Returns: An object s of unspecified type such that if [1] out is an (instance @@ -4540,31 +4986,21 @@ ostreams.

    that the value of the expression is "the same specialization of basic_ostream as out"&

    Proposed resolution:

    -

    Replace section 27.6.3 [lib.std.manip] except paragraph 1 with the +

    Replace section 27.6.3 [lib.std.manip] except paragraph 1 with the following:

    -

    2- The type designated smanip in each of the following function -descriptions is implementation-specified and may be different for each +

    2- The type designated smanip in each of the following function descriptions is implementation-specified and may be different for each function.

    smanip resetiosflags(ios_base::fmtflags mask);

    --3- Returns: An object s of unspecified type such that if out is an -instance of basic_ostream<charT,traits> then the expression -out<<s behaves -as if f(s, mask) were called, or if in is an instance of -basic_istream<charT,traits> then the expression in>>s -behaves as if +-3- Returns: An object s of unspecified type such that if out is an instance of basic_ostream<charT,traits> then the expression out<<s behaves +as if f(s, mask) were called, or if in is an instance of basic_istream<charT,traits> then the expression in>>s behaves as if f(s, mask) were called. The function f can be defined as:*

    -[Footnote: The expression cin >> resetiosflags(ios_base::skipws) -clears ios_base::skipws in the format flags stored in the -basic_istream<charT,traits> object cin (the same as cin >> -noskipws), and the expression cout << -resetiosflags(ios_base::showbase) clears -ios_base::showbase in the format flags stored in the -basic_ostream<charT,traits> object cout (the same as cout -<< +[Footnote: The expression cin >> resetiosflags(ios_base::skipws) clears ios_base::skipws in the format flags stored in the +basic_istream<charT,traits> object cin (the same as cin >> noskipws), and the expression cout << resetiosflags(ios_base::showbase) clears +ios_base::showbase in the format flags stored in the basic_ostream<charT,traits> object cout (the same as cout << noshowbase). --- end footnote]

         ios_base& f(ios_base& str, ios_base::fmtflags mask)
    @@ -4579,12 +5015,8 @@ The expression in>>s has type basic_istream<charT,traits>& and v
     smanip setiosflags(ios_base::fmtflags mask);

    --4- Returns: An object s of unspecified type such that if out is an -instance of basic_ostream<charT,traits> then the expression -out<<s behaves -as if f(s, mask) were called, or if in is an instance of -basic_istream<charT,traits> then the expression in>>s -behaves as if f(s, +-4- Returns: An object s of unspecified type such that if out is an instance of basic_ostream<charT,traits> then the expression out<<s behaves +as if f(s, mask) were called, or if in is an instance of basic_istream<charT,traits> then the expression in>>s behaves as if f(s, mask) were called. The function f can be defined as:

         ios_base& f(ios_base& str, ios_base::fmtflags mask)
    @@ -4599,12 +5031,8 @@ The expression in>>s has type basic_istream<charT,traits>& and v
    smanip setbase(int base);

    --5- Returns: An object s of unspecified type such that if out is an -instance of basic_ostream<charT,traits> then the expression -out<<s behaves -as if f(s, base) were called, or if in is an instance of -basic_istream<charT,traits> then the expression in>>s -behaves as if f(s, +-5- Returns: An object s of unspecified type such that if out is an instance of basic_ostream<charT,traits> then the expression out<<s behaves +as if f(s, base) were called, or if in is an instance of basic_istream<charT,traits> then the expression in>>s behaves as if f(s, base) were called. The function f can be defined as:

         ios_base& f(ios_base& str, int base)
    @@ -4622,11 +5050,8 @@ The expression in>>s has type basic_istream<charT,traits>& and v
    smanip setfill(char_type c);

    --6- Returns: An object s of unspecified type such that if out is (or is -derived from) basic_ostream<charT,traits> and c has type charT -then the -expression out<<s behaves as if f(s, c) were called. The function -f can be +-6- Returns: An object s of unspecified type such that if out is (or is derived from) basic_ostream<charT,traits> and c has type charT then the +expression out<<s behaves as if f(s, c) were called. The function f can be defined as:

          template<class charT, class traits>
    @@ -4641,12 +5066,8 @@ The expression out<<s has type basic_ostream<charT,traits>& and
    smanip setprecision(int n);

    --7- Returns: An object s of unspecified type such that if out is an -instance of basic_ostream<charT,traits> then the expression -out<<s behaves -as if f(s, n) were called, or if in is an instance of -basic_istream<charT,traits> then the expression in>>s -behaves as if f(s, n) +-7- Returns: An object s of unspecified type such that if out is an instance of basic_ostream<charT,traits> then the expression out<<s behaves +as if f(s, n) were called, or if in is an instance of basic_istream<charT,traits> then the expression in>>s behaves as if f(s, n) were called. The function f can be defined as:

          ios_base& f(ios_base& str, int n)
    @@ -4661,12 +5082,8 @@ The expression in>>s has type basic_istream<charT,traits>& and v .
    smanip setw(int n);

    --8- Returns: An object s of unspecified type such that if out is an -instance of basic_ostream<charT,traits> then the expression -out<<s behaves -as if f(s, n) were called, or if in is an instance of -basic_istream<charT,traits> then the expression in>>s -behaves as if f(s, n) +-8- Returns: An object s of unspecified type such that if out is an instance of basic_ostream<charT,traits> then the expression out<<s behaves +as if f(s, n) were called, or if in is an instance of basic_istream<charT,traits> then the expression in>>s behaves as if f(s, n) were called. The function f can be defined as:

          ios_base& f(ios_base& str, int n)
    @@ -4686,20 +5103,19 @@ in.

    [Kona: Andy Sawyer and Beman Dawes will work to improve the wording of the proposed resolution.]

    -

    [Tokyo - The LWG noted that issue 216 involves +

    [Tokyo - The LWG noted that issue 216 involves the same paragraphs.]

    [Post-Tokyo: The issues list maintainer combined the proposed -resolution of this issue with the proposed resolution for issue 216 as they both involved the same paragraphs, and were so +resolution of this issue with the proposed resolution for issue 216 as they both involved the same paragraphs, and were so intertwined that dealing with them separately appear fraught with error. The full text was supplied by Bill Plauger; it was cross checked against changes supplied by Andy Sawyer. It should be further checked by the LWG.]


    -

    184. numeric_limits<bool> wording problems

    -Section: 18.2.1.5 [lib.numeric.special]  Status: WP  Submitter: Gabriel Dos Reis  Date: 21 Jul 1999

    +

    184. numeric_limits<bool> wording problems

    Section: 18.2.1.5 [lib.numeric.special]  Status: WP  Submitter: Gabriel Dos Reis  Date: 21 Jul 1999

    bools are defined by the standard to be of integer types, as per -3.9.1 [basic.fundamental] paragraph 7. However "integer types" +3.9.1 [basic.fundamental] paragraph 7. However "integer types" seems to have a special meaning for the author of 18.2. The net effect is an unclear and confusing specification for numeric_limits<bool> as evidenced below.

    @@ -4737,7 +5153,7 @@ types with base representation other than 2.

    Furthermore, numeric_limits<bool>::is_modulo and numeric_limits<bool>::is_signed have similar problems.

    Proposed resolution:

    -

    Append to the end of 18.2.1.5 [lib.numeric.special]:

    +

    Append to the end of 18.2.1.5 [lib.numeric.special]:

    The specialization for bool shall be provided as follows:

        namespace std {
    @@ -4789,9 +5205,8 @@ resolution.]

    [Post-Tokyo:  At the request of the LWG in Tokyo, Nico Josuttis provided the above wording.]


    -

    185. Questionable use of term "inline"

    -Section: 20.3 [lib.function.objects]  Status: WP  Submitter: UK Panel  Date: 26 Jul 1999

    -

    Paragraph 4 of 20.3 [lib.function.objects] says:

    +

    185. Questionable use of term "inline"

    Section: 20.3 [lib.function.objects]  Status: WP  Submitter: UK Panel  Date: 26 Jul 1999

    +

    Paragraph 4 of 20.3 [lib.function.objects] says:

     [Example: To negate every element of a: transform(a.begin(), a.end(), a.begin(), negate<double>()); The corresponding functions will inline @@ -4816,17 +5231,17 @@ any "inlining" will take place in this case.

    Thus the example "mandates" behavior that is explicitly not required elsewhere.

    Proposed resolution:

    -

    In 20.3 [lib.function.objects] paragraph 1, remove the sentence:

    +

    In 20.3 [lib.function.objects] paragraph 1, remove the sentence:

    They are important for the effective use of the library.

    -

    Remove 20.3 [lib.function.objects] paragraph 2, which reads:

    +

    Remove 20.3 [lib.function.objects] paragraph 2, which reads:

    Using function objects together with function templates increases the expressive power of the library as well as making the resulting code much more efficient.

    -

    In 20.3 [lib.function.objects] paragraph 4, remove the sentence:

    +

    In 20.3 [lib.function.objects] paragraph 4, remove the sentence:

    The corresponding functions will inline the addition and the negation.

    @@ -4835,9 +5250,8 @@ not required elsewhere.

    [Kona: The LWG agreed there was a defect.]

    [Tokyo: The LWG crafted the proposed resolution.]


    -

    186. bitset::set() second parameter should be bool

    -Section: 23.3.5.2 [lib.bitset.members]  Status: WP  Submitter: Darin Adler  Date: 13 Aug 1999

    -

    In section 23.3.5.2 [lib.bitset.members], paragraph 13 defines the +

    186. bitset::set() second parameter should be bool

    Section: 23.3.5.2 [lib.bitset.members]  Status: WP  Submitter: Darin Adler  Date: 13 Aug 1999

    +

    In section 23.3.5.2 [lib.bitset.members], paragraph 13 defines the bitset::set operation to take a second parameter of type int. The function tests whether this value is non-zero to determine whether to set the bit to true or false. The type of this second parameter should @@ -4847,7 +5261,7 @@ possible to slice an integer that's larger than an int. This can't happen with bool, since conversion to bool has the semantic of translating 0 to false and any non-zero value to true.

    Proposed resolution:

    -

    In 23.3.5 [lib.template.bitset] Para 1 Replace:

    +

    In 23.3.5 [lib.template.bitset] Para 1 Replace:

    bitset<N>& set(size_t pos, int val = true ); 
    @@ -4855,7 +5269,7 @@ translating 0 to false and any non-zero value to true.

    bitset<N>& set(size_t pos, bool val = true );
    -

    In 23.3.5.2 [lib.bitset.members] Para 12(.5) Replace:

    +

    In 23.3.5.2 [lib.bitset.members] Para 12(.5) Replace:

    bitset<N>& set(size_t pos, int val = 1 );
    @@ -4868,15 +5282,13 @@ translating 0 to false and any non-zero value to true.

    on better P/R wording.]

    [Post-Tokyo: Andy provided the above wording.]

    Rationale:

    -

    -bool is a better choice. It is believed that binary +

    bool is a better choice. It is believed that binary compatibility is not an issue, because this member function is usually implemented as inline, and because it is already the case that users cannot rely on the type of a pointer to a nonvirtual member of a standard library class.


    -

    187. iter_swap underspecified

    -Section: 25.2.2 [lib.alg.swap]  Status: WP  Submitter: Andrew Koenig  Date: 14 Aug 1999

    +

    187. iter_swap underspecified

    Section: 25.2.2 [lib.alg.swap]  Status: WP  Submitter: Andrew Koenig  Date: 14 Aug 1999

    The description of iter_swap in 25.2.2 paragraph 7,says that it ``exchanges the values'' of the objects to which two iterators refer.

    What it doesn't say is whether it does so using swap @@ -4918,8 +5330,7 @@ which are no longer permitted.]

    to

    -

    -swap(*a, *b).

    +

    swap(*a, *b).

    Rationale:

    @@ -4933,8 +5344,7 @@ much more than exchanging the two iterators' values: it would change predecessor/successor relationships, possibly moving the iterator from one list to another. That would surely be inappropriate.


    -

    189. setprecision() not specified correctly

    -Section: 27.4.2.2 [lib.fmtflags.state]  Status: TC  Submitter: Andrew Koenig  Date: 25 Aug 1999

    +

    189. setprecision() not specified correctly

    Section: 27.4.2.2 [lib.fmtflags.state]  Status: TC  Submitter: Andrew Koenig  Date: 25 Aug 1999

    27.4.2.2 paragraph 9 claims that setprecision() sets the precision, and includes a parenthetical note saying that it is the number of digits after the decimal point.
    @@ -4947,11 +5357,10 @@ point.
    I would like the committee to look at the definition carefully and correct the statement in 27.4.2.2

    Proposed resolution:

    -

    Remove from 27.4.2.2 [lib.fmtflags.state], paragraph 9, the text +

    Remove from 27.4.2.2 [lib.fmtflags.state], paragraph 9, the text "(number of digits after the decimal point)".


    -

    193. Heap operations description incorrect

    -Section: 25.3.6 [lib.alg.heap.operations]  Status: TC  Submitter: Markus Mauhart  Date: 24 Sep 1999

    +

    193. Heap operations description incorrect

    Section: 25.3.6 [lib.alg.heap.operations]  Status: TC  Submitter: Markus Mauhart  Date: 24 Sep 1999

    25.3.6 [lib.alg.heap.operations] states two key properties of a heap [a,b), the first of them is

    @@ -4963,34 +5372,29 @@ resolution.

    A-"part of largest equivalence class" instead of "largest", cause 25.3 [lib.alg.sorting] asserts "strict weak ordering" for all its sub clauses.

    -

    B-Take -'an oldest' from that equivalence class, otherwise the heap functions -could not be used for a priority queue as explained in 23.2.3.2.2 -[lib.priqueue.members] (where I assume that a "priority queue" respects -priority AND time).

    +

    B-Take 'an oldest' from that equivalence class, otherwise the heap functions could not be used for a + priority queue as explained in 23.2.3.2.2 [lib.priqueue.members] (where I assume that a "priority queue" respects priority AND time).

    Proposed resolution:

    -

    Change 25.3.6 [lib.alg.heap.operations] property (1) from:

    +

    Change 25.3.6 [lib.alg.heap.operations] property (1) from:

    (1) *a is the largest element

    to:

    -

    (1) There is no element greater than *a -

    +

    (1) There is no element greater than *a


    -

    195. Should basic_istream::sentry's constructor ever set eofbit?

    -Section: 27.6.1.1.2 [lib.istream::sentry]  Status: TC  Submitter: Matt Austern  Date: 13 Oct 1999

    +

    195. Should basic_istream::sentry's constructor ever set eofbit?

    Section: 27.6.1.1.2 [lib.istream::sentry]  Status: TC  Submitter: Matt Austern  Date: 13 Oct 1999

    Suppose that is.flags() & ios_base::skipws is nonzero. What should basic_istream<>::sentry's constructor do if it reaches eof while skipping whitespace? 27.6.1.1.2/5 suggests it should set failbit. Should it set eofbit as well? The standard doesn't seem to answer that question.

    -

    On the one hand, nothing in 27.6.1.1.2 [lib.istream::sentry] says that +

    On the one hand, nothing in 27.6.1.1.2 [lib.istream::sentry] says that basic_istream<>::sentry should ever set eofbit. On the -other hand, 27.6.1.1 [lib.istream] paragraph 4 says that if +other hand, 27.6.1.1 [lib.istream] paragraph 4 says that if extraction from a streambuf "returns traits::eof(), then the input function, except as explicitly noted otherwise, completes its actions and does @@ -5029,8 +5433,7 @@ returns traits::eof(), the function calls


    -

    198. Validity of pointers and references unspecified after iterator destruction

    -Section: 24.1 [lib.iterator.requirements]  Status: WP  Submitter: Beman Dawes  Date: 3 Nov 1999

    +

    198. Validity of pointers and references unspecified after iterator destruction

    Section: 24.1 [lib.iterator.requirements]  Status: WP  Submitter: Beman Dawes  Date: 3 Nov 1999

    Is a pointer or reference obtained from an iterator still valid after destruction of the iterator? @@ -5040,7 +5443,8 @@ Is a pointer or reference obtained from an iterator still valid after the value of the iterator changes?

    -
    #include <iostream>
    +
    +#include <iostream>
     #include <vector>
     #include <iterator>
     
    @@ -5077,14 +5481,14 @@ elements of containers.

    The standard itself assumes that pointers and references obtained from an iterator are still valid after iterator destruction or -change. The definition of reverse_iterator::operator*(), 24.4.1.3.3 [lib.reverse.iter.op.star], which returns a reference, defines +change. The definition of reverse_iterator::operator*(), 24.4.1.3.3 [lib.reverse.iter.op.star], which returns a reference, defines effects:

    Iterator tmp = current;
     return *--tmp;
    -

    The definition of reverse_iterator::operator->(), 24.4.1.3.4 [lib.reverse.iter.opref], which returns a pointer, defines effects:

    +

    The definition of reverse_iterator::operator->(), 24.4.1.3.4 [lib.reverse.iter.opref], which returns a pointer, defines effects:

    return &(operator*());
    @@ -5095,17 +5499,18 @@ explicitly. This will also reduce the chance of user code breaking unexpectedly when porting to a different standard library implementation.

    Proposed resolution:

    -

    Add a new paragraph to 24.1 [lib.iterator.requirements]:

    +

    Add a new paragraph to 24.1 [lib.iterator.requirements]:

    Destruction of an iterator may invalidate pointers and references previously obtained from that iterator.
    -

    Replace paragraph 1 of 24.4.1.3.3 [lib.reverse.iter.op.star] with:

    +

    Replace paragraph 1 of 24.4.1.3.3 [lib.reverse.iter.op.star] with:

    Effects:

    -
      this->tmp = current;
    +
    +  this->tmp = current;
       --this->tmp;
       return *this->tmp;
     
    @@ -5114,7 +5519,7 @@ previously obtained from that iterator. [Note: This operation must use an auxiliary member variable, rather than a temporary variable, to avoid returning a reference that persists beyond the lifetime of its associated iterator. (See -24.1 [lib.iterator.requirements].) The name of this member variable is shown for +24.1 [lib.iterator.requirements].) The name of this member variable is shown for exposition only. --end note]

    @@ -5130,7 +5535,7 @@ reformulated yet again to reflect this reality.]

    assumes its underlying iterator has persistent pointers and references. Andy Koenig pointed out that it is possible to rewrite reverse_iterator so that it no longer makes such an assupmption. -However, this issue is related to issue 299. If we +However, this issue is related to issue 299. If we decide it is intentional that p[n] may return by value instead of reference when p is a Random Access Iterator, other changes in reverse_iterator will be necessary.]

    @@ -5153,8 +5558,7 @@ Clause 23 should be reviewed to make sure that guarantees for predefined iterators are as strong as users expect.


    -

    199. What does allocate(0) return?

    -Section: 20.1.5 [lib.allocator.requirements]  Status: TC  Submitter: Matt Austern  Date: 19 Nov 1999

    +

    199. What does allocate(0) return?

    Section: 20.1.5 [lib.allocator.requirements]  Status: TC  Submitter: Matt Austern  Date: 19 Nov 1999

    Suppose that A is a class that conforms to the Allocator requirements of Table 32, and a is an @@ -5176,8 +5580,7 @@ representation. Since this already implies special case code, it would be over-specification to mandate the return value.


    -

    200. Forward iterator requirements don't allow constant iterators

    -Section: 24.1.3 [lib.forward.iterators]  Status: WP  Submitter: Matt Austern  Date: 19 Nov 1999

    +

    200. Forward iterator requirements don't allow constant iterators

    Section: 24.1.3 [lib.forward.iterators]  Status: WP  Submitter: Matt Austern  Date: 19 Nov 1999

    In table 74, the return type of the expression *a is given as T&, where T is the iterator's value type. @@ -5199,7 +5602,7 @@ otherwise const U&".

    [Tokyo: The LWG believes this is the tip of a larger iceberg; there are multiple const problems with the STL portion of the library and that these should be addressed as a single package.  Note -that issue 180 has already been declared NAD Future for +that issue 180 has already been declared NAD Future for that very reason.]

    [Redmond: the LWG thinks this is separable from other constness @@ -5209,8 +5612,7 @@ modified: the original version only discussed *a. It was pointed out that we also need to worry about *r++ and a->m.]


    -

    202. unique() effects unclear when predicate not an equivalence relation

    -Section: 25.2.8 [lib.alg.unique]  Status: WP  Submitter: Andrew Koenig  Date: 13 Jan 2000

    +

    202. unique() effects unclear when predicate not an equivalence relation

    Section: 25.2.8 [lib.alg.unique]  Status: WP  Submitter: Andrew Koenig  Date: 13 Jan 2000

    What should unique() do if you give it a predicate that is not an equivalence relation? There are at least two plausible answers: @@ -5277,7 +5679,7 @@ In fact, the SGI implementation of unique() does neither: It yields 1, 3, 7.

    Proposed resolution:

    -

    Change 25.2.8 [lib.alg.unique] paragraph 1 to:

    +

    Change 25.2.8 [lib.alg.unique] paragraph 1 to:

    For a nonempty range, eliminates all but the first element from every consecutive group of equivalent elements referred to by the iterator @@ -5301,14 +5703,14 @@ pointed out that "i-1" is incorrect, since "i" can refer to the first iterator in the range. Matt provided wording to address this problem.]

    -

    [Curaçao: The LWG changed "... the range (first, +

    [Curaçao: The LWG changed "... the range (first, last)..." to "... the range [first+1, last)..." for clarity. They considered this change close enough to editorial to not require another round of review.]

    Rationale:

    The LWG also considered an alternative resolution: change -25.2.8 [lib.alg.unique] paragraph 1 to:

    +25.2.8 [lib.alg.unique] paragraph 1 to:

    For a nonempty range, eliminates all but the first element from every @@ -5331,8 +5733,7 @@ that the behavior of unique() for a non-equivalence relation is specified. Both resolutions are consistent with the behavior of existing implementations.


    -

    208. Unnecessary restriction on past-the-end iterators

    -Section: 24.1 [lib.iterator.requirements]  Status: TC  Submitter: Stephen Cleary  Date: 02 Feb 2000

    +

    208. Unnecessary restriction on past-the-end iterators

    Section: 24.1 [lib.iterator.requirements]  Status: TC  Submitter: Stephen Cleary  Date: 02 Feb 2000

    In 24.1 paragraph 5, it is stated ". . . Dereferenceable and past-the-end values are always non-singular."

    This places an unnecessary restriction on past-the-end iterators for @@ -5344,7 +5745,7 @@ without a "footer" node.

    This would have an impact on existing code that expects past-the-end iterators obtained from different (generic) containers being not equal.

    Proposed resolution:

    -

    Change 24.1 [lib.iterator.requirements] paragraph 5, the last sentence, from:

    +

    Change 24.1 [lib.iterator.requirements] paragraph 5, the last sentence, from:

    Dereferenceable and past-the-end values are always non-singular.

    @@ -5358,9 +5759,8 @@ zero-length vectors, null pointers are perfectly reasonable past-the-end iterators. Null pointers are singular.


    -

    209. basic_string declarations inconsistent

    -Section: 21.3 [lib.basic.string]  Status: TC  Submitter: Igor Stauder  Date: 11 Feb 2000

    -

    In Section 21.3 [lib.basic.string] the basic_string member function +

    209. basic_string declarations inconsistent

    Section: 21.3 [lib.basic.string]  Status: TC  Submitter: Igor Stauder  Date: 11 Feb 2000

    +

    In Section 21.3 [lib.basic.string] the basic_string member function declarations use a consistent style except for the following functions:

    void push_back(const charT);
    @@ -5373,7 +5773,7 @@ not by reference - should be charT or const charT& )
    - swap: redundant use of template parameters in argument basic_string<charT,traits,Allocator>&

    Proposed resolution:

    -

    In Section 21.3 [lib.basic.string] change the basic_string member +

    In Section 21.3 [lib.basic.string] change the basic_string member function declarations push_back, assign, and swap to:

    void push_back(charT c); 
    @@ -5388,29 +5788,25 @@ above.  The LWG felt that this was sufficient reason to merit the
     change.
     


    -

    210. distance first and last confused

    -Section: 25 [lib.algorithms]  Status: TC  Submitter: Lisa Lippincott  Date: 15 Feb 2000

    -

    In paragraph 9 of section 25 [lib.algorithms], it is written:

    +

    210. distance first and last confused

    Section: 25 [lib.algorithms]  Status: TC  Submitter: Lisa Lippincott  Date: 15 Feb 2000

    +

    In paragraph 9 of section 25 [lib.algorithms], it is written:

    In the description of the algorithms operators + and - are used for some of the iterator categories for which they do not have to be defined. In these cases the semantics of [...] a-b is the same as of

    -      return distance(a, b); -

    +      return distance(a, b);

    Proposed resolution:

    -

    On the last line of paragraph 9 of section 25 [lib.algorithms] change -"a-b" to "b-a". -

    +

    On the last line of paragraph 9 of section 25 [lib.algorithms] change +"a-b" to "b-a".

    Rationale:

    There are two ways to fix the defect; change the description to b-a or change the return to distance(b,a). The LWG preferred the former for consistency.


    -

    211. operator>>(istream&, string&) doesn't set failbit

    -Section: 21.3.7.9 [lib.string.io]  Status: TC  Submitter: Scott Snyder  Date: 4 Feb 2000

    +

    211. operator>>(istream&, string&) doesn't set failbit

    Section: 21.3.7.9 [lib.string.io]  Status: TC  Submitter: Scott Snyder  Date: 4 Feb 2000

    The description of the stream extraction operator for std::string (section 21.3.7.9 [lib.string.io]) does not contain a requirement that failbit be set in the case that the operator fails to extract any characters from the input @@ -5424,12 +5820,12 @@ while (is >> str) ... ;

    (which tests failbit) is not required to terminate at EOF.

    Furthermore, this is inconsistent with other extraction operators, -which do include this requirement. (See sections 27.6.1.2 [lib.istream.formatted] and 27.6.1.3 [lib.istream.unformatted]), where this +which do include this requirement. (See sections 27.6.1.2 [lib.istream.formatted] and 27.6.1.3 [lib.istream.unformatted]), where this requirement is present, either explicitly or implicitly, for the extraction operators. It is also present explicitly in the description -of getline (istream&, string&, charT) in section 21.3.7.9 [lib.string.io] paragraph 8.)

    +of getline (istream&, string&, charT) in section 21.3.7.9 [lib.string.io] paragraph 8.)

    Proposed resolution:

    -

    Insert new paragraph after paragraph 2 in section 21.3.7.9 [lib.string.io]:

    +

    Insert new paragraph after paragraph 2 in section 21.3.7.9 [lib.string.io]:

    If the function extracts no characters, it calls @@ -5437,14 +5833,13 @@ is.setstate(ios::failbit) which may throw ios_base::failure (27.4.4.3).


    -

    212. Empty range behavior unclear for several algorithms

    -Section: 25.3.7 [lib.alg.min.max]  Status: TC  Submitter: Nico Josuttis  Date: 26 Feb 2000

    +

    212. Empty range behavior unclear for several algorithms

    Section: 25.3.7 [lib.alg.min.max]  Status: TC  Submitter: Nico Josuttis  Date: 26 Feb 2000

    The standard doesn't specify what min_element() and max_element() shall return if the range is empty (first equals last). The usual implementations return last. This problem seems also apply to partition(), stable_partition(), next_permutation(), and prev_permutation().

    Proposed resolution:

    -

    In 25.3.7 [lib.alg.min.max] - Minimum and maximum, paragraphs 7 and +

    In 25.3.7 [lib.alg.min.max] - Minimum and maximum, paragraphs 7 and 9, append: Returns last if first==last.

    Rationale:

    The LWG looked in some detail at all of the above mentioned @@ -5452,8 +5847,7 @@ algorithms, but believes that except for min_element() and max_element() it is already clear that last is returned if first == last.


    -

    214. set::find() missing const overload

    -Section: 23.3.3 [lib.set], 23.3.4 [lib.multiset]  Status: WP  Submitter: Judy Ward  Date: 28 Feb 2000

    +

    214. set::find() missing const overload

    Section: 23.3.3 [lib.set], 23.3.4 [lib.multiset]  Status: WP  Submitter: Judy Ward  Date: 28 Feb 2000

    The specification for the associative container requirements in Table 69 state that the find member function should "return iterator; const_iterator for constant a". The map and multimap @@ -5464,7 +5858,7 @@ and multiset do not, all they have is:

    Proposed resolution:

    Change the prototypes for find(), lower_bound(), upper_bound(), and -equal_range() in section 23.3.3 [lib.set] and section 23.3.4 [lib.multiset] to each have two overloads:

    +equal_range() in section 23.3.3 [lib.set] and section 23.3.4 [lib.multiset] to each have two overloads:

    iterator find(const key_type & x);
     const_iterator find(const key_type & x) const;
    @@ -5480,8 +5874,7 @@ pair<const_iterator, const_iterator> equal_range(const key_type & x) c extending the proposed resolution to lower_bound, upper_bound, and equal_range.]


    -

    217. Facets example (Classifying Japanese characters) contains errors

    -Section: 22.2.8 [lib.facets.examples]  Status: TC  Submitter: Martin Sebor  Date: 29 Feb 2000

    +

    217. Facets example (Classifying Japanese characters) contains errors

    Section: 22.2.8 [lib.facets.examples]  Status: TC  Submitter: Martin Sebor  Date: 29 Feb 2000

    The example in 22.2.8, paragraph 11 contains the following errors:

    1) The member function `My::JCtype::is_kanji()' is non-const; the function must be const in order for it to be callable on a const object (a reference to @@ -5524,8 +5917,7 @@ declared above.

    return 0; }

    -

    220. ~ios_base() usage valid?

    -Section: 27.4.2.7 [lib.ios.base.cons]  Status: TC  Submitter: Jonathan Schilling, Howard Hinnant  Date: 13 Mar 2000

    +

    220. ~ios_base() usage valid?

    Section: 27.4.2.7 [lib.ios.base.cons]  Status: TC  Submitter: Jonathan Schilling, Howard Hinnant  Date: 13 Mar 2000

    The pre-conditions for the ios_base destructor are described in 27.4.2.7 paragraph 2:

    @@ -5561,14 +5953,12 @@ behavior.

    to

    -

    Effects: Each ios_base member has an indeterminate -value after construction. These members must be initialized by calling -basic_ios::init. If an ios_base object is destroyed before these -initializations have taken place, the behavior is undefined.

    +

    Effects: Each ios_base member has an indeterminate value after + construction. These members must be initialized by calling basic_ios::init. If an ios_base object is destroyed before these initializations + have taken place, the behavior is undefined.


    -

    221. num_get<>::do_get stage 2 processing broken

    -Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: WP  Submitter: Matt Austern  Date: 14 Mar 2000

    +

    221. num_get<>::do_get stage 2 processing broken

    Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: WP  Submitter: Matt Austern  Date: 14 Mar 2000

    Stage 2 processing of numeric conversion is broken.

    Table 55 in 22.2.2.1.2 says that when basefield is 0 the integral @@ -5601,8 +5991,7 @@ This technique has the consequence that alternate representations of digits will not be recognized. This design decision was made deliberately, with full knowledge of that limitation.


    -

    222. Are throw clauses necessary if a throw is already implied by the effects clause?

    -Section: 17.3.1.3 [lib.structure.specifications]  Status: TC  Submitter: Judy Ward  Date: 17 Mar 2000

    +

    222. Are throw clauses necessary if a throw is already implied by the effects clause?

    Section: 17.3.1.3 [lib.structure.specifications]  Status: TC  Submitter: Judy Ward  Date: 17 Mar 2000

    Section 21.3.6.8 describes the basic_string::compare function this way:

    21.3.6.8 - basic_string::compare [lib.string::compare]
    @@ -5618,7 +6007,7 @@ int compare(size_type pos1, size_type n1,
     

    and the constructor that's implicitly called by the above is defined to throw an out-of-range exception if pos > str.size(). See -section 21.3.1 [lib.string.cons] paragraph 4.

    +section 21.3.1 [lib.string.cons] paragraph 4.

    On the other hand, the compare function descriptions themselves don't have "Throws: " clauses and according to 17.3.1.3, paragraph 3, elements @@ -5627,7 +6016,7 @@ that do not apply to a function are omitted.

    "Effects" clauses correct, or are the "Throws" clauses missing?

    Proposed resolution:

    -

    In 17.3.1.3 [lib.structure.specifications] paragraph 3, the footnote 148 attached to +

    In 17.3.1.3 [lib.structure.specifications] paragraph 3, the footnote 148 attached to the sentence "Descriptions of function semantics contain the following elements (as appropriate):", insert the word "further" so that the foot note reads:

    @@ -5643,11 +6032,10 @@ throw. The inconsistent wording is in a footnote, and thus non-normative. The proposed resolution from the LWG clarifies the footnote.


    -

    223. reverse algorithm should use iter_swap rather than swap

    -Section: 25.2.9 [lib.alg.reverse]  Status: TC  Submitter: Dave Abrahams  Date: 21 Mar 2000

    +

    223. reverse algorithm should use iter_swap rather than swap

    Section: 25.2.9 [lib.alg.reverse]  Status: TC  Submitter: Dave Abrahams  Date: 21 Mar 2000

    Shouldn't the effects say "applies iter_swap to all pairs..."?

    Proposed resolution:

    -

    In 25.2.9 [lib.alg.reverse], replace:

    +

    In 25.2.9 [lib.alg.reverse], replace:

    Effects: For each non-negative integer i <= (last - first)/2, applies swap to all pairs of iterators first + i, (last - i) - 1. @@ -5658,8 +6046,7 @@ footnote.

    applies iter_swap to all pairs of iterators first + i, (last - i) - 1.

    -

    224. clear() complexity for associative containers refers to undefined N

    -Section: 23.1.2 [lib.associative.reqmts]  Status: TC  Submitter: Ed Brey  Date: 23 Mar 2000

    +

    224. clear() complexity for associative containers refers to undefined N

    Section: 23.1.2 [lib.associative.reqmts]  Status: TC  Submitter: Ed Brey  Date: 23 Mar 2000

    In the associative container requirements table in 23.1.2 paragraph 7, a.clear() has complexity "log(size()) + N". However, the meaning of N is not defined.

    @@ -5673,8 +6060,7 @@ error: there's no difference between O(N) and O(N + log(N)). The text in the standard is probably an incorrect cut-and-paste from the range version of erase.


    -

    225. std:: algorithms use of other unqualified algorithms

    -Section: 17.4.4.3 [lib.global.functions]  Status: WP  Submitter: Dave Abrahams  Date: 01 Apr 2000

    +

    225. std:: algorithms use of other unqualified algorithms

    Section: 17.4.4.3 [lib.global.functions]  Status: WP  Submitter: Dave Abrahams  Date: 01 Apr 2000

    Are algorithms in std:: allowed to use other algorithms without qualification, so functions in user namespaces might be found through Koenig lookup?

    For example, a popular standard library implementation includes this @@ -5732,16 +6118,15 @@ however, seem to disagree with this notion.

    [Tokyo:  Steve Adamczyk from the core working group indicates that "std::" is sufficient;  leading "::" qualification is not required because any namespace -qualification is sufficient to suppress Koenig lookup.] -

    +qualification is sufficient to suppress Koenig lookup.]

    Proposed resolution:

    Add a paragraph and a note at the end of -17.4.4.3 [lib.global.functions]:

    +17.4.4.3 [lib.global.functions]:

    Unless otherwise specified, no global or non-member function in the standard library shall use a function from another namespace which is -found through argument-dependent name lookup (3.4.2 [basic.lookup.koenig]).

    +found through argument-dependent name lookup (3.4.2 [basic.lookup.koenig]).

    [Note: the phrase "unless otherwise specified" is intended to allow Koenig lookup in cases like that of ostream_iterators:
    @@ -5760,9 +6145,9 @@ allow Koenig lookup in cases like that of ostream_iterators:
    is as yet unsure if the proposed resolution is the best solution. Furthermore, the LWG believes that the same problem of unqualified library names applies to wording in the standard itself, -and has opened issue 229 accordingly. Any resolution of -issue 225 should be coordinated with the resolution of -issue 229.]

    +and has opened issue 229 accordingly. Any resolution of +issue 225 should be coordinated with the resolution of +issue 229.]

    [Toronto: The LWG is not sure if this is a defect in the standard. Most LWG members believe that an implementation of @@ -5772,7 +6157,7 @@ those specified in the standard. The standard's description of unique does not say that overloading adjacent_find should have any effect.]

    -

    [Curaçao: An LWG-subgroup spent an afternoon working on issues +

    [Curaçao: An LWG-subgroup spent an afternoon working on issues 225, 226, and 229. Their conclusion was that the issues should be separated into an LWG portion (Howard's paper, N1387=02-0045), and a EWG portion (Dave will write a proposal). The LWG and EWG had @@ -5787,28 +6172,195 @@ resolution for this issue is in accordance with Howard's paper.]

    other namespace. However, this is at worst a clarification. It is surely right that algorithsm shouldn't pick up random names, that user-defined names should have no effect unless otherwise specified. - Issue 226 deals with the question of when it is + Issue 226 deals with the question of when it is appropriate for the standard to explicitly specify otherwise.


    -

    227. std::swap() should require CopyConstructible or DefaultConstructible arguments

    -Section: 25.2.2 [lib.alg.swap]  Status: TC  Submitter: Dave Abrahams  Date: 09 Apr 2000

    -

    25.2.2 reads:

    +

    226. User supplied specializations or overloads of namespace std function templates

    Section: 17.4.3.1 [lib.reserved.names]  Status: WP  Submitter: Dave Abrahams  Date: 01 Apr 2000

    +

    The issues are: 

    +

    1. How can a 3rd party library implementor (lib1) write a version of a standard +algorithm which is specialized to work with his own class template? 

    +

    2. How can another library implementor (lib2) write a generic algorithm which +will take advantage of the specialized algorithm in lib1?

    +

    This appears to be the only viable answer under current language rules:

    -

    - template<class T> void swap(T& a, T& b);
    -
    - Requires: Type T is Assignable (_lib.container.requirements_).
    - Effects: Exchanges values stored in two locations.

    +
    namespace lib1
    +{
    +    // arbitrary-precision numbers using T as a basic unit
    +    template <class T>
    +    class big_num { //...
    +    };
    +    
    +
        // defining this in namespace std is illegal (it would be an
    +    // overload), so we hope users will rely on Koenig lookup
    +    template <class T>
    +    void swap(big_int<T>&, big_int<T>&);
    +}
    +
    #include <algorithm>
    +namespace lib2
    +{
    +    template <class T>
    +    void generic_sort(T* start, T* end)
    +    {
    +            ...
    +        // using-declaration required so we can work on built-in types
    +        using std::swap;
    +        // use Koenig lookup to find specialized algorithm if available
    +        swap(*x, *y);
    +    }
    +}
    -

    The only reasonable** generic implementation of swap requires construction of a - new temporary copy of one of its arguments:

    +

    This answer has some drawbacks. First of all, it makes writing lib2 difficult +and somewhat slippery. The implementor needs to remember to write the +using-declaration, or generic_sort will fail to compile when T is a built-in +type. The second drawback is that the use of this style in lib2 effectively +"reserves" names in any namespace which defines types which may +eventually be used with lib2. This may seem innocuous at first when applied to +names like swap, but consider more ambiguous names like unique_copy() instead. +It is easy to imagine the user wanting to define these names differently in his +own namespace. A definition with semantics incompatible with the standard +library could cause serious problems (see issue 225).

    +

    Why, you may ask, can't we just partially specialize std::swap()? It's +because the language doesn't allow for partial specialization of function +templates. If you write:

    -
    template<class T> void swap(T& a, T& b);
    -  {
    -      T tmp(a);
    -      a = b;
    -      b = tmp;
    -  }
    +
    namespace std
    +{
    +    template <class T>
    +    void swap(lib1::big_int<T>&, lib1::big_int<T>&);
    +}
    +
    +

    You have just overloaded std::swap, which is illegal under the current +language rules. On the other hand, the following full specialization is legal:

    +
    +
    namespace std
    +{
    +    template <>
    +    void swap(lib1::other_type&, lib1::other_type&);
    +}
    +
    + +

    This issue reflects concerns raised by the "Namespace issue +with specialized swap" thread on comp.lang.c++.moderated. A +similar set of concerns was earlier raised on the boost.org mailing +list and the ACCU-general mailing list. Also see library reflector +message c++std-lib-7354.

    + +

    +J. C. van Winkel points out (in c++std-lib-9565) another unexpected +fact: it's impossible to output a container of std::pair's using copy +and an ostream_iterator, as long as both pair-members are built-in or +std:: types. That's because a user-defined operator<< for (for +example) std::pair<const std::string, int> will not be found: +lookup for operator<< will be performed only in namespace std. +Opinions differed on whether or not this was a defect, and, if so, +whether the defect is that something is wrong with user-defined +functionality and std, or whether it's that the standard library does +not provide an operator<< for std::pair<>. +

    + +

    Proposed resolution:

    + +

    Adopt the wording proposed in Howard Hinnant's paper + N1523=03-0106, "Proposed Resolution To LWG issues 225, 226, 229".

    + + +

    [Tokyo: Summary, "There is no conforming way to extend +std::swap for user defined templates."  The LWG agrees that +there is a problem. Would like more information before +proceeding. This may be a core issue. Core issue 229 has been opened +to discuss the core aspects of this problem. It was also noted that +submissions regarding this issue have been received from several +sources, but too late to be integrated into the issues list. +]

    + +

    [Post-Tokyo: A paper with several proposed resolutions, +J16/00-0029==WG21/N1252, "Shades of namespace std functions +" by Alan Griffiths, is in the Post-Tokyo mailing. It +should be considered a part of this issue.]

    + +

    [Toronto: Dave Abrahams and Peter Dimov have proposed a +resolution that involves core changes: it would add partial +specialization of function template. The Core Working Group is +reluctant to add partial specialization of function templates. It is +viewed as a large change, CWG believes that proposal presented leaves +some syntactic issues unanswered; if the CWG does add partial +specialization of function templates, it wishes to develop its own +proposal. The LWG continues to believe that there is a serious +problem: there is no good way for users to force the library to use +user specializations of generic standard library functions, and in +certain cases (e.g. transcendental functions called by +valarray and complex) this is important. Koenig +lookup isn't adequate, since names within the library must be +qualified with std (see issue 225), specialization doesn't +work (we don't have partial specialization of function templates), and +users aren't permitted to add overloads within namespace std. +]

    + +

    [Copenhagen: Discussed at length, with no consensus. Relevant +papers in the pre-Copenhagen mailing: N1289, N1295, N1296. Discussion +focused on four options. (1) Relax restrictions on overloads within +namespace std. (2) Mandate that the standard library use unqualified +calls for swap and possibly other functions. (3) Introduce +helper class templates for swap and possibly other functions. +(4) Introduce partial specialization of function templates. Every +option had both support and opposition. Straw poll (first number is +support, second is strongly opposed): (1) 6, 4; (2) 6, 7; (3) 3, 8; +(4) 4, 4.]

    + +

    [Redmond: Discussed, again no consensus. Herb presented an +argument that a user who is defining a type T with an +associated swap should not be expected to put that +swap in namespace std, either by overloading or by partial +specialization. The argument is that swap is part of +T's interface, and thus should to in the same namespace as +T and only in that namespace. If we accept this argument, +the consequence is that standard library functions should use +unqualified call of swap. (And which other functions? Any?) +A small group (Nathan, Howard, Jeremy, Dave, Matt, Walter, Marc) will +try to put together a proposal before the next meeting.]

    + +

    [Curaçao: An LWG-subgroup spent an afternoon working on issues +225, 226, and 229. Their conclusion was that the issues should be +separated into an LWG portion (Howard's paper, N1387=02-0045), and a +EWG portion (Dave will write a proposal). The LWG and EWG had +(separate) discussions of this plan the next day. The proposed +resolution is the one proposed by Howard.]

    + +

    [Santa Cruz: the LWG agreed with the general direction of + Howard's paper, N1387. (Roughly: Koenig lookup is disabled unless + we say otherwise; this issue is about when we do say otherwise.) + However, there were concerns about wording. Howard will provide new + wording. Bill and Jeremy will review it.]

    + +

    [Kona: Howard proposed the new wording. The LWG accepted his + proposed resolution.]

    + +

    Rationale:

    +

    Informally: introduce a Swappable concept, and specify that the + value types of the iterators passed to certain standard algorithms + (such as iter_swap, swap_ranges, reverse, rotate, and sort) conform + to that concept. The Swappable concept will make it clear that + these algorithms use unqualified lookup for the calls + to swap. Also, in 26.3.3.3 [lib.valarray.transcend] paragraph 1, + state that the valarray transcendentals use unqualified lookup.

    +
    +

    227. std::swap() should require CopyConstructible or DefaultConstructible arguments

    Section: 25.2.2 [lib.alg.swap]  Status: TC  Submitter: Dave Abrahams  Date: 09 Apr 2000

    +

    25.2.2 reads:

    +
    +

    template<class T> void swap(T& a, T& b);
    +
    + Requires: Type T is Assignable (_lib.container.requirements_).
    + Effects: Exchanges values stored in two locations.

    +
    +

    The only reasonable** generic implementation of swap requires construction of a + new temporary copy of one of its arguments:

    +
    +
    template<class T> void swap(T& a, T& b);
    +  {
    +      T tmp(a);
    +      a = b;
    +      b = tmp;
    +  }

    But a type which is only Assignable cannot be swapped by this implementation.

    **Yes, there's also an unreasonable implementation which would require T to be @@ -5833,10 +6385,9 @@ resolution for this issue is in accordance with Howard's paper.]

    Requires: Type T is CopyConstructible (20.1.3) and Assignable (23.1)


    -

    228. Incorrect specification of "..._byname" facets

    -Section: 22.2 [lib.locale.categories]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Apr 2000

    -

    The sections 22.2.1.2 [lib.locale.ctype.byname], 22.2.1.4 [lib.locale.ctype.byname.special], -22.2.1.6 [lib.locale.codecvt.byname], 22.2.3.2 [lib.locale.numpunct.byname], 22.2.4.2 [lib.locale.collate.byname], 22.2.5.4 [lib.locale.time.put.byname], 22.2.6.4 [lib.locale.moneypunct.byname], and 22.2.7.2 [lib.locale.messages.byname] overspecify the +

    228. Incorrect specification of "..._byname" facets

    Section: 22.2 [lib.locale.categories]  Status: WP  Submitter: Dietmar Kühl  Date: 20 Apr 2000

    +

    The sections 22.2.1.2 [lib.locale.ctype.byname], 22.2.1.4 [lib.locale.ctype.byname.special], +22.2.1.6 [lib.locale.codecvt.byname], 22.2.3.2 [lib.locale.numpunct.byname], 22.2.4.2 [lib.locale.collate.byname], 22.2.5.4 [lib.locale.time.put.byname], 22.2.6.4 [lib.locale.moneypunct.byname], and 22.2.7.2 [lib.locale.messages.byname] overspecify the definitions of the "..._byname" classes by listing a bunch of virtual functions. At the same time, no semantics of these functions are defined. Real implementations do not define these @@ -5955,19 +6506,18 @@ specialization it is not virtual.

    ~messages_byname(); // virtual }; }
    -

    Remove section 22.2.1.4 [lib.locale.ctype.byname.special] completely (because in +

    Remove section 22.2.1.4 [lib.locale.ctype.byname.special] completely (because in this case only those members are defined to be virtual which are defined to be virtual in 'ctype<cT>'.)

    -

    [Post-Tokyo: Dietmar Kühl submitted this issue at the request of -the LWG to solve the underlying problems raised by issue 138.]

    +

    [Post-Tokyo: Dietmar Kühl submitted this issue at the request of +the LWG to solve the underlying problems raised by issue 138.]

    [Copenhagen: proposed resolution was revised slightly, to remove three last virtual functions from messages_byname.]


    -

    229. Unqualified references of other library entities

    -Section: 17.4.1.1 [lib.contents]  Status: WP  Submitter: Steve Clamage  Date: 19 Apr 2000

    +

    229. Unqualified references of other library entities

    Section: 17.4.1.1 [lib.contents]  Status: WP  Submitter: Steve Clamage  Date: 19 Apr 2000

    Throughout the library chapters, the descriptions of library entities refer to other library entities without necessarily qualifying the names.

    @@ -5981,7 +6531,7 @@ override any ::std::swap function when Koenig lookup applies.

    "::std::" throughout, too many lines in the standard would have to be adjusted to make that change in a Technical Corrigendum.

    -

    Issue 182, which addresses qualification of +

    Issue 182, which addresses qualification of size_t, is a special case of this.

    Proposed resolution:

    @@ -5995,7 +6545,7 @@ adjusted to make that change in a Technical Corrigendum.

    [Post-Tokyo: Steve Clamage submitted this issue at the request of the LWG to solve a problem in the standard itself similar to the -problem within implementations of library identified by issue 225. Any resolution of issue 225 should be +problem within implementations of library identified by issue 225. Any resolution of issue 225 should be coordinated with the resolution of this issue.]

    [post-Toronto: Howard is undecided about whether it is @@ -6009,7 +6559,7 @@ concerned that valarray appears to require argument-dependent lookup, but that the wording may not be clear enough to fall under "unless explicitly described otherwise".]

    -

    [Curaçao: An LWG-subgroup spent an afternoon working on issues +

    [Curaçao: An LWG-subgroup spent an afternoon working on issues 225, 226, and 229. Their conclusion was that the issues should be separated into an LWG portion (Howard's paper, N1387=02-0045), and a EWG portion (Dave will write a proposal). The LWG and EWG had @@ -6018,9 +6568,8 @@ issues 225 and 226. In light of that resolution, the proposed resolution for the current issue makes sense.]


    -

    230. Assignable specified without also specifying CopyConstructible

    -Section: 17 [lib.library]  Status: WP  Submitter: Beman Dawes  Date: 26 Apr 2000

    -

    Issue 227 identified an instance (std::swap) where +

    230. Assignable specified without also specifying CopyConstructible

    Section: 17 [lib.library]  Status: WP  Submitter: Beman Dawes  Date: 26 Apr 2000

    +

    Issue 227 identified an instance (std::swap) where Assignable was specified without also specifying CopyConstructible. The LWG asked that the standard be searched to determine if the same defect existed elsewhere.

    @@ -6028,19 +6577,19 @@ determine if the same defect existed elsewhere.

    There are a number of places (see proposed resolution below) where Assignable is specified without also specifying CopyConstructible. There are also several cases where both are -specified. For example, 26.4.1 [lib.accumulate].

    +specified. For example, 26.4.1 [lib.accumulate].

    Proposed resolution:

    -

    In 23.1 [lib.container.requirements] table 65 for value_type: +

    In 23.1 [lib.container.requirements] table 65 for value_type: change "T is Assignable" to "T is CopyConstructible and Assignable"

    -

    In 23.1.2 [lib.associative.reqmts] table 69 X::key_type; change +

    In 23.1.2 [lib.associative.reqmts] table 69 X::key_type; change "Key is Assignable" to "Key is CopyConstructible and Assignable"

    -

    In 24.1.2 [lib.output.iterators] paragraph 1, change: +

    In 24.1.2 [lib.output.iterators] paragraph 1, change:

    A class or a built-in type X satisfies the requirements of an @@ -6059,9 +6608,13 @@ Table 73:

    [Post-Tokyo: Beman Dawes submitted this issue at the request of -the LWG. He asks that the 25.2.4 [lib.alg.replace] and 25.2.5 [lib.alg.fill] changes be studied carefully, as it is not clear that +the LWG. He asks that the 25.2.4 [lib.alg.replace] and 25.2.5 [lib.alg.fill] changes be studied carefully, as it is not clear that CopyConstructible is really a requirement and may be overspecification.]

    + +

    [Portions of the resolution for issue 230 have been superceded by +the resolution of issue 276.]

    +

    Rationale:

    The original proposed resolution also included changes to input iterator, fill, and replace. The LWG believes that those changes are @@ -6070,8 +6623,7 @@ Assignable type was also required to be Copy Constructible, but decided against this because fill and replace really don't require the Copy Constructible property.


    -

    231. Precision in iostream?

    -Section: 22.2.2.2.2 [lib.facet.num.put.virtuals]  Status: WP  Submitter: James Kanze, Stephen Clamage  Date:  25 Apr 2000

    +

    231. Precision in iostream?

    Section: 22.2.2.2.2 [lib.facet.num.put.virtuals]  Status: WP  Submitter: James Kanze, Stephen Clamage  Date:  25 Apr 2000

    What is the following program supposed to output?

    #include <iostream>
     
    @@ -6112,7 +6664,7 @@ etc. Plus, of course, if precision == 0 and flags & floatfield ==
     of the anomalies of printf:-).

    Proposed resolution:

    -Replace 22.2.2.2.2 [lib.facet.num.put.virtuals], paragraph 11, with the following +Replace 22.2.2.2.2 [lib.facet.num.put.virtuals], paragraph 11, with the following sentence:

    @@ -6135,12 +6687,11 @@ turned into 1. There's no need to call it out as a special case.

    The output of the above program will be "1e+00".

    -

    [Post-Curaçao: Howard provided improved wording covering the case +

    [Post-Curaçao: Howard provided improved wording covering the case where precision is 0 and mode is %g.]


    -

    232. "depends" poorly defined in 17.4.3.1

    -Section: 17.4.3.1 [lib.reserved.names]  Status: WP  Submitter: Peter Dimov  Date: 18 Apr 2000

    +

    232. "depends" poorly defined in 17.4.3.1

    Section: 17.4.3.1 [lib.reserved.names]  Status: WP  Submitter: Peter Dimov  Date: 18 Apr 2000

    17.4.3.1/1 uses the term "depends" to limit the set of allowed specializations of standard templates to those that "depend on a user-defined name of external linkage."

    @@ -6172,26 +6723,24 @@ possible way for a user to come up with a specialization for bitset, for example, that might not have already been specialized by the implementor?

    -

    [Toronto: this may be related to issue 120.]

    +

    [Toronto: this may be related to issue 120.]

    [post-Toronto: Judy provided the above proposed resolution and rationale.]


    -

    234. Typos in allocator definition

    -Section: 20.4.1.1 [lib.allocator.members]  Status: WP  Submitter: Dietmar Kühl  Date: 24 Apr 2000

    +

    234. Typos in allocator definition

    Section: 20.4.1.1 [lib.allocator.members]  Status: WP  Submitter: Dietmar Kühl  Date: 24 Apr 2000

    In paragraphs 12 and 13 the effects of construct() and destruct() are described as returns but the functions actually return void.

    Proposed resolution:

    Substitute "Returns" by "Effect".


    -

    235. No specification of default ctor for reverse_iterator

    -Section: 24.4.1.1 [lib.reverse.iterator]  Status: WP  Submitter: Dietmar Kühl  Date: 24 Apr 2000

    +

    235. No specification of default ctor for reverse_iterator

    Section: 24.4.1.1 [lib.reverse.iterator]  Status: WP  Submitter: Dietmar Kühl  Date: 24 Apr 2000

    The declaration of reverse_iterator lists a default constructor. However, no specification is given what this constructor should do.

    Proposed resolution:

    -

    In section 24.4.1.3.1 [lib.reverse.iter.cons] add the following +

    In section 24.4.1.3.1 [lib.reverse.iter.cons] add the following paragraph:

    reverse_iterator()

    @@ -6204,8 +6753,7 @@ should do.

    [pre-Copenhagen: Dietmar provide wording for proposed resolution.]


    -

    237. Undefined expression in complexity specification

    -Section: 23.2.2.1 [lib.list.cons]  Status: WP  Submitter: Dietmar Kühl  Date: 24 Apr 2000

    +

    237. Undefined expression in complexity specification

    Section: 23.2.2.1 [lib.list.cons]  Status: WP  Submitter: Dietmar Kühl  Date: 24 Apr 2000

    The complexity specification in paragraph 6 says that the complexity is linear in first - last. Even if operator-() is defined on iterators this term is in general undefined because it @@ -6216,13 +6764,13 @@ would have to be last - first.

    to become

    Linear in distance(first, last).

    -

    238. Contradictory results of stringbuf initialization.

    -Section: 27.7.1.1 [lib.stringbuf.cons]  Status: WP  Submitter: Dietmar Kühl  Date: 11 May 2000

    +

    238. Contradictory results of stringbuf initialization.

    Section: 27.7.1.1 [lib.stringbuf.cons]  Status: WP  Submitter: Dietmar Kühl  Date: 11 May 2000

    In 27.7.1.1 paragraph 4 the results of calling the constructor of 'basic_stringbuf' are said to be str() == str. This is fine that far but consider this code:

    -
      std::basic_stringbuf<char> sbuf("hello, world", std::ios_base::openmode(0));
    +
    +  std::basic_stringbuf<char> sbuf("hello, world", std::ios_base::openmode(0));
       std::cout << "'" << sbuf.str() << "'\n";
     
    @@ -6242,8 +6790,7 @@ defined to be basic_string<cT>().

    we fixed it, it would say just the same thing as text that's already in the standard.


    -

    239. Complexity of unique() and/or unique_copy incorrect

    -Section: 25.2.8 [lib.alg.unique]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    +

    239. Complexity of unique() and/or unique_copy incorrect

    Section: 25.2.8 [lib.alg.unique]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    The complexity of unique and unique_copy are inconsistent with each other and inconsistent with the implementations.  The standard specifies:

    @@ -6270,18 +6817,18 @@ applying the predicate last-first times, especially since it is not specified to which pair in the sequence the predicate is applied twice.

    Proposed resolution:

    -

    Change both complexity sections in 25.2.8 [lib.alg.unique] to:

    +

    Change both complexity sections in 25.2.8 [lib.alg.unique] to:

    Complexity: For nonempty ranges, exactly last - first - 1 applications of the corresponding predicate.

    -

    240. Complexity of adjacent_find() is meaningless

    -Section: 25.1.5 [lib.alg.adjacent.find]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    +

    240. Complexity of adjacent_find() is meaningless

    Section: 25.1.5 [lib.alg.adjacent.find]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    The complexity section of adjacent_find is defective:

    -
    template <class ForwardIterator>
    +
    +template <class ForwardIterator>
     ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last
                                   BinaryPredicate pred);
     
    @@ -6312,7 +6859,7 @@ not required of predicates because they can have non-const data members. For this reason, a specification using a binder could only be an "as-if" specification.

    Proposed resolution:

    -

    Change the complexity section in 25.1.5 [lib.alg.adjacent.find] to:

    +

    Change the complexity section in 25.1.5 [lib.alg.adjacent.find] to:

    For a nonempty range, exactly min((i - first) + 1, (last - first) - 1) applications of the @@ -6324,8 +6871,7 @@ return value. bound. The LWG preferred an exact count.]


    -

    241. Does unique_copy() require CopyConstructible and Assignable?

    -Section: 25.2.8 [lib.alg.unique]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    +

    241. Does unique_copy() require CopyConstructible and Assignable?

    Section: 25.2.8 [lib.alg.unique]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    Some popular implementations of unique_copy() create temporary copies of values in the input sequence, at least if the input iterator @@ -6336,7 +6882,7 @@ the value type is CopyConstructible and Assignable.

    specify any additional requirements that they impose on any of the types used by the algorithm. An example of an algorithm that creates temporary copies and correctly specifies the additional requirements -is accumulate(), 26.4.1 [lib.accumulate].

    +is accumulate(), 26.4.1 [lib.accumulate].

    Since the specifications of unique() and unique_copy() do not require CopyConstructible and Assignable of the InputIterator's value @@ -6372,20 +6918,19 @@ requiring assignability, although current implementations do impose that requirement. Howard provided new wording.]

    [ -Curaçao: The LWG changed the PR editorially to specify +Curaçao: The LWG changed the PR editorially to specify "neither...nor...meet..." as clearer than "both...and...do not meet...". Change believed to be so minor as not to require re-review. ]


    -

    242. Side effects of function objects

    -Section: 25.2.3 [lib.alg.transform], 26.4 [lib.numeric.ops]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    +

    242. Side effects of function objects

    Section: 25.2.3 [lib.alg.transform], 26.4 [lib.numeric.ops]  Status: WP  Submitter: Angelika Langer  Date: May 15 2000

    The algorithms transform(), accumulate(), inner_product(), partial_sum(), and adjacent_difference() require that the function object supplied to them shall not have any side effects.

    -

    The standard defines a side effect in 1.9 [intro.execution] as:

    +

    The standard defines a side effect in 1.9 [intro.execution] as:

    -7- Accessing an object designated by a volatile lvalue (basic.lval), modifying an object, calling a library I/O function, or calling a function that does any of those operations are all side effects, which are changes @@ -6558,8 +7103,7 @@ added footnotes pointing out that the use of closed ranges was intentional.]


    -

    243. get and getline when sentry reports failure

    -Section: 27.6.1.3 [lib.istream.unformatted]  Status: WP  Submitter: Martin Sebor  Date: May 15 2000

    +

    243. get and getline when sentry reports failure

    Section: 27.6.1.3 [lib.istream.unformatted]  Status: WP  Submitter: Martin Sebor  Date: May 15 2000

    basic_istream<>::get(), and basic_istream<>::getline(), are unclear with respect to the behavior and side-effects of the named functions in case of an error.

    @@ -6606,8 +7150,7 @@ had language that made this an unambiguous requirement; those words were moved to a place where their context made them less clear. See Jerry Schwarz's message c++std-lib-7618.


    -

    248. time_get fails to set eofbit

    -Section: 22.2.5 [lib.category.time]  Status: WP  Submitter: Martin Sebor  Date: 22 June 2000

    +

    248. time_get fails to set eofbit

    Section: 22.2.5 [lib.category.time]  Status: WP  Submitter: Martin Sebor  Date: 22 June 2000

    There is no requirement that any of time_get member functions set ios::eofbit when they reach the end iterator while parsing their input. Since members of both the num_get and money_get facets are required to @@ -6625,12 +7168,12 @@ member functions, the member sets ios_base::eofbit in err. because it was more consistent with the way eof is described for other input facets.


    -

    250. splicing invalidates iterators

    -Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: Brian Parker   Date: 14 Jul 2000

    +

    250. splicing invalidates iterators

    Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: Brian Parker   Date: 14 Jul 2000

    Section 23.2.2.4 [lib.list.ops] states that

    -
      void splice(iterator position, list<T, Allocator>& x);
    +
    +  void splice(iterator position, list<T, Allocator>& x);
     

    invalidates all iterators and references to list x. @@ -6643,14 +7186,14 @@ after splice.

    Proposed resolution:

    -

    Add a footnote to 23.2.2.4 [lib.list.ops], paragraph 1:

    +

    Add a footnote to 23.2.2.4 [lib.list.ops], paragraph 1:

    -[Footnote: As specified in 20.1.5 [lib.allocator.requirements], paragraphs +[Footnote: As specified in 20.1.5 [lib.allocator.requirements], paragraphs 4-5, the semantics described in this clause applies only to the case where allocators compare equal. --end footnote]
    -

    In 23.2.2.4 [lib.list.ops], replace paragraph 4 with:

    +

    In 23.2.2.4 [lib.list.ops], replace paragraph 4 with:

    Effects: Inserts the contents of x before position and x becomes empty. Pointers and references to the moved elements of x now refer to @@ -6659,7 +7202,7 @@ moved elements will continue to refer to their elements, but they now behave as iterators into *this, not into x.
    -

    In 23.2.2.4 [lib.list.ops], replace paragraph 7 with:

    +

    In 23.2.2.4 [lib.list.ops], replace paragraph 7 with:

    Effects: Inserts an element pointed to by i from list x before position and removes the element from x. The result is unchanged if @@ -6669,7 +7212,7 @@ to refer to this same element but as a member of *this. Iterators to *i behave as iterators into *this, not into x.
    -

    In 23.2.2.4 [lib.list.ops], replace paragraph 12 with:

    +

    In 23.2.2.4 [lib.list.ops], replace paragraph 12 with:

    Requires: [first, last) is a valid range in x. The result is undefined if position is an iterator in the range [first, last). @@ -6684,11 +7227,10 @@ iterators into *this, not into x.

    The original proposed resolution said that iterators and references would remain "valid". The new proposed resolution clarifies what that means. Note that this only applies to the case of equal allocators. -From 20.1.5 [lib.allocator.requirements] paragraph 4, the behavior of list when +From 20.1.5 [lib.allocator.requirements] paragraph 4, the behavior of list when allocators compare nonequal is outside the scope of the standard.


    -

    251. basic_stringbuf missing allocator_type

    -Section: 27.7.1 [lib.stringbuf]  Status: WP  Submitter: Martin Sebor  Date: 28 Jul 2000

    +

    251. basic_stringbuf missing allocator_type

    Section: 27.7.1 [lib.stringbuf]  Status: WP  Submitter: Martin Sebor  Date: 28 Jul 2000

    The synopsis for the template class basic_stringbuf doesn't list a typedef for the template parameter Allocator. This makes it impossible to determine the type of @@ -6699,11 +7241,11 @@ template classes in the library that do provide a typedef for the

    Add to the synopses of the class templates basic_stringbuf (27.7.1), basic_istringstream (27.7.2), basic_ostringstream (27.7.3), and basic_stringstream (27.7.4) the typedef:

    -
      typedef Allocator allocator_type;
    +
    +  typedef Allocator allocator_type;
     

    -

    252. missing casts/C-style casts used in iostreams

    -Section: 27.7 [lib.string.streams]  Status: WP  Submitter: Martin Sebor  Date: 28 Jul 2000

    +

    252. missing casts/C-style casts used in iostreams

    Section: 27.7 [lib.string.streams]  Status: WP  Submitter: Martin Sebor  Date: 28 Jul 2000

    27.7.2.2, p1 uses a C-style cast rather than the more appropriate const_cast<> in the Returns clause for basic_istringstream<>::rdbuf(). The same C-style cast is being used in 27.7.3.2, p1, D.7.2.2, p1, and @@ -6738,8 +7280,162 @@ issue is stylistic rather than a matter of correctness.

    with

      -2- Returns: const_cast<strstreambuf*>(&sb).

    -

    256. typo in 27.4.4.2, p17: copy_event does not exist

    -Section: 27.4.4.2 [lib.basic.ios.members]  Status: WP  Submitter: Martin Sebor  Date: 21 Aug 2000

    +

    253. valarray helper functions are almost entirely useless

    Section: 26.3.2.1 [lib.valarray.cons], 26.3.2.2 [lib.valarray.assign]  Status: WP  Submitter: Robert Klarer  Date: 31 Jul 2000

    +

    This discussion is adapted from message c++std-lib-7056 posted +November 11, 1999. I don't think that anyone can reasonably claim +that the problem described below is NAD.

    + +

    These valarray constructors can never be called:

    + +
    +   template <class T>
    +         valarray<T>::valarray(const slice_array<T> &);
    +   template <class T>
    +         valarray<T>::valarray(const gslice_array<T> &);
    +   template <class T>
    +         valarray<T>::valarray(const mask_array<T> &);
    +   template <class T>
    +         valarray<T>::valarray(const indirect_array<T> &);
    +
    + +

    Similarly, these valarray assignment operators cannot be +called:

    + +
    +     template <class T>
    +     valarray<T> valarray<T>::operator=(const slice_array<T> &);
    +     template <class T>
    +     valarray<T> valarray<T>::operator=(const gslice_array<T> &);
    +     template <class T>
    +     valarray<T> valarray<T>::operator=(const mask_array<T> &);
    +     template <class T>
    +     valarray<T> valarray<T>::operator=(const indirect_array<T> &);
    +
    + +

    Please consider the following example:

    + +
    +   #include <valarray>
    +   using namespace std;
    +
    +   int main()
    +   {
    +       valarray<double> va1(12);
    +       valarray<double> va2(va1[slice(1,4,3)]); // line 1
    +   }
    +
    + + +

    Since the valarray va1 is non-const, the result of the sub-expression +va1[slice(1,4,3)] at line 1 is an rvalue of type const +std::slice_array<double>. This slice_array rvalue is then used to +construct va2. The constructor that is used to construct va2 is +declared like this:

    + +
    +     template <class T>
    +     valarray<T>::valarray(const slice_array<T> &);
    +
    + +

    Notice the constructor's const reference parameter. When the +constructor is called, a slice_array must be bound to this reference. +The rules for binding an rvalue to a const reference are in 8.5.3, +paragraph 5 (see also 13.3.3.1.4). Specifically, paragraph 5 +indicates that a second slice_array rvalue is constructed (in this +case copy-constructed) from the first one; it is this second rvalue +that is bound to the reference parameter. Paragraph 5 also requires +that the constructor that is used for this purpose be callable, +regardless of whether the second rvalue is elided. The +copy-constructor in this case is not callable, however, because it is +private. Therefore, the compiler should report an error.

    + +

    Since slice_arrays are always rvalues, the valarray constructor that has a +parameter of type const slice_array<T> & can never be called. The +same reasoning applies to the three other constructors and the four +assignment operators that are listed at the beginning of this post. +Furthermore, since these functions cannot be called, the valarray helper +classes are almost entirely useless.

    +

    Proposed resolution:

    +

    slice_array:

    + + +

    gslice_array:

    + + +

    mask_array:

    + + +

    indirect_array:

    + +

    [Proposed resolution was modified in Santa Cruz: explicitly make +copy constructor and copy assignment operators public, instead of +removing them.]

    +

    Rationale:

    +

    Keeping the valarray constructors private is untenable. Merely +making valarray a friend of the helper classes isn't good enough, +because access to the copy constructor is checked in the user's +environment.

    + +

    Making the assignment operator public is not strictly necessary to +solve this problem. A majority of the LWG (straw poll: 13-4) +believed we should make the assignment operators public, in addition +to the copy constructors, for reasons of symmetry and user +expectation.

    +
    +

    256. typo in 27.4.4.2, p17: copy_event does not exist

    Section: 27.4.4.2 [lib.basic.ios.members]  Status: WP  Submitter: Martin Sebor  Date: 21 Aug 2000

    27.4.4.2, p17 says

    @@ -6758,8 +7454,7 @@ copyfmt_event.

    Proposed resolution:

    Replace copy_event with copyfmt_event in the named paragraph.


    -

    259. basic_string::operator[] and const correctness

    -Section: 21.3.4 [lib.string.access]  Status: WP  Submitter: Chris Newton   Date: 27 Aug 2000

    +

    259. basic_string::operator[] and const correctness

    Section: 21.3.4 [lib.string.access]  Status: WP  Submitter: Chris Newton   Date: 27 Aug 2000

    Paraphrased from a message that Chris Newton posted to comp.std.c++:

    @@ -6783,8 +7478,7 @@ In section 21.3.4, paragraph 1, change


    260. Inconsistent return type of istream_iterator::operator++(int) -

    -Section: 24.5.1.2 [lib.istream.iterator.ops]  Status: WP  Submitter: Martin Sebor  Date: 27 Aug 2000

    +

    Section: 24.5.1.2 [lib.istream.iterator.ops]  Status: WP  Submitter: Martin Sebor  Date: 27 Aug 2000

    The synopsis of istream_iterator::operator++(int) in 24.5.1 shows it as returning the iterator by value. 24.5.1.2, p5 shows the same operator as returning the iterator by reference. That's incorrect @@ -6792,21 +7486,23 @@ given the Effects clause below (since a temporary is returned). The `&' is probably just a typo.

    Proposed resolution:

    Change the declaration in 24.5.1.2, p5 from

    -
     istream_iterator<T,charT,traits,Distance>& operator++(int);
    + 
    + istream_iterator<T,charT,traits,Distance>& operator++(int);
      

    to

    -
     istream_iterator<T,charT,traits,Distance> operator++(int);
    + 
    + istream_iterator<T,charT,traits,Distance> operator++(int);
      

    (that is, remove the `&').


    261. Missing description of istream_iterator::operator!= -

    -Section: 24.5.1.2 [lib.istream.iterator.ops]  Status: WP  Submitter: Martin Sebor  Date: 27 Aug 2000

    +

    Section: 24.5.1.2 [lib.istream.iterator.ops]  Status: WP  Submitter: Martin Sebor  Date: 27 Aug 2000

    24.5.1, p3 lists the synopsis for

    -
       template <class T, class charT, class traits, class Distance>
    +
    +   template <class T, class charT, class traits, class Distance>
             bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
                             const istream_iterator<T,charT,traits,Distance>& y);
     
    @@ -6820,15 +7516,15 @@ or Returns clause) in 24.5.1.2. Add paragraph 7 to the end of section 24.5.1.2 with the following text:

    -
       template <class T, class charT, class traits, class Distance>
    +
    +   template <class T, class charT, class traits, class Distance>
             bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
                             const istream_iterator<T,charT,traits,Distance>& y);
     

    -7- Returns: !(x == y).


    -

    262. Bitmask operator ~ specified incorrectly

    -Section: 17.3.2.1.2 [lib.bitmask.types]  Status: WP  Submitter: Beman Dawes  Date: 03 Sep 2000

    +

    262. Bitmask operator ~ specified incorrectly

    Section: 17.3.2.1.2 [lib.bitmask.types]  Status: WP  Submitter: Beman Dawes  Date: 03 Sep 2000

    The ~ operation should be applied after the cast to int_type.

    @@ -6837,7 +7533,8 @@ The ~ operation should be applied after the cast to int_type. Change 17.3.2.1.2 [lib.bitmask.types] operator~ from:

    -
       bitmask operator~ ( bitmask X )
    +
    +   bitmask operator~ ( bitmask X )
          { return static_cast< bitmask>(static_cast<int_type>(~ X)); }
     
    @@ -6845,12 +7542,12 @@ Change 17.3.2.1.2 [lib.bitmask.types] operator~ from: to:

    -
       bitmask operator~ ( bitmask X )
    +
    +   bitmask operator~ ( bitmask X )
          { return static_cast< bitmask>(~static_cast<int_type>(X)); }
     

    -

    263. Severe restriction on basic_string reference counting

    -Section: 21.3 [lib.basic.string]  Status: WP  Submitter: Kevlin Henney  Date: 04 Sep 2000

    +

    263. Severe restriction on basic_string reference counting

    Section: 21.3 [lib.basic.string]  Status: WP  Submitter: Kevlin Henney  Date: 04 Sep 2000

    The note in paragraph 6 suggests that the invalidation rules for references, pointers, and iterators in paragraph 5 permit a reference- @@ -6864,7 +7561,8 @@ implementation unviable. In the following example none of the conditions for iterator invalidation are satisfied:

    -
        // first example: "*******************" should be printed twice
    +
    +    // first example: "*******************" should be printed twice
         string original = "some arbitrary text", copy = original;
         const string & alias = original;
     
    @@ -6881,7 +7579,8 @@ conditions for iterator invalidation are satisfied:
     Similarly, in the following example:
     

    -
        // second example: "some arbitrary text" should be printed out
    +
    +    // second example: "some arbitrary text" should be printed out
         string original = "some arbitrary text", copy = original;
         const string & alias = original;
     
    @@ -6920,15 +7619,14 @@ Change the following sentence in 21.3 paragraph 5 from
         or rend().
     

    -

    264. Associative container insert(i, j) complexity requirements are not feasible.

    -Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: John Potter  Date: 07 Sep 2000

    +

    264. Associative container insert(i, j) complexity requirements are not feasible.

    Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: John Potter  Date: 07 Sep 2000

    Table 69 requires linear time if [i, j) is sorted. Sorted is necessary but not sufficient. Consider inserting a sorted range of even integers into a set<int> containing the odd integers in the same range.

    -

    Related issue: 102

    +

    Related issue: 102

    Proposed resolution:

    In Table 69, in section 23.1.2, change the complexity clause for @@ -6960,8 +7658,7 @@ inserted is sorted, it's more trouble than it's worth to say that it's linear in some special cases.


    -

    265. std::pair::pair() effects overly restrictive

    -Section: 20.2.2 [lib.pairs]  Status: WP  Submitter: Martin Sebor  Date: 11 Sep 2000

    +

    265. std::pair::pair() effects overly restrictive

    Section: 20.2.2 [lib.pairs]  Status: WP  Submitter: Martin Sebor  Date: 11 Sep 2000

    I don't see any requirements on the types of the elements of the std::pair container in 20.2.2. From the descriptions of the member @@ -6998,8 +7695,7 @@ default constructor was written the obvious way. This has been clarified by core issue 178, and there is no longer any doubt that the straightforward implementation is correct.


    -

    266. bad_exception::~bad_exception() missing Effects clause

    -Section: 18.6.2.1 [lib.bad.exception]  Status: WP  Submitter: Martin Sebor  Date: 24 Sep 2000

    +

    266. bad_exception::~bad_exception() missing Effects clause

    Section: 18.6.2.1 [lib.bad.exception]  Status: WP  Submitter: Martin Sebor  Date: 24 Sep 2000

    The synopsis for std::bad_exception lists the function ~bad_exception() but there is no description of what the function does (the Effects @@ -7008,10 +7704,10 @@ clause is missing).

    Proposed resolution:

    Remove the destructor from the class synopses of -bad_alloc (18.4.2.1 [lib.bad.alloc]), -bad_cast (18.5.2 [lib.bad.cast]), -bad_typeid (18.5.3 [lib.bad.typeid]), -and bad_exception (18.6.2.1 [lib.bad.exception]). +bad_alloc (18.4.2.1 [lib.bad.alloc]), +bad_cast (18.5.2 [lib.bad.cast]), +bad_typeid (18.5.3 [lib.bad.typeid]), +and bad_exception (18.6.2.1 [lib.bad.exception]).

    Rationale:

    @@ -7022,8 +7718,7 @@ removing them is more consistent with how exception classes are described in clause 19.


    -

    268. Typo in locale synopsis

    -Section: 22.1.1 [lib.locale]  Status: WP  Submitter: Martin Sebor  Date: 5 Oct 2000

    +

    268. Typo in locale synopsis

    Section: 22.1.1 [lib.locale]  Status: WP  Submitter: Martin Sebor  Date: 5 Oct 2000

    The synopsis of the class std::locale in 22.1.1 contains two typos: the semicolons after the declarations of the default ctor locale::locale() and the copy ctor locale::locale(const locale&) @@ -7031,20 +7726,21 @@ are missing.

    Proposed resolution:

    Add the missing semicolons, i.e., change

    -
        //  construct/copy/destroy:
    +
    +    //  construct/copy/destroy:
             locale() throw()
             locale(const locale& other) throw()
     

    in the synopsis in 22.1.1 to

    -
        //  construct/copy/destroy:
    +
    +    //  construct/copy/destroy:
             locale() throw();
             locale(const locale& other) throw();
     

    -

    270. Binary search requirements overly strict

    -Section: 25.3.3 [lib.alg.binary.search]  Status: WP  Submitter: Matt Austern  Date: 18 Oct 2000

    +

    270. Binary search requirements overly strict

    Section: 25.3.3 [lib.alg.binary.search]  Status: WP  Submitter: Matt Austern  Date: 18 Oct 2000

    Each of the four binary search algorithms (lower_bound, upper_bound, equal_range, binary_search) has a form that allows the user to pass a @@ -7059,7 +7755,8 @@ large record with an integer key. We might reasonably want to look up a record by key, in which case we would want to write something like this:

    -
        struct key_comp {
    +
    +    struct key_comp {
           bool operator()(const X& x, int n) const {
             return x.key() < n;
           }
    @@ -7252,7 +7949,8 @@ The proposed resolution is based on that alternative formulation.
     
     

    to:

    -
       -2- Returns: 
    +
    +   -2- Returns: 
              make_pair(lower_bound(first, last, value),
                        upper_bound(first, last, value))
            or
    @@ -7294,8 +7992,7 @@ that the upper bound is no earlier than the lower bound, that
     the pair returned by equal_range is a valid range, and that the first
     part of that pair is the lower bound.


    -

    271. basic_iostream missing typedefs

    -Section: 27.6.1.5 [lib.iostreamclass]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    +

    271. basic_iostream missing typedefs

    Section: 27.6.1.5 [lib.iostreamclass]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    Class template basic_iostream has no typedefs. The typedefs it inherits from its base classes can't be used, since (for example) @@ -7304,9 +8001,10 @@ basic_iostream<T>::traits_type is ambiguous.

    Proposed resolution:

    Add the following to basic_iostream's class synopsis in -27.6.1.5 [lib.iostreamclass], immediately after public:

    +27.6.1.5 [lib.iostreamclass], immediately after public:

    -
      // types:
    +
    +  // types:
       typedef charT                     char_type;
       typedef typename traits::int_type int_type;
       typedef typename traits::pos_type pos_type;
    @@ -7314,8 +8012,7 @@ basic_iostream<T>::traits_type is ambiguous.
       typedef traits                    traits_type;
     

    -

    272. Missing parentheses around subexpression

    -Section: 27.4.4.3 [lib.iostate.flags]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    +

    272. Missing parentheses around subexpression

    Section: 27.4.4.3 [lib.iostate.flags]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    27.4.4.3, p4 says about the postcondition of the function: If rdbuf()!=0 then state == rdstate(); otherwise @@ -7332,8 +8029,7 @@ anything but non-zero. Add parentheses like so: rdstate()==(state|ios_base::badbit).


    -

    273. Missing ios_base qualification on members of a dependent class

    -Section: 27 [lib.input.output]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    +

    273. Missing ios_base qualification on members of a dependent class

    Section: 27 [lib.input.output]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    27.5.2.4.2, p4, and 27.8.1.6, p2, 27.8.1.7, p3, 27.8.1.9, p2, 27.8.1.10, p3 refer to in and/or out w/o ios_base:: qualification. That's incorrect since the names are members of a dependent base @@ -7342,8 +8038,7 @@ class (14.6.2 [temp.dep]) and thus not visible.

    Qualify the names with the name of the class of which they are members, i.e., ios_base.


    -

    274. a missing/impossible allocator requirement

    -Section: 20.1.5 [lib.allocator.requirements]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    +

    274. a missing/impossible allocator requirement

    Section: 20.1.5 [lib.allocator.requirements]  Status: WP  Submitter: Martin Sebor  Date: 02 Nov 2000

    I see that table 31 in 20.1.5, p3 allows T in std::allocator<T> to be of any type. But the synopsis in 20.4.1 calls for allocator<>::address() to @@ -7394,12 +8089,11 @@ The original text for proposed resolution 2 was modified so that it also forbids volatile types and reference types.

    -

    [Curaçao: LWG double checked and believes volatile is correctly +

    [Curaçao: LWG double checked and believes volatile is correctly excluded from the PR.]


    -

    275. Wrong type in num_get::get() overloads

    -Section: 22.2.2.1.1 [lib.facet.num.get.members]  Status: WP  Submitter: Matt Austern  Date: 02 Nov 2000

    +

    275. Wrong type in num_get::get() overloads

    Section: 22.2.2.1.1 [lib.facet.num.get.members]  Status: WP  Submitter: Matt Austern  Date: 02 Nov 2000

    In 22.2.2.1.1, we have a list of overloads for num_get<>::get(). There are eight overloads, all of which are identical except for the @@ -7438,20 +8132,21 @@ These two lists are not identical. They should be, since the arguments it was given.

    Proposed resolution:

    -

    In 22.2.2.1.1 [lib.facet.num.get.members], change

    -
      iter_type get(iter_type in, iter_type end, ios_base& str,
    +

    In 22.2.2.1.1 [lib.facet.num.get.members], change

    +
    +  iter_type get(iter_type in, iter_type end, ios_base& str,
                     ios_base::iostate& err, short& val) const;
     

    to

    -
      iter_type get(iter_type in, iter_type end, ios_base& str,
    +
    +  iter_type get(iter_type in, iter_type end, ios_base& str,
                     ios_base::iostate& err, float& val) const;
     

    -

    276. Assignable requirement for container value type overly strict

    -Section: 23.1 [lib.container.requirements]  Status: WP  Submitter: Peter Dimov  Date: 07 Nov 2000

    +

    276. Assignable requirement for container value type overly strict

    Section: 23.1 [lib.container.requirements]  Status: WP  Submitter: Peter Dimov  Date: 07 Nov 2000

    23.1/3 states that the objects stored in a container must be -Assignable. 23.3.1 [lib.map], paragraph 2, +Assignable. 23.3.1 [lib.map], paragraph 2, states that map satisfies all requirements for a container, while in the same time defining value_type as pair<const Key, T> - a type that is not Assignable. @@ -7475,14 +8170,14 @@ general.

    For example, the proposed resolution of active library issue -103 is to make set::iterator a constant iterator; this +103 is to make set::iterator a constant iterator; this means that no set operations can exploit the fact that the stored objects are Assignable.

    This is related to, but slightly broader than, closed issue -140. +140.

    Proposed resolution:

    23.1/3: Strike the trailing part of the sentence:

    @@ -7542,7 +8237,8 @@ following methods are instantiated: [Footnote: Implementors are permitted but not required to take advantage of T's Assignable properties for these methods. -- end foonote]

    -
         list<T,Allocator>& operator=(const list<T,Allocator>&  x );
    +
    +     list<T,Allocator>& operator=(const list<T,Allocator>&  x );
          template <class InputIterator>
            void assign(InputIterator first, InputIterator last);
          void assign(size_type n, const T& t);
    @@ -7578,7 +8274,7 @@ to forbid such implementations.

    Note that the type stored in a standard container must still satisfy the requirements of the container's allocator; this rules out, for -example, such types as "const int". See issue 274 +example, such types as "const int". See issue 274 for more details.

    @@ -7590,12 +8286,12 @@ implement vector::push_back in terms of vector::insert.


    -

    278. What does iterator validity mean?

    -Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: P.J. Plauger  Date: 27 Nov 2000

    +

    278. What does iterator validity mean?

    Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: P.J. Plauger  Date: 27 Nov 2000

    Section 23.2.2.4 [lib.list.ops] states that

    -
      void splice(iterator position, list<T, Allocator>& x);
    +
    +  void splice(iterator position, list<T, Allocator>& x);
     

    invalidates all iterators and references to list x. @@ -7610,7 +8306,7 @@ validity.

    -If we accept the proposed resolution to issue 250, +If we accept the proposed resolution to issue 250, then we'd better clarify that a "valid" iterator need no longer designate an element within the same container as it once did. We then have to clarify what we mean by invalidating a past-the-end @@ -7619,7 +8315,7 @@ such an iterator has a different kind of validity. Perhaps we should introduce separate terms for the two kinds of "validity."

    Proposed resolution:

    -

    Add the following text to the end of section 24.1 [lib.iterator.requirements], +

    Add the following text to the end of section 24.1 [lib.iterator.requirements], after paragraph 5:

    An invalid iterator is an iterator that may be @@ -7645,11 +8341,10 @@ the wording. Dave provided new wording.]

    all iterators pointing into the vector. That doesn't necessarily mean they all become singular.


    -

    281. std::min() and max() requirements overly restrictive

    -Section: 25.3.7 [lib.alg.min.max]  Status: WP  Submitter: Martin Sebor  Date: 02 Dec 2000

    +

    281. std::min() and max() requirements overly restrictive

    Section: 25.3.7 [lib.alg.min.max]  Status: WP  Submitter: Martin Sebor  Date: 02 Dec 2000

    The requirements in 25.3.7, p1 and 4 call for T to satisfy the -requirements of LessThanComparable (20.1.2 [lib.lessthancomparable]) -and CopyConstructible (20.1.3 [lib.copyconstructible]). +requirements of LessThanComparable (20.1.2 [lib.lessthancomparable]) +and CopyConstructible (20.1.3 [lib.copyconstructible]). Since the functions take and return their arguments and result by const reference, I believe the CopyConstructible requirement is unnecessary. @@ -7657,18 +8352,15 @@ is unnecessary.

    Proposed resolution:

    Remove the CopyConstructible requirement. Specifically, replace 25.3.7, p1 with

    -

    --1- Requires: Type T is LessThanComparable -(20.1.2 [lib.lessthancomparable]). +

    -1- Requires: Type T is LessThanComparable +(20.1.2 [lib.lessthancomparable]).

    and replace 25.3.7, p4 with

    -

    --4- Requires: Type T is LessThanComparable -(20.1.2 [lib.lessthancomparable]). +

    -4- Requires: Type T is LessThanComparable +(20.1.2 [lib.lessthancomparable]).


    -

    282. What types does numpunct grouping refer to?

    -Section: 22.2.2.2.2 [lib.facet.num.put.virtuals]  Status: WP  Submitter: Howard Hinnant  Date: 5 Dec 2000

    +

    282. What types does numpunct grouping refer to?

    Section: 22.2.2.2.2 [lib.facet.num.put.virtuals]  Status: WP  Submitter: Howard Hinnant  Date: 5 Dec 2000

    Paragraph 16 mistakenly singles out integral types for inserting thousands_sep() characters. This conflicts with the syntax for floating @@ -7680,7 +8372,7 @@ point numbers described under 22.2.3.1/2.

    For integral types, punct.thousands_sep() characters are inserted into the sequence as determined by the value returned by punct.do_grouping() -using the method described in 22.2.3.1.2 [lib.facet.numpunct.virtuals]. +using the method described in 22.2.3.1.2 [lib.facet.numpunct.virtuals].

    To:

    @@ -7688,7 +8380,7 @@ using the method described in 22.2.3.1.2 [lib.facet.numpunct.virtuals]. +using the method described in 22.2.3.1.2 [lib.facet.numpunct.virtuals].

    [ @@ -7708,27 +8400,173 @@ floating-point input even though this is unambiguously required by the standard. ]

    -

    [Post-Curaçao: the above proposed resolution is the consensus of +

    [Post-Curaçao: the above proposed resolution is the consensus of Howard, Bill, Pete, Benjamin, Nathan, Dietmar, Boris, and Martin.]


    -

    284. unportable example in 20.3.7, p6

    -Section: 20.3.7 [lib.function.pointer.adaptors]  Status: WP  Submitter: Martin Sebor  Date: 26 Dec 2000

    -

    The example in 20.3.7 [lib.function.pointer.adaptors], p6 shows how to use the C +

    283. std::replace() requirement incorrect/insufficient

    Section: 25.2.4 [lib.alg.replace]  Status: WP  Submitter: Martin Sebor  Date: 15 Dec 2000

    +

    +(revision of the further discussion) +There are a number of problems with the requires clauses for the +algorithms in 25.1 and 25.2. The requires clause of each algorithm +should describe the necessary and sufficient requirements on the inputs +to the algorithm such that the algorithm compiles and runs properly. +Many of the requires clauses fail to do this. Here is a summary of the kinds +of mistakes: +

    + +
      +
    1. +Use of EqualityComparable, which only puts requirements on a single +type, when in fact an equality operator is required between two +different types, typically either T and the iterator's value type +or between the value types of two different iterators. +
    2. +
    3. +Use of Assignable for T when in fact what was needed is Assignable +for the value_type of the iterator, and convertability from T to the +value_type of the iterator. Or for output iterators, the requirement +should be that T is writable to the iterator (output iterators do +not have value types). +
    4. +
    + +

    +Here is the list of algorithms that contain mistakes: +

    + +
      +
    • 25.1.2 std::find
    • +
    • 25.1.6 std::count
    • +
    • 25.1.8 std::equal
    • +
    • 25.1.9 std::search, std::search_n
    • +
    • 25.2.4 std::replace, std::replace_copy
    • +
    • 25.2.5 std::fill
    • +
    • 25.2.7 std::remove, std::remove_copy
    • +
    + +

    +Also, in the requirements for EqualityComparable, the requirement that +the operator be defined for const objects is lacking. +

    + +

    Proposed resolution:

    + +

    20.1.1 Change p1 from

    + +

    In Table 28, T is a type to be supplied by a C++ program +instantiating a template, a, b, and c are +values of type T. +

    + +

    to

    + +

    +In Table 28, T is a type to be supplied by a C++ program +instantiating a template, a, b, and c are +values of type const T. +

    + +

    25 Between p8 and p9

    + +

    Add the following sentence:

    + +

    When the description of an algorithm gives an expression such as +*first == value for a condition, it is required that the expression +evaluate to either true or false in boolean contexts.

    + +

    25.1.2 Change p1 by deleting the requires clause.

    + +

    25.1.6 Change p1 by deleting the requires clause.

    + +

    25.1.9

    + +

    Change p4 from

    + +

    -4- Requires: Type T is EqualityComparable +(20.1.1), type Size is convertible to integral type (4.7.12.3). +

    + +

    to

    + +

    -4- Requires: The type Size is convertible to integral +type (4.7.12.3).

    + +

    25.2.4 Change p1 from

    + +

    -1- Requires: Type T is Assignable (23.1 ) (and, for replace(), EqualityComparable (20.1.1 )).

    + +

    to

    + +

    -1- Requires: The expression *first = new_value must be valid.

    + +

    and change p4 from

    + +

    -4- Requires: Type T is Assignable (23.1) (and, +for replace_copy(), EqualityComparable +(20.1.1)). The ranges [first, last) and [result, result + +(last - first)) shall not overlap.

    + +

    to

    + +

    -4- Requires: The results of the expressions *first and +new_value must be writable to the result output iterator. The +ranges [first, last) and [result, result + (last - +first)) shall not overlap.

    + + +

    25.2.5 Change p1 from

    + +

    -1- Requires: Type T is Assignable (23.1). The +type Size is convertible to an integral type (4.7.12.3).

    + +

    to

    + +

    -1- Requires: The expression value must be is writable to +the output iterator. The type Size is convertible to an +integral type (4.7.12.3).

    + +

    25.2.7 Change p1 from

    + +

    -1- Requires: Type T is EqualityComparable (20.1.1).

    + +

    to

    + +

    +-1- Requires: The value type of the iterator must be +Assignable (23.1). +

    + +

    Rationale:

    +

    +The general idea of the proposed solution is to remove the faulty +requires clauses and let the returns and effects clauses speak for +themselves. That is, the returns clauses contain expressions that must +be valid, and therefore already imply the correct requirements. In +addition, a sentence is added at the beginning of chapter 25 saying +that expressions given as conditions must evaluate to true or false in +a boolean context. An alternative would be to say that the type of +these condition expressions must be literally bool, but that would be +imposing a greater restriction that what the standard currently says +(which is convertible to bool). +

    +
    +

    284. unportable example in 20.3.7, p6

    Section: 20.3.7 [lib.function.pointer.adaptors]  Status: WP  Submitter: Martin Sebor  Date: 26 Dec 2000

    +

    The example in 20.3.7 [lib.function.pointer.adaptors], p6 shows how to use the C library function strcmp() with the function pointer adapter ptr_fun(). But since it's unspecified whether the C library functions have extern "C" or extern -"C++" linkage [17.4.2.2 [lib.using.linkage]], and since +"C++" linkage [17.4.2.2 [lib.using.linkage]], and since function pointers with different the language linkage specifications -(7.5 [dcl.link]) are incompatible, whether this example is +(7.5 [dcl.link]) are incompatible, whether this example is well-formed is unspecified.

    Proposed resolution:

    -

    Change 20.3.7 [lib.function.pointer.adaptors] paragraph 6 from:

    +

    Change 20.3.7 [lib.function.pointer.adaptors] paragraph 6 from:

    -

    [Example: -

    -
        replace_if(v.begin(), v.end(), not1(bind2nd(ptr_fun(strcmp), "C")), "C++");
    +  

    [Example:

    +
    +    replace_if(v.begin(), v.end(), not1(bind2nd(ptr_fun(strcmp), "C")), "C++");
       

    replaces each C with C++ in sequence v.

    @@ -7736,9 +8574,9 @@ well-formed is unspecified.

    to:

    -

    [Example: -

    -
        int compare(const char*, const char*);
    +  

    [Example:

    +
    +    int compare(const char*, const char*);
         replace_if(v.begin(), v.end(),
                    not1(bind2nd(ptr_fun(compare), "abc")), "def");
       
    @@ -7758,10 +8596,9 @@ aren't normative), and changed the sentence after the footnote so that it corresponds to the new code fragment.]


    -

    285. minor editorial errors in fstream ctors

    -Section: 27.8.1.6 [lib.ifstream.cons]  Status: WP  Submitter: Martin Sebor  Date: 31 Dec 2000

    -

    27.8.1.6 [lib.ifstream.cons], p2, 27.8.1.9 [lib.ofstream.cons], p2, and -27.8.1.12 [lib.fstream.cons], p2 say about the effects of each constructor: +

    285. minor editorial errors in fstream ctors

    Section: 27.8.1.6 [lib.ifstream.cons]  Status: WP  Submitter: Martin Sebor  Date: 31 Dec 2000

    +

    27.8.1.6 [lib.ifstream.cons], p2, 27.8.1.9 [lib.ofstream.cons], p2, and +27.8.1.12 [lib.fstream.cons], p2 say about the effects of each constructor:

    ... If that function returns a null pointer, calls @@ -7769,7 +8606,7 @@ it corresponds to the new code fragment.]

    The parenthetical note doesn't apply since the ctors cannot throw an -exception due to the requirement in 27.4.4.1 [lib.basic.ios.cons], p3 +exception due to the requirement in 27.4.4.1 [lib.basic.ios.cons], p3 that exceptions() be initialized to ios_base::goodbit.

    Proposed resolution:

    @@ -7778,8 +8615,7 @@ Strike the parenthetical note from the Effects clause in each of the paragraphs mentioned above.


    -

    286. <cstdlib> requirements missing size_t typedef

    -Section: 25.4 [lib.alg.c.library]  Status: WP  Submitter: Judy Ward  Date: 30 Dec 2000

    +

    286. <cstdlib> requirements missing size_t typedef

    Section: 25.4 [lib.alg.c.library]  Status: WP  Submitter: Judy Ward  Date: 30 Dec 2000

    The <cstdlib> header file contains prototypes for bsearch and qsort (C++ Standard section 25.4 paragraphs 3 and 4) and other @@ -7795,8 +8631,7 @@ the type size_t <cstdlib> to Table 97 (section C.2).

    Rationale:

    Since size_t is in <stdlib.h>, it must also be in <cstdlib>.


    -

    288. <cerrno> requirements missing macro EILSEQ

    -Section: 19.3 [lib.errno]  Status: WP  Submitter: Judy Ward  Date: 30 Dec 2000

    +

    288. <cerrno> requirements missing macro EILSEQ

    Section: 19.3 [lib.errno]  Status: WP  Submitter: Judy Ward  Date: 30 Dec 2000

    ISO/IEC 9899:1990/Amendment1:1994 Section 4.3 States: "The list of macros defined in <errno.h> is adjusted to include a new @@ -7814,8 +8649,108 @@ Update Table 26 (section 19.3) "Header <cerrno> synopsis" and Table 95 (section C.2) "Standard Macros" to include EILSEQ.


    -

    292. effects of a.copyfmt (a)

    -Section: 27.4.4.2 [lib.basic.ios.members]  Status: WP  Submitter: Martin Sebor  Date: 05 Jan 2001

    +

    291. Underspecification of set algorithms

    Section: 25.3.5 [lib.alg.set.operations]  Status: WP  Submitter: Matt Austern  Date: 03 Jan 2001

    +

    +The standard library contains four algorithms that compute set +operations on sorted ranges: set_union, set_intersection, +set_difference, and set_symmetric_difference. Each +of these algorithms takes two sorted ranges as inputs, and writes the +output of the appropriate set operation to an output range. The elements +in the output range are sorted. +

    + +

    +The ordinary mathematical definitions are generalized so that they +apply to ranges containing multiple copies of a given element. Two +elements are considered to be "the same" if, according to an +ordering relation provided by the user, neither one is less than the +other. So, for example, if one input range contains five copies of an +element and another contains three, the output range of set_union +will contain five copies, the output range of +set_intersection will contain three, the output range of +set_difference will contain two, and the output range of +set_symmetric_difference will contain two. +

    + +

    +Because two elements can be "the same" for the purposes +of these set algorithms, without being identical in other respects +(consider, for example, strings under case-insensitive comparison), +this raises a number of unanswered questions: +

    + +
      +
    • If we're copying an element that's present in both of the +input ranges, which one do we copy it from?
    • +
    • If there are n copies of an element in the relevant +input range, and the output range will contain fewer copies (say +m) which ones do we choose? The first m, or the last +m, or something else?
    • +
    • Are these operations stable? That is, does a run of equivalent +elements appear in the output range in the same order as as it +appeared in the input range(s)?
    • +
    + +

    +The standard should either answer these questions, or explicitly +say that the answers are unspecified. I prefer the former option, +since, as far as I know, all existing implementations behave the +same way. +

    + +

    Proposed resolution:

    + +

    Add the following to the end of 25.3.5.2 [lib.set.union] paragraph 5:

    +
    +If [first1, last1) contains m elements that are equivalent to +each other and [first2, last2) contains n elements that are +equivalent to them, then max(m, n) of these elements +will be copied to the output range: all m of these elements +from [first1, last1), and the last max(n-m, 0) of them from +[first2, last2), in that order. +
    + +

    Add the following to the end of 25.3.5.3 [lib.set.intersection] paragraph 5:

    +
    +If [first1, last1) contains m elements that are equivalent to each +other and [first2, last2) contains n elements that are +equivalent to them, the first min(m, n) of those +elements from [first1, last1) are copied to the output range. +
    + +

    Add a new paragraph, Notes, after 25.3.5.4 [lib.set.difference] +paragraph 4:

    +
    +If [first1, last1) contains m elements that are equivalent to each +other and [first2, last2) contains n elements that are +equivalent to them, the last max(m-n, 0) elements from +[first1, last1) are copied to the output range. +
    + +

    Add a new paragraph, Notes, after 25.3.5.5 [lib.set.symmetric.difference] +paragraph 4:

    +
    +If [first1, last1) contains m elements that are equivalent to +each other and [first2, last2) contains n elements that are +equivalent to them, then |m - n| of those elements will be +copied to the output range: the last m - n of these elements +from [first1, last1) if m > n, and the last n - +m of these elements from [first2, last2) if m < n. +
    + +

    [Santa Cruz: it's believed that this language is clearer than + what's in the Standard. However, it's also believed that the + Standard may already make these guarantees (although not quite in + these words). Bill and Howard will check and see whether they think + that some or all of these changes may be redundant. If so, we may + close this issue as NAD.]

    + +

    Rationale:

    +

    For simple cases, these descriptions are equivalent to what's + already in the Standard. For more complicated cases, they describe + the behavior of existing implementations.

    +
    +

    292. effects of a.copyfmt (a)

    Section: 27.4.4.2 [lib.basic.ios.members]  Status: WP  Submitter: Martin Sebor  Date: 05 Jan 2001

    The Effects clause of the member function copyfmt() in 27.4.4.2, p15 doesn't consider the case where the left-hand side argument is identical to the argument on the right-hand side, that is @@ -7843,8 +8778,7 @@ assigns to the member objects of *this the corresponding member objects of rhs, except that...


    -

    295. Is abs defined in <cmath>?

    -Section: 26.5 [lib.c.math]  Status: WP  Submitter: Jens Maurer  Date: 12 Jan 2001

    +

    295. Is abs defined in <cmath>?

    Section: 26.5 [lib.c.math]  Status: WP  Submitter: Jens Maurer  Date: 12 Jan 2001

    Table 80 lists the contents of the <cmath> header. It does not list abs(). However, 26.5, paragraph 6, which lists added @@ -7854,7 +8788,7 @@ of abs() should be defined in <cmath>.

    Proposed resolution:

    Add abs to Table 80. Also, remove the parenthetical list -of functions "(abs(), div(), rand(), srand())" from 26.5 [lib.c.math], +of functions "(abs(), div(), rand(), srand())" from 26.5 [lib.c.math], paragraph 1.

    @@ -7865,10 +8799,9 @@ rid of that vestigial list of functions in paragraph 1.]

    All this DR does is fix a typo; it's uncontroversial. A separate question is whether we're doing the right thing in putting some overloads in <cmath> that we aren't also -putting in <cstdlib>. That's issue 323.

    +putting in <cstdlib>. That's issue 323.


    -

    297. const_mem_fun_t<>::argument_type should be const T*

    -Section: 20.3.8 [lib.member.pointer.adaptors]  Status: WP  Submitter: Martin Sebor  Date: 6 Jan 2001

    +

    297. const_mem_fun_t<>::argument_type should be const T*

    Section: 20.3.8 [lib.member.pointer.adaptors]  Status: WP  Submitter: Martin Sebor  Date: 6 Jan 2001

    The class templates const_mem_fun_t in 20.3.8, p8 and const_mem_fun1_t in 20.3.8, p9 derive from unary_function<T*, S>, and @@ -7883,8 +8816,7 @@ example below derived from existing code fails to compile due to the discrepancy:

    -

    -template <class T> +

    template <class T>
    void foo (typename T::argument_type arg)   // #1
    {
        typename T::result_type (T::*pf) (typename @@ -7896,8 +8828,7 @@ const =   // #2

    struct X { /* ... */ };

    -

    -int main () +

    int main ()
    {
        const X x;
        foo<std::const_mem_fun_t<void, X> @@ -7916,27 +8847,23 @@ function

    Replace the top portion of the definition of the class template const_mem_fun_t in 20.3.8, p8

    -

    -template <class S, class T> class const_mem_fun_t +

    template <class S, class T> class const_mem_fun_t
              : public unary_function<T*, S> {

    with

    -

    -template <class S, class T> class const_mem_fun_t +

    template <class S, class T> class const_mem_fun_t
              : public unary_function<const T*, S> {

    Also replace the top portion of the definition of the class template const_mem_fun1_t in 20.3.8, p9

    -

    -template <class S, class T, class A> class const_mem_fun1_t +

    template <class S, class T, class A> class const_mem_fun1_t
              : public binary_function<T*, A, S> {

    with

    -

    -template <class S, class T, class A> class const_mem_fun1_t +

    template <class S, class T, class A> class const_mem_fun1_t
              : public binary_function<const T*, A, S> {

    @@ -7944,8 +8871,7 @@ binary_function<const T*, A, S> {

    This is simply a contradiction: the argument_type typedef, and the argument type itself, are not the same.


    -

    298. ::operator delete[] requirement incorrect/insufficient

    -Section: 18.4.1.2 [lib.new.delete.array]  Status: WP  Submitter: John A. Pedretti  Date: 10 Jan 2001

    +

    298. ::operator delete[] requirement incorrect/insufficient

    Section: 18.4.1.2 [lib.new.delete.array]  Status: WP  Submitter: John A. Pedretti  Date: 10 Jan 2001

    The default behavior of operator delete[] described in 18.4.1.2, p12 - namely that for non-null value of ptr, the operator reclaims storage @@ -7968,7 +8894,7 @@ For a null value of ptr , does nothing. Any other value of ptr shall be a value returned earlier by a call to the default operator new[](std::size_t). [Footnote: The value must not have been invalidated by an intervening -call to operator delete[](void*) (17.4.3.7 [lib.res.on.arguments]). +call to operator delete[](void*) (17.4.3.7 [lib.res.on.arguments]). --- end footnote] For such a non-null value of ptr , reclaims storage allocated by the earlier call to the default operator new[]. @@ -7985,8 +8911,7 @@ or operator delete(ptr, std::nothrow) respectively.

    and expunge paragraph 13.


    -

    300. list::merge() specification incomplete

    -Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: John Pedretti  Date: 23 Jan 2001

    +

    300. list::merge() specification incomplete

    Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: John Pedretti  Date: 23 Jan 2001

    The "Effects" clause for list::merge() (23.2.2.4, p23) appears to be incomplete: it doesn't cover the case where the argument @@ -7995,7 +8920,7 @@ note in p24 (below) is that x be empty after the merge which is surely unintended in this case.

    Proposed resolution:

    -

    In 23.2.2.4 [lib.list.ops], replace paragraps 23-25 with:

    +

    In 23.2.2.4 [lib.list.ops], replace paragraps 23-25 with:

    23 Effects: if (&x == this) does nothing; otherwise, merges the two @@ -8024,17 +8949,16 @@ effects.

    [Copenhagen: The original proposed resolution did not fix all of -the problems in 23.2.2.4 [lib.list.ops], p22-25. Three different +the problems in 23.2.2.4 [lib.list.ops], p22-25. Three different paragraphs (23, 24, 25) describe the effects of merge. Changing p23, without changing the other two, appears to introduce contradictions. Additionally, "merges the argument list into the list" is excessively vague.]

    -

    [Post-Curaçao: Robert Klarer provided new wording.]

    +

    [Post-Curaçao: Robert Klarer provided new wording.]


    -

    301. basic_string template ctor effects clause omits allocator argument

    -Section: 21.3.1 [lib.string.cons]  Status: WP  Submitter: Martin Sebor  Date: 27 Jan 2001

    +

    301. basic_string template ctor effects clause omits allocator argument

    Section: 21.3.1 [lib.string.cons]  Status: WP  Submitter: Martin Sebor  Date: 27 Jan 2001

    The effects clause for the basic_string template ctor in 21.3.1, p15 leaves out the third argument of type Allocator. I believe this to be @@ -8044,8 +8968,7 @@ a mistake.

    Replace

    -

    --15- Effects: If InputIterator is an integral +

    -15- Effects: If InputIterator is an integral type, equivalent to

    basic_string(static_cast<size_type>(begin), @@ -8055,16 +8978,14 @@ a mistake.

    with

    -

    --15- Effects: If InputIterator is an integral +

    -15- Effects: If InputIterator is an integral type, equivalent to

    basic_string(static_cast<size_type>(begin), static_cast<value_type>(end), a)

    -

    303. Bitset input operator underspecified

    -Section: 23.3.5.3 [lib.bitset.operators]  Status: WP  Submitter: Matt Austern  Date: 5 Feb 2001

    +

    303. Bitset input operator underspecified

    Section: 23.3.5.3 [lib.bitset.operators]  Status: WP  Submitter: Matt Austern  Date: 5 Feb 2001

    In 23.3.5.3, we are told that bitset's input operator "Extracts up to N (single-byte) characters from @@ -8169,8 +9090,7 @@ input. Using widen does mean that alternative digit representations will not be recognized, but this was a known consequence of the design choice.


    -

    305. Default behavior of codecvt<wchar_t, char, mbstate_t>::length()

    -Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: WP  Submitter: Howard Hinnant  Date: 24 Jan 2001

    +

    305. Default behavior of codecvt<wchar_t, char, mbstate_t>::length()

    Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: WP  Submitter: Howard Hinnant  Date: 24 Jan 2001

    22.2.1.5/3 introduces codecvt in part with:

    @@ -8278,12 +9198,11 @@ single external character), but this would rule out important encodings that are in common use: it would rule out JIS, for example, and it would rule out a fixed-width encoding of UCS-4.

    -

    [Curaçao: fixed rationale typo at the request of Ichiro Koshida; +

    [Curaçao: fixed rationale typo at the request of Ichiro Koshida; "shift-JIS" changed to "JIS".]


    -

    306. offsetof macro and non-POD types

    -Section: 18.1 [lib.support.types]  Status: WP  Submitter: Steve Clamage  Date: 21 Feb 2001

    +

    306. offsetof macro and non-POD types

    Section: 18.1 [lib.support.types]  Status: WP  Submitter: Steve Clamage  Date: 21 Feb 2001

    Spliced together from reflector messages c++std-lib-8294 and -8295:

    18.1, paragraph 5, reads: "The macro offsetof @@ -8294,7 +9213,7 @@ that is a static data member or a function member is undefined."

    For the POD requirement, it doesn't say "no diagnostic -required" or "undefined behavior". I read 1.4 [intro.compliance], paragraph 1, to mean that a diagnostic is required. +required" or "undefined behavior". I read 1.4 [intro.compliance], paragraph 1, to mean that a diagnostic is required. It's not clear whether this requirement was intended. While it's possible to provide such a diagnostic, the extra complication doesn't seem to add any value. @@ -8309,14 +9228,13 @@ members thought that diagnostics should be required whenever possible.]


    -

    307. Lack of reference typedefs in container adaptors

    -Section: 23.2.3 [lib.container.adaptors]  Status: WP  Submitter: Howard Hinnant  Date: 13 Mar 2001

    +

    307. Lack of reference typedefs in container adaptors

    Section: 23.2.3 [lib.container.adaptors]  Status: WP  Submitter: Howard Hinnant  Date: 13 Mar 2001

    From reflector message c++std-lib-8330. See also lib-8317.

    -The standard is currently inconsistent in 23.2.3.2 [lib.priority.queue] -paragraph 1 and 23.2.3.3 [lib.stack] paragraph 1. +The standard is currently inconsistent in 23.2.3.2 [lib.priority.queue] +paragraph 1 and 23.2.3.3 [lib.stack] paragraph 1. 23.2.3.3/1, for example, says:

    @@ -8342,7 +9260,7 @@ container's reference type.

    I propose 3. This does not preclude option 2 if we choose to do it -later (see issue 96); the issues are independent. Option +later (see issue 96); the issues are independent. Option 3 offers a small step towards support for proxied containers. This small step fixes a current contradiction, is easy for vendors to implement, is already implemented in at least one popular lib, and @@ -8357,7 +9275,8 @@ priority_queue and stack. Change return types of "value_type&" to

    Change 23.2.3.1/1 from:

    -
      namespace std {
    +
    +  namespace std {
         template <class T, class Container = deque<T> >
         class queue {
         public:
    @@ -8383,7 +9302,8 @@ priority_queue and stack.  Change return types of "value_type&" to
     
     

    to:

    -
      namespace std {
    +
    +  namespace std {
         template <class T, class Container = deque<T> >
         class queue {
         public:
    @@ -8412,7 +9332,8 @@ priority_queue and stack.  Change return types of "value_type&" to
     
     

    Change 23.2.3.2/1 from:

    -
      namespace std {
    +
    +  namespace std {
         template <class T, class Container = vector<T>,
                   class Compare = less<typename Container::value_type> >
         class priority_queue {
    @@ -8444,7 +9365,8 @@ priority_queue and stack.  Change return types of "value_type&" to
     
     

    to:

    -
      namespace std {
    +
    +  namespace std {
         template <class T, class Container = vector<T>,
                   class Compare = less<typename Container::value_type> >
         class priority_queue {
    @@ -8478,7 +9400,8 @@ priority_queue and stack.  Change return types of "value_type&" to
     
     

    And change 23.2.3.3/1 from:

    -
      namespace std {
    +
    +  namespace std {
         template <class T, class Container = deque<T> >
         class stack {
         public:
    @@ -8522,7 +9445,8 @@ priority_queue and stack.  Change return types of "value_type&" to
     
     

    to:

    -
      namespace std {
    +
    +  namespace std {
         template <class T, class Container = deque<T> >
         class stack {
         public:
    @@ -8571,15 +9495,14 @@ and it was deliberately not adopted.  Nevertheless, the LWG believes
     (straw poll: 10-2) that it is a genuine defect.]


    -

    308. Table 82 mentions unrelated headers

    -Section: 27 [lib.input.output]  Status: WP  Submitter: Martin Sebor  Date: 15 Mar 2001

    +

    308. Table 82 mentions unrelated headers

    Section: 27 [lib.input.output]  Status: WP  Submitter: Martin Sebor  Date: 15 Mar 2001

    Table 82 in section 27 mentions the header <cstdlib> for String -streams (27.7 [lib.string.streams]) and the headers <cstdio> and -<cwchar> for File streams (27.8 [lib.file.streams]). It's not clear +streams (27.7 [lib.string.streams]) and the headers <cstdio> and +<cwchar> for File streams (27.8 [lib.file.streams]). It's not clear why these headers are mentioned in this context since they do not define any of the library entities described by the -subclauses. According to 17.4.1.1 [lib.contents], only such headers +subclauses. According to 17.4.1.1 [lib.contents], only such headers are to be listed in the summary.

    Proposed resolution:

    @@ -8589,11 +9512,10 @@ Table 82.

    [Copenhagen: changed the proposed resolution slightly. The original proposed resolution also said to remove <cstdio> from Table 82. However, <cstdio> is mentioned several times within -section 27.8 [lib.file.streams], including 27.8.2 [lib.c.files].]

    +section 27.8 [lib.file.streams], including 27.8.2 [lib.c.files].]


    -

    310. Is errno a macro?

    -Section: 17.4.1.2 [lib.headers], 19.3 [lib.errno]  Status: WP  Submitter: Steve Clamage  Date: 21 Mar 2001

    +

    310. Is errno a macro?

    Section: 17.4.1.2 [lib.headers], 19.3 [lib.errno]  Status: WP  Submitter: Steve Clamage  Date: 21 Mar 2001

    Exactly how should errno be declared in a conforming C++ header?

    @@ -8677,15 +9599,15 @@ not a name is a macro; it must explicitly specify exactly which names are required to be macros. The only one that really works is for it to be a macro.

    -

    [Curaçao: additional rationale added.]

    +

    [Curaçao: additional rationale added.]


    -

    311. Incorrect wording in basic_ostream class synopsis

    -Section: 27.6.2.1 [lib.ostream]  Status: WP  Submitter: Andy Sawyer  Date: 21 Mar 2001

    +

    311. Incorrect wording in basic_ostream class synopsis

    Section: 27.6.2.1 [lib.ostream]  Status: WP  Submitter: Andy Sawyer  Date: 21 Mar 2001

    -

    In 27.6.2.1 [lib.ostream], the synopsis of class basic_ostream says:

    +

    In 27.6.2.1 [lib.ostream], the synopsis of class basic_ostream says:

    -
      // partial specializationss
    +
    +  // partial specializationss
       template<class traits>
         basic_ostream<char,traits>& operator<<( basic_ostream<char,traits>&,
                                                 const char * );
    @@ -8698,31 +9620,29 @@ to be a macro.

Proposed resolution:

-

In the synopsis in 27.6.2.1 [lib.ostream], remove the +

In the synopsis in 27.6.2.1 [lib.ostream], remove the // partial specializationss comment. Also remove the same comment (correctly spelled, but still incorrect) from the synopsis in -27.6.2.5.4 [lib.ostream.inserters.character]. +27.6.2.5.4 [lib.ostream.inserters.character].

[ -Pre-Redmond: added 27.6.2.5.4 [lib.ostream.inserters.character] because of Martin's +Pre-Redmond: added 27.6.2.5.4 [lib.ostream.inserters.character] because of Martin's comment in c++std-lib-8939. ]


-

312. Table 27 is missing headers

-Section: 20 [lib.utilities]  Status: WP  Submitter: Martin Sebor  Date: 29 Mar 2001

+

312. Table 27 is missing headers

Section: 20 [lib.utilities]  Status: WP  Submitter: Martin Sebor  Date: 29 Mar 2001

Table 27 in section 20 lists the header <memory> (only) for Memory (lib.memory) but neglects to mention the headers -<cstdlib> and <cstring> that are discussed in 20.4.6 [lib.c.malloc].

+<cstdlib> and <cstring> that are discussed in 20.4.6 [lib.c.malloc].

Proposed resolution:

Add <cstdlib> and <cstring> to Table 27, in the same row as <memory>.


-

315. Bad "range" in list::unique complexity

-Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: Andy Sawyer  Date: 1 May 2001

+

315. Bad "range" in list::unique complexity

Section: 23.2.2.4 [lib.list.ops]  Status: WP  Submitter: Andy Sawyer  Date: 1 May 2001

-23.2.2.4 [lib.list.ops], Para 21 describes the complexity of +23.2.2.4 [lib.list.ops], Para 21 describes the complexity of list::unique as: "If the range (last - first) is not empty, exactly (last - first) -1 applications of the corresponding predicate, otherwise no applications of the predicate)". @@ -8736,8 +9656,7 @@ otherwise no applications of the predicate)". Change the "range" from (last - first) to [first, last).


-

316. Vague text in Table 69

-Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: Martin Sebor  Date: 4 May 2001

+

316. Vague text in Table 69

Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: Martin Sebor  Date: 4 May 2001

Table 69 says this about a_uniq.insert(t):

@@ -8757,8 +9676,7 @@ indicates whether the insertion takes place.

takes place...

-

317. Instantiation vs. specialization of facets

-Section: 22 [lib.localization]  Status: WP  Submitter: Martin Sebor  Date: 4 May 2001

+

317. Instantiation vs. specialization of facets

Section: 22 [lib.localization]  Status: WP  Submitter: Martin Sebor  Date: 4 May 2001

The localization section of the standard refers to specializations of the facet templates as instantiations even though the required facets @@ -8807,12 +9725,12 @@ describe templates was clarified during the standardization process, but the wording in clause 22 was never updated to reflect that change.


-

318. Misleading comment in definition of numpunct_byname

-Section: 22.2.3.2 [lib.locale.numpunct.byname]  Status: WP  Submitter: Martin Sebor  Date: 12 May 2001

+

318. Misleading comment in definition of numpunct_byname

Section: 22.2.3.2 [lib.locale.numpunct.byname]  Status: WP  Submitter: Martin Sebor  Date: 12 May 2001

The definition of the numpunct_byname template contains the following comment:

-
    namespace std {
+
+    namespace std {
         template <class charT>
         class numpunct_byname : public numpunct<charT> {
     // this class is specialized for char and wchar_t.
@@ -8824,15 +9742,14 @@ conceivable that an implementation will not explicitly specialize the
 template at all, but simply provide the primary template.

Proposed resolution:

Remove the comment from the text in 22.2.3.2 and from the proposed -resolution of library issue 228.

+resolution of library issue 228.


-

319. Storage allocation wording confuses "Required behavior", "Requires"

-Section: 18.4.1.1 [lib.new.delete.single], 18.4.1.2 [lib.new.delete.array]  Status: WP  Submitter: Beman Dawes  Date: 15 May 2001

-

The standard specifies 17.3.1.3 [lib.structure.specifications] that "Required +

319. Storage allocation wording confuses "Required behavior", "Requires"

Section: 18.4.1.1 [lib.new.delete.single], 18.4.1.2 [lib.new.delete.array]  Status: WP  Submitter: Beman Dawes  Date: 15 May 2001

+

The standard specifies 17.3.1.3 [lib.structure.specifications] that "Required behavior" elements describe "the semantics of a function definition provided by either the implementation or a C++ program."

-

The standard specifies 17.3.1.3 [lib.structure.specifications] that "Requires" +

The standard specifies 17.3.1.3 [lib.structure.specifications] that "Requires" elements describe "the preconditions for calling the function."

In the sections noted below, the current wording specifies @@ -8841,7 +9758,7 @@ should be specified as "Requires".

Proposed resolution:

-

In 18.4.1.1 [lib.new.delete.single] Para 12 Change:

+

In 18.4.1.1 [lib.new.delete.single] Para 12 Change:

Required behavior: accept a value of ptr that is null or that was returned by an earlier call ...

@@ -8852,7 +9769,7 @@ should be specified as "Requires".

earlier call ...

-

In 18.4.1.2 [lib.new.delete.array] Para 11 Change:

+

In 18.4.1.2 [lib.new.delete.array] Para 11 Change:

Required behavior: accept a value of ptr that is null or that was returned by an earlier call ...

@@ -8864,8 +9781,7 @@ should be specified as "Requires".


-

320. list::assign overspecified

-Section: 23.2.2.1 [lib.list.cons]  Status: WP  Submitter: Howard Hinnant  Date: 17 May 2001

+

320. list::assign overspecified

Section: 23.2.2.1 [lib.list.cons]  Status: WP  Submitter: Howard Hinnant  Date: 17 May 2001

Section 23.2.2.1, paragraphs 6-8 specify that list assign (both forms) have the "effects" of a call to erase followed by a call to insert. @@ -8896,7 +9812,8 @@ Metrowerks and SGI recycle nodes, Dinkumware and Rogue Wave don't.

Effects:

-
   erase(begin(), end());
+
+   erase(begin(), end());
    insert(begin(), first, last);
 
@@ -8907,9 +9824,10 @@ Metrowerks and SGI recycle nodes, Dinkumware and Rogue Wave don't.

Effects: Replaces the contents of the list with the range [first, last).

-

In 23.1.1 [lib.sequence.reqmts], in Table 67 (sequence requirements), +

In 23.1.1 [lib.sequence.reqmts], in Table 67 (sequence requirements), add two new rows:

-
      a.assign(i,j)     void      pre: i,j are not iterators into a.
+
+      a.assign(i,j)     void      pre: i,j are not iterators into a.
                                   Replaces elements in a with a copy
                                   of [i, j).
 
@@ -8922,7 +9840,8 @@ add two new rows:

Effects:

-
   erase(begin(), end());
+
+   erase(begin(), end());
    insert(begin(), n, t);
 
@@ -8942,14 +9861,13 @@ overspecification; it would effectively mandate that assignment use a temporary. Howard provided wording. ]

-

[Curaçao: Made editorial improvement in wording; changed +

[Curaçao: Made editorial improvement in wording; changed "Replaces elements in a with copies of elements in [i, j)." with "Replaces the elements of a with a copy of [i, j)." Changes not deemed serious enough to requre rereview.]


-

321. Typo in num_get

-Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: WP  Submitter: Kevin Djang  Date: 17 May 2001

+

321. Typo in num_get

Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: WP  Submitter: Kevin Djang  Date: 17 May 2001

Section 22.2.2.1.2 at p7 states that "A length specifier is added to the conversion function, if needed, as indicated in Table 56." @@ -8964,8 +9882,7 @@ to be "A length modifier is added ..."

Rationale:

C uses the term "length modifier". We should be consistent.


-

322. iterator and const_iterator should have the same value type

-Section: 23.1 [lib.container.requirements]  Status: WP  Submitter: Matt Austern  Date: 17 May 2001

+

322. iterator and const_iterator should have the same value type

Section: 23.1 [lib.container.requirements]  Status: WP  Submitter: Matt Austern  Date: 17 May 2001

It's widely assumed that, if X is a container, iterator_traits<X::iterator>::value_type and @@ -8977,7 +9894,7 @@ iterator_traits<X::const_iterator>::value_type should be "const X::value_type".

-

Related issue: 279.

+

Related issue: 279.

Proposed resolution:

In Table 65 ("Container Requirements"), change the return type for X::iterator to "iterator type whose value type is T". Change the @@ -8997,8 +9914,7 @@ the way that const pointers are handled: the standard already requires that iterator_traits<const int*>::value_type is int.


-

324. Do output iterators have value types?

-Section: 24.1.2 [lib.output.iterators]  Status: WP  Submitter: Dave Abrahams  Date: 7 June 2001

+

324. Do output iterators have value types?

Section: 24.1.2 [lib.output.iterators]  Status: WP  Submitter: Dave Abrahams  Date: 7 June 2001

Table 73 suggests that output iterators have value types. It requires the expression "*a = t". Additionally, although Table 73 @@ -9069,8 +9985,7 @@ the particular iterator type of i.

24.1 p9, add

-

-o denotes a value of some type that is writable to the +

o denotes a value of some type that is writable to the output iterator.

@@ -9078,28 +9993,32 @@ output iterator.

Table 73, change

-
*a = t
+
+*a = t
 

to

-
*r = o
+
+*r = o
 

and change

-
*r++ = t
+
+*r++ = t
 

to

-
*r++ = o
+
+*r++ = o
 
@@ -9117,8 +10036,7 @@ and any language suggesting otherwise is simply a mistake.

A future revision of the standard may wish to revisit this design decision.


-

325. Misleading text in moneypunct<>::do_grouping

-Section: 22.2.6.3.2 [lib.locale.moneypunct.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 02 Jul 2001

+

325. Misleading text in moneypunct<>::do_grouping

Section: 22.2.6.3.2 [lib.locale.moneypunct.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 02 Jul 2001

The Returns clause in 22.2.6.3.2, p3 says about moneypunct<charT>::do_grouping()

@@ -9170,8 +10088,7 @@ locale. It is just a reminder that the values are interpreted as small integers, not ASCII characters.


-

327. Typo in time_get facet in table 52

-Section: 22.1.1.1.1 [lib.locale.category]  Status: WP  Submitter: Tiki Wan  Date: 06 Jul 2001

+

327. Typo in time_get facet in table 52

Section: 22.1.1.1.1 [lib.locale.category]  Status: WP  Submitter: Tiki Wan  Date: 06 Jul 2001

The wchar_t versions of time_get and time_get_byname are listed incorrectly in table 52, required instantiations. In both cases the second template @@ -9180,12 +10097,14 @@ InputIterator, since these are input facets.

Proposed resolution:

In table 52, required instantiations, in -22.1.1.1.1 [lib.locale.category], change

-
    time_get<wchar_t, OutputIterator>
+22.1.1.1.1  [lib.locale.category], change

+
+    time_get<wchar_t, OutputIterator>
     time_get_byname<wchar_t, OutputIterator>
 

to

-
    time_get<wchar_t, InputIterator>
+
+    time_get<wchar_t, InputIterator>
     time_get_byname<wchar_t, InputIterator>
 
@@ -9193,8 +10112,7 @@ In table 52, required instantiations, in a typo, wchart instead of wchar_t.]


-

328. Bad sprintf format modifier in money_put<>::do_put()

-Section: 22.2.6.2.2 [lib.locale.money.put.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 07 Jul 2001

+

328. Bad sprintf format modifier in money_put<>::do_put()

Section: 22.2.6.2.2 [lib.locale.money.put.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 07 Jul 2001

The sprintf format string , "%.01f" (that's the digit one), in the description of the do_put() member functions of the money_put facet in 22.2.6.2.2, p1 is incorrect. First, the f format specifier is wrong @@ -9207,12 +10125,11 @@ modifier.

Rationale:

Fixes an obvious typo


-

329. vector capacity, reserve and reallocation

-Section: 23.2.4.2 [lib.vector.capacity], 23.2.4.3 [lib.vector.modifiers]  Status: WP  Submitter: Anthony Williams  Date: 13 Jul 2001

+

329. vector capacity, reserve and reallocation

Section: 23.2.4.2 [lib.vector.capacity], 23.2.4.3 [lib.vector.modifiers]  Status: WP  Submitter: Anthony Williams  Date: 13 Jul 2001

There is an apparent contradiction about which circumstances can cause -a reallocation of a vector in Section 23.2.4.2 [lib.vector.capacity] and -section 23.2.4.3 [lib.vector.modifiers]. +a reallocation of a vector in Section 23.2.4.2 [lib.vector.capacity] and +section 23.2.4.3 [lib.vector.modifiers].

23.2.4.2p5 says:

@@ -9226,7 +10143,8 @@ greater than the size specified in the most recent call to reserve().

Which implies if I do

-
  std::vector<int> vec;
+
+  std::vector<int> vec;
   vec.reserve(23);
   vec.reserve(0);
   vec.insert(vec.end(),1);
@@ -9264,7 +10182,7 @@ than the old capacity, I think the intent is clear.
 

Proposed resolution:

-

Change the wording of 23.2.4.2 [lib.vector.capacity] paragraph 5 to:

+

Change the wording of 23.2.4.2 [lib.vector.capacity] paragraph 5 to:

Notes: Reallocation invalidates all the references, pointers, and @@ -9288,16 +10206,16 @@ the argument to the first, the intent was for the second invocation to have no effect. Wording implying that such cases have an effect on reallocation guarantees was inadvertant.


-

331. bad declaration of destructor for ios_base::failure

-Section: 27.4.2.1.1 [lib.ios::failure]  Status: WP  Submitter: PremAnand M. Rao  Date: 23 Aug 2001

+

331. bad declaration of destructor for ios_base::failure

Section: 27.4.2.1.1 [lib.ios::failure]  Status: WP  Submitter: PremAnand M. Rao  Date: 23 Aug 2001

-With the change in 17.4.4.8 [lib.res.on.exception.handling] to state +With the change in 17.4.4.8 [lib.res.on.exception.handling] to state "An implementation may strengthen the exception-specification for a non-virtual function by removing listed exceptions." -(issue 119) +(issue 119) and the following declaration of ~failure() in ios_base::failure

-
    namespace std {
+
+    namespace std {
        class ios_base::failure : public exception {
        public:
            ...
@@ -9306,9 +10224,10 @@ and the following declaration of ~failure() in ios_base::failure
        };
      }
 
-

the class failure cannot be implemented since in 18.6.1 [lib.exception] the destructor of class exception has an empty +

the class failure cannot be implemented since in 18.6.1 [lib.exception] the destructor of class exception has an empty exception specification:

-
    namespace std {
+
+    namespace std {
        class exception {
        public:
          ...
@@ -9323,9 +10242,8 @@ exception specification:

The proposed resolution is consistent with the way that destructors of other classes derived from exception are handled.


-

333. does endl imply synchronization with the device?

-Section: 27.6.2.7 [lib.ostream.manip]  Status: WP  Submitter: PremAnand M. Rao  Date: 27 Aug 2001

-

A footnote in 27.6.2.7 [lib.ostream.manip] states:

+

333. does endl imply synchronization with the device?

Section: 27.6.2.7 [lib.ostream.manip]  Status: WP  Submitter: PremAnand M. Rao  Date: 27 Aug 2001

+

A footnote in 27.6.2.7 [lib.ostream.manip] states:

[Footnote: The effect of executing cout << endl is to insert a newline character in the output sequence controlled by cout, then @@ -9350,7 +10268,7 @@ I could not find any other statement that explicitly defined the behavior one way or the other.

Proposed resolution:

-

Remove footnote 300 from section 27.6.2.7 [lib.ostream.manip].

+

Remove footnote 300 from section 27.6.2.7 [lib.ostream.manip].

Rationale:

We already have normative text saying what endl does: it inserts a newline character and calls flush. This footnote @@ -9358,8 +10276,7 @@ is at best redundant, at worst (as this issue says) misleading, because it appears to make promises about what flush does.


-

334. map::operator[] specification forces inefficient implementation

-Section: 23.3.1.2 [lib.map.access]  Status: WP  Submitter: Andrea Griffini  Date: 02 Sep 2001

+

334. map::operator[] specification forces inefficient implementation

Section: 23.3.1.2 [lib.map.access]  Status: WP  Submitter: Andrea Griffini  Date: 02 Sep 2001

The current standard describes map::operator[] using a code example. That code example is however quite @@ -9371,7 +10288,8 @@ require all those temporary copies.

Currently map::operator[] behaviour is specified as:

-
  Returns:
+
+  Returns:
     (*((insert(make_pair(x, T()))).first)).second.
 
@@ -9398,7 +10316,8 @@ construction for each type).

A simple (half) solution would be replacing the description with:

-
  Returns:
+
+  Returns:
     (*((insert(value_type(x, T()))).first)).second.
 
@@ -9436,7 +10355,7 @@ non-conforming.

Proposed resolution:

-Replace 23.3.1.2 [lib.map.access] paragraph 1 with +Replace 23.3.1.2 [lib.map.access] paragraph 1 with

@@ -9455,7 +10374,7 @@ value_type(x, T()) into the map. wording. We may also wish to have a blanket statement somewhere in clause 17 saying that we do not intend the semantics of sample code fragments to be interpreted as specifing exactly how many copies are -made. See issue 98 for a similar problem.]

+made. See issue 98 for a similar problem.]

Rationale:

@@ -9467,13 +10386,13 @@ consistent with existing practice. we are no longer defining operator[] in terms of insert.


-

335. minor issue with char_traits, table 37

-Section: 21.1.1 [lib.char.traits.require]  Status: WP  Submitter: Andy Sawyer  Date: 06 Sep 2001

+

335. minor issue with char_traits, table 37

Section: 21.1.1 [lib.char.traits.require]  Status: WP  Submitter: Andy Sawyer  Date: 06 Sep 2001

-Table 37, in 21.1.1 [lib.char.traits.require], descibes char_traits::assign +Table 37, in 21.1.1 [lib.char.traits.require], descibes char_traits::assign as:

-
  X::assign(c,d)   assigns c = d.
+
+  X::assign(c,d)   assigns c = d.
 

And para 1 says:

@@ -9490,7 +10409,8 @@ assign, at least), 'c' is intended to be a reference type.

I did a quick survey of the four implementations I happened to have lying around, and sure enough they all have signatures:

-
    assign( charT&, const charT& );
+
+    assign( charT&, const charT& );
 

(or the equivalent). It's also described this way in Nico's book. @@ -9504,14 +10424,14 @@ and char_traits<wchar_t> in 21.1.3.2...)

and change the description of assign in the table to:

-
  X::assign(r,d)   assigns r = d
+
+  X::assign(r,d)   assigns r = d
 

-

336. Clause 17 lack of references to deprecated headers

-Section: 17 [lib.library]  Status: WP  Submitter: Detlef Vollmann  Date: 05 Sep 2001

+

336. Clause 17 lack of references to deprecated headers

Section: 17 [lib.library]  Status: WP  Submitter: Detlef Vollmann  Date: 05 Sep 2001

From c++std-edit-873:

-

17.4.1.2 [lib.headers], Table 11. In this table, the header +

17.4.1.2 [lib.headers], Table 11. In this table, the header <strstream> is missing.

This shows a general problem: The whole clause 17 refers quite @@ -9520,49 +10440,47 @@ library (though a deprecated one).

Proposed resolution:

-

To 17.4.1.2 [lib.headers] Table 11, C++ Library Headers, add +

To 17.4.1.2 [lib.headers] Table 11, C++ Library Headers, add "<strstream>".

In the following places, change "clauses 17 through 27" to "clauses 17 through 27 and Annex D":


-

337. replace_copy_if's template parameter should be InputIterator

-Section: 25.2.4 [lib.alg.replace]  Status: WP  Submitter: Detlef Vollmann  Date: 07 Sep 2001

+

337. replace_copy_if's template parameter should be InputIterator

Section: 25.2.4 [lib.alg.replace]  Status: WP  Submitter: Detlef Vollmann  Date: 07 Sep 2001

From c++std-edit-876:

-In section 25.2.4 [lib.alg.replace] before p4: The name of the first +In section 25.2.4 [lib.alg.replace] before p4: The name of the first parameter of template replace_copy_if should be "InputIterator" -instead of "Iterator". According to 17.3.2.1 [lib.type.descriptions] p1 the +instead of "Iterator". According to 17.3.2.1 [lib.type.descriptions] p1 the parameter name conveys real normative meaning.

Proposed resolution:

Change Iterator to InputIterator.


-

338.  is whitespace allowed between `-' and a digit?

-Section: 22.2 [lib.locale.categories]  Status: WP  Submitter: Martin Sebor  Date: 17 Sep 2001

+

338.  is whitespace allowed between `-' and a digit?

Section: 22.2 [lib.locale.categories]  Status: WP  Submitter: Martin Sebor  Date: 17 Sep 2001

-From Stage 2 processing in 22.2.2.1.2 [lib.facet.num.get.virtuals], p8 and 9 (the +From Stage 2 processing in 22.2.2.1.2 [lib.facet.num.get.virtuals], p8 and 9 (the original text or the text corrected by the proposed resolution of -issue 221) it seems clear that no whitespace is allowed -within a number, but 22.2.3.1 [lib.locale.numpunct], p2, which gives the +issue 221) it seems clear that no whitespace is allowed +within a number, but 22.2.3.1 [lib.locale.numpunct], p2, which gives the format for integer and floating point values, says that whitespace is optional between a plusminus and a sign.

@@ -9572,10 +10490,10 @@ The text needs to be clarified to either consistently allow or disallow whitespace between a plusminus and a sign. It might be worthwhile to consider the fact that the C library stdio facility does not permit whitespace embedded in numbers and neither does the C or -C++ core language (the syntax of integer-literals is given in 2.13.1 [lex.icon], that of floating-point-literals in 2.13.3 [lex.fcon] of the C++ standard). +C++ core language (the syntax of integer-literals is given in 2.13.1 [lex.icon], that of floating-point-literals in 2.13.3 [lex.fcon] of the C++ standard).

Proposed resolution:

-

Change the first part of 22.2.3.1 [lib.locale.numpunct] paragraph 2 from:

+

Change the first part of 22.2.3.1 [lib.locale.numpunct] paragraph 2 from:

The syntax for number formats is as follows, where digit @@ -9586,7 +10504,8 @@ value, whitespace is as determined by the facet numpunct<charT> members. Integer values have the format:

-
  integer   ::= [sign] units
+
+  integer   ::= [sign] units
   sign      ::= plusminus [whitespace]
   plusminus ::= '+' | '-'
   units     ::= digits [thousands-sep units]
@@ -9602,7 +10521,8 @@ value, and thousands-sep and decimal-point are the
 results of corresponding numpunct<charT> members.
 Integer values have the format:
 

-
  integer   ::= [sign] units
+
+  integer   ::= [sign] units
   sign      ::= plusminus
   plusminus ::= '+' | '-'
   units     ::= digits [thousands-sep units]
@@ -9610,17 +10530,16 @@ Integer values have the format:
 

Rationale:

-

It's not clear whether the format described in 22.2.3.1 [lib.locale.numpunct] paragraph 2 has any normative weight: nothing in the +

It's not clear whether the format described in 22.2.3.1 [lib.locale.numpunct] paragraph 2 has any normative weight: nothing in the standard says how, or whether, it's used. However, there's no reason for it to differ gratuitously from the very specific description of -numeric processing in 22.2.2.1.2 [lib.facet.num.get.virtuals]. The proposed +numeric processing in 22.2.2.1.2 [lib.facet.num.get.virtuals]. The proposed resolution removes all mention of "whitespace" from that format.


-

339. definition of bitmask type restricted to clause 27

-Section: 22.2.1 [lib.category.ctype], 17.3.2.1.2 [lib.bitmask.types]  Status: WP  Submitter: Martin Sebor  Date: 17 September 2001

+

339. definition of bitmask type restricted to clause 27

Section: 22.2.1 [lib.category.ctype], 17.3.2.1.2 [lib.bitmask.types]  Status: WP  Submitter: Martin Sebor  Date: 17 September 2001

-The ctype_category::mask type is declared to be an enum in 22.2.1 [lib.category.ctype] with p1 then stating that it is a bitmask type, most -likely referring to the definition of bitmask type in 17.3.2.1.2 [lib.bitmask.types], p1. However, the said definition only applies to +The ctype_category::mask type is declared to be an enum in 22.2.1 [lib.category.ctype] with p1 then stating that it is a bitmask type, most +likely referring to the definition of bitmask type in 17.3.2.1.2 [lib.bitmask.types], p1. However, the said definition only applies to clause 27, making the reference in 22.2.1 somewhat dubious.

Proposed resolution:

@@ -9628,7 +10547,7 @@ clause 27, making the reference in 22.2.1 somewhat dubious.
Several types defined in clause 27 are bitmask types. Each bitmask type can be implemented as an enumerated type that overloads certain operators, - as an integer type, or as a bitset (23.3.5 [lib.template.bitset]). + as an integer type, or as a bitset (23.3.5 [lib.template.bitset]).

to read

@@ -9647,7 +10566,8 @@ following (note, in particluar, the cross-reference to 17.3.2.1.2 in

22.2.1 The ctype category [lib.category.ctype]

-
namespace std {
+
+namespace std {
     class ctype_base {
     public:
         typedef T mask;
@@ -9668,16 +10588,15 @@ following (note, in particluar, the cross-reference to 17.3.2.1.2 in
 }
 
-

The type mask is a bitmask type (17.3.2.1.2 [lib.bitmask.types]).

+

The type mask is a bitmask type (17.3.2.1.2 [lib.bitmask.types]).

-

[Curaçao: The LWG notes that T above should be bold-italics to be +

[Curaçao: The LWG notes that T above should be bold-italics to be consistent with the rest of the standard.]


340. interpretation of has_facet<Facet>(loc) -

-Section: 22.1.1.1.1 [lib.locale.category]  Status: WP  Submitter: Martin Sebor  Date: 18 Sep 2001

+

Section: 22.1.1.1.1 [lib.locale.category]  Status: WP  Submitter: Martin Sebor  Date: 18 Sep 2001

It's unclear whether 22.1.1.1.1, p3 says that has_facet<Facet>(loc) returns true for any Facet @@ -9724,7 +10643,7 @@ to hold only for specializations of Facet from Table 52 on }.

Proposed resolution:

-

In 22.1.1.1.1 [lib.locale.category], paragraph 3, change +

In 22.1.1.1.1 [lib.locale.category], paragraph 3, change "that is a member of a standard category" to "shown in Table 51".

Rationale:

The facets in Table 52 are an unbounded set. Locales should not be @@ -9734,26 +10653,26 @@ required to contain an infinite number of facets.

OutputIterator must be supported. Table 51 already contains a complete list of the ones we need.


-

341. Vector reallocation and swap

-Section: 23.2.4.2 [lib.vector.capacity]  Status: WP  Submitter: Anthony Williams  Date: 27 Sep 2001

+

341. Vector reallocation and swap

Section: 23.2.4.2 [lib.vector.capacity]  Status: WP  Submitter: Anthony Williams  Date: 27 Sep 2001

It is a common idiom to reduce the capacity of a vector by swapping it with an empty one:

-
  std::vector<SomeType> vec;
+
+  std::vector<SomeType> vec;
   // fill vec with data
   std::vector<SomeType>().swap(vec);
   // vec is now empty, with minimal capacity
 
-

However, the wording of 23.2.4.2 [lib.vector.capacity]paragraph 5 prevents +

However, the wording of 23.2.4.2 [lib.vector.capacity]paragraph 5 prevents the capacity of a vector being reduced, following a call to reserve(). This invalidates the idiom, as swap() is thus prevented -from reducing the capacity. The proposed wording for issue 329 does not affect this. Consequently, the example above +from reducing the capacity. The proposed wording for issue 329 does not affect this. Consequently, the example above requires the temporary to be expanded to cater for the contents of vec, and the contents be copied across. This is a linear-time operation.

However, the container requirements state that swap must have constant -complexity (23.1 [lib.container.requirements] note to table 65).

+complexity (23.1 [lib.container.requirements] note to table 65).

This is an important issue, as reallocation affects the validity of references and iterators.

@@ -9775,15 +10694,14 @@ pointing to the same element. Consequently iterators and references that referred to one vector now refer to the other, and vice-versa.

Proposed resolution:

-

Add a new paragraph after 23.2.4.2 [lib.vector.capacity] paragraph 5:

+

Add a new paragraph after 23.2.4.2 [lib.vector.capacity] paragraph 5:

-
  void swap(vector<T,Allocator>& x);
+
+  void swap(vector<T,Allocator>& x);
 
-

-Effects: Exchanges the contents and capacity() of *this +

Effects: Exchanges the contents and capacity() of *this with that of x.

-

-Complexity: Constant time.

+

Complexity: Constant time.

[This solves the problem reported for this issue. We may also @@ -9797,18 +10715,16 @@ do pointer twiddling, and that it should exchange all properties of the two vectors, including their reallocation guarantees.


-

345. type tm in <cwchar>

-Section: 21.4 [lib.c.strings]  Status: WP  Submitter: Clark Nelson  Date: 19 Oct 2001

+

345. type tm in <cwchar>

Section: 21.4 [lib.c.strings]  Status: WP  Submitter: Clark Nelson  Date: 19 Oct 2001

C99, and presumably amendment 1 to C90, specify that <wchar.h> -declares struct tm as an incomplete type. However, table 48 in 21.4 [lib.c.strings] does not mention the type tm as being declared in +declares struct tm as an incomplete type. However, table 48 in 21.4 [lib.c.strings] does not mention the type tm as being declared in <cwchar>. Is this omission intentional or accidental?

Proposed resolution:

-

In section 21.4 [lib.c.strings], add "tm" to table 48.

+

In section 21.4 [lib.c.strings], add "tm" to table 48.


-

346. Some iterator member functions should be const

-Section: 24.1 [lib.iterator.requirements]  Status: WP  Submitter: Jeremy Siek  Date: 20 Oct 2001

+

346. Some iterator member functions should be const

Section: 24.1 [lib.iterator.requirements]  Status: WP  Submitter: Jeremy Siek  Date: 20 Oct 2001

Iterator member functions and operators that do not change the state of the iterator should be defined as const member functions or as functions that take iterators either by const reference or by @@ -9820,38 +10736,132 @@ are suggested to make this explicit.

for non-const and a,b for const iterators. The following changes make this more explicit and also fix a couple problems.

Proposed resolution:

-

In 24.1 [lib.iterator.requirements] Change the first section of p9 from +

In 24.1 [lib.iterator.requirements] Change the first section of p9 from "In the following sections, a and b denote values of X..." to "In the following sections, a and b denote values of type const X...".

In Table 73, change

-
    a->m   U&         ...
+
+    a->m   U&         ...
 

to

-
    a->m   const U&   ...
+
+    a->m   const U&   ...
     r->m   U&         ...
 

In Table 73 expression column, change

-
    *a = t
+
+    *a = t
 

to

-
    *r = t
+
+    *r = t
 

[Redmond: The container requirements should be reviewed to see if the same problem appears there.]


-

349. Minor typographical error in ostream_iterator

-Section: 24.5.2 [lib.ostream.iterator]  Status: WP  Submitter: Andy Sawyer  Date: 24 Oct 2001

+

347. locale::category and bitmask requirements

Section: 22.1.1.1.1 [lib.locale.category]  Status: WP  Submitter: P.J. Plauger, Nathan Myers  Date: 23 Oct 2001

+

+In 22.1.1.1.1 [lib.locale.category] paragraph 1, the category members +are described as bitmask elements. In fact, the bitmask requirements +in 17.3.2.1.2 [lib.bitmask.types] don't seem quite right: none +and all are bitmask constants, not bitmask elements.

+ +

In particular, the requirements for none interact poorly +with the requirement that the LC_* constants from the C library must +be recognizable as C++ locale category constants. LC_* values should +not be mixed with these values to make category values.

+ +

We have two options for the proposed resolution. Informally: +option 1 removes the requirement that LC_* values be recognized as +category arguments. Option 2 changes the category type so that this +requirement is implementable, by allowing none to be some +value such as 0x1000 instead of 0.

+ +

Nathan writes: "I believe my proposed resolution [Option 2] merely +re-expresses the status quo more clearly, without introducing any +changes beyond resolving the DR.

+ +

Proposed resolution:

+

Replace the first two paragraphs of 22.1.1.1 [lib.locale.types] with:

+
+
+    typedef int category;
+
+ +

Valid category values include the locale member bitmask +elements collate, ctype, monetary, +numeric, time, and messages, each of which +represents a single locale category. In addition, locale member +bitmask constant none is defined as zero and represents no +category. And locale member bitmask constant all is defined such that +the expression

+
+    (collate | ctype | monetary | numeric | time | messages | all) == all
+
+

+is true, and represents the union of all categories. Further +the expression (X | Y), where X and Y each +represent a single category, represents the union of the two +categories. +

+ +

+locale member functions expecting a category +argument require one of the category values defined above, or +the union of two or more such values. Such a category +argument identifies a set of locale categories. Each locale category, +in turn, identifies a set of locale facets, including at least those +shown in Table 51: +

+
+

[Curaçao: need input from locale experts.]

+ +

Rationale:

+ +

The LWG considered, and rejected, an alternate proposal (described + as "Option 2" in the discussion). The main reason for rejecting it + was that library implementors were concerened about implementation + difficult, given that getting a C++ library to work smoothly with a + separately written C library is already a delicate business. Some + library implementers were also concerned about the issue of adding + extra locale categories.

+ +
+

Option 2:
+Replace the first paragraph of 22.1.1.1 [lib.locale.types] with:

+
+

+Valid category values include the enumerated values. In addition, the +result of applying commutative operators | and & to any two valid +values is valid, and results in the setwise union and intersection, +respectively, of the argument categories. The values all and +none are defined such that for any valid value cat, the +expressions (cat | all == all), (cat & all == cat), +(cat | none == cat) and (cat & none == none) are +true. For non-equal values cat1 and cat2 of the +remaining enumerated values, (cat1 & cat2 == none) is true. +For any valid categories cat1 and cat2, the result +of (cat1 & ~cat2) is valid, and equals the setwise union of +those categories found in cat1 but not found in cat2. +[Footnote: it is not required that all equal the setwise union +of the other enumerated values; implementations may add extra categories.] +

+
+
+
+

349. Minor typographical error in ostream_iterator

Section: 24.5.2 [lib.ostream.iterator]  Status: WP  Submitter: Andy Sawyer  Date: 24 Oct 2001

24.5.2 [lib.ostream.iterator] states:

-
    [...]
+
+    [...]
 
     private:
     // basic_ostream<charT,traits>* out_stream; exposition only
@@ -9862,12 +10872,54 @@ the same problem appears there.]

should be of type 'const charT*'.

Proposed resolution:

-In 24.5.2 [lib.ostream.iterator], replace const char* delim with +In 24.5.2 [lib.ostream.iterator], replace const char* delim with const charT* delim.


-

354. Associative container lower/upper bound requirements

-Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: Hans Aberg  Date: 17 Dec 2001

+

352. missing fpos requirements

Section: 21.1.2 [lib.char.traits.typedefs]  Status: WP  Submitter: Martin Sebor  Date: 2 Dec 2001

+

+(1) +There are no requirements on the stateT template parameter of +fpos listed in 27.4.3. The interface appears to require that +the type be at least Assignable and CopyConstructible (27.4.3.1, p1), +and I think also DefaultConstructible (to implement the operations in +Table 88). +

+

+21.1.2, p3, however, only requires that +char_traits<charT>::state_type meet the requirements of +CopyConstructible types. +

+

+(2) +Additionally, the stateT template argument has no +corresponding typedef in fpos which might make it difficult to use in +generic code. +

+

Proposed resolution:

+

+Modify 21.1.2, p4 from +

+

+ Requires: state_type shall meet the requirements of + CopyConstructible types (20.1.3). +

+

+ Requires: state_type shall meet the requirements of Assignable + (23.1, p4), CopyConstructible (20.1.3), and + DefaultConstructible (20.1.4) types. +

+ +

Rationale:

+

The LWG feels this is two issues, as indicated above. The first is +a defect---std::basic_fstream is unimplementable without these +additional requirements---and the proposed resolution fixes it. The +second is questionable; who would use that typedef? The class +template fpos is used only in a very few places, all of which know the +state type already. Unless motivation is provided, the second should +be considered NAD.

+
+

354. Associative container lower/upper bound requirements

Section: 23.1.2 [lib.associative.reqmts]  Status: WP  Submitter: Hans Aberg  Date: 17 Dec 2001

Discussions in the thread "Associative container lower/upper bound requirements" on comp.std.c++ suggests that there is a defect in the @@ -9901,7 +10953,7 @@ the intention (and not possible with the "const" versions).

Proposed resolution:

-

Change Table 69 of section 23.1.2 [lib.associative.reqmts] indicated entries +

Change Table 69 of section 23.1.2 [lib.associative.reqmts] indicated entries to:

@@ -9916,12 +10968,80 @@ key greater than k, or a.end() if such an element is not found.

-

[Curaçao: LWG reviewed PR.]

+

[Curaçao: LWG reviewed PR.]

+ +
+

355. Operational semantics for a.back()

Section: 23.1.1 [lib.sequence.reqmts]  Status: WP  Submitter: Yaroslav Mironov  Date: 23 Jan 2002

+ +

Table 68 "Optional Sequence Operations" in 23.1.1/12 +specifies operational semantics for "a.back()" as +"*--a.end()", which may be ill-formed [because calling +operator-- on a temporary (the return) of a built-in type is +ill-formed], provided a.end() returns a simple pointer rvalue +(this is almost always the case for std::vector::end(), for +example). Thus, the specification is not only incorrect, it +demonstrates a dangerous construct: "--a.end()" may +successfully compile and run as intended, but after changing the type +of the container or the mode of compilation it may produce +compile-time error.

+ +

Proposed resolution:

+

Change the specification in table 68 "Optional Sequence +Operations" in 23.1.1/12 for "a.back()" from

+ + +
+*--a.end() +
+ +

to

+ +
+ { iterator tmp = a.end(); --tmp; return *tmp; } +
+ +

and the specification for "a.pop_back()" from

+ +
+a.erase(--a.end()) +
+ +

to

+ +
+ { iterator tmp = a.end(); --tmp; a.erase(tmp); } +
+ +

[Curaçao: LWG changed PR from "{ X::iterator tmp = +a.end(); return *--tmp; }" to "*a.rbegin()", and from +"{ X::iterator tmp = a.end(); a.erase(--tmp); }" to +"a.erase(rbegin())".]

+ +

[There is a second possible defect; table 68 "Optional +Sequence Operations" in the "Operational Semantics" +column uses operations present only in the "Reversible +Container" requirements, yet there is no stated dependency +between these separate requirements tables. Ask in Santa Cruz if the +LWG would like a new issue opened.]

+ +

[Santa Cruz: the proposed resolution is even worse than what's in + the current standard: erase is undefined for reverse iterator. If + we're going to make the change, we need to define a temporary and + use operator--. Additionally, we don't know how prevalent this is: + do we need to make this change in more than one place? Martin has + volunteered to review the standard and see if this problem occurs + elsewhere.]

+ +

[Oxford: Matt provided new wording to address the concerns raised + in Santa Cruz. It does not appear that this problem appears + anywhere else in clauses 23 or 24.]

+ +

[Kona: In definition of operational semantics of back(), change +"*tmp" to "return *tmp;"]


358. interpreting thousands_sep after a decimal_point -

-Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 12 Mar 2002

+

Section: 22.2.2.1.2 [lib.facet.num.get.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 12 Mar 2002

I don't think thousands_sep is being treated correctly after decimal_point has been seen. Since grouping applies only to the @@ -9967,8 +11087,96 @@ Change the first sentence of 22.2.2.1.2, p9 from support for such conventions, we need to do so explicitly.


-

360. locale mandates inefficient implementation

-Section: 22.1.1 [lib.locale]  Status: WP  Submitter: Martin Sebor  Date: 12 Mar 2002

+

359. num_put<>::do_put (..., bool) undocumented

Section: 22.2.2.2.1 [lib.facet.num.put.members]  Status: WP  Submitter: Martin Sebor  Date: 12 Mar 2002

+

22.2.2.2.1, p1:

+ +
+    iter_type put (iter_type out, ios_base& str, char_type fill,
+                   bool val) const;
+    ...
+
+    1   Returns: do_put (out, str, fill, val).
+    
+ +

AFAICS, the behavior of do_put (..., bool) is not documented anywhere, +however, 22.2.2.2.2, p23:

+ +
+
+iter_type put (iter_type out, ios_base& str, char_type fill,
+               bool val) const;
+
+ + + Effects: If (str.flags() & ios_base::boolalpha) == 0 then do + out = do_put(out, str, fill, (int)val) + Otherwise do +
+             string_type s =
+                 val ? use_facet<ctype<charT> >(loc).truename()
+                     : use_facet<ctype<charT> >(loc).falsename();
+
+ and then insert the characters of s into out. out. +
+ +

+This means that the bool overload of do_put() will never be called, +which contradicts the first paragraph. Perhaps the declaration +should read do_put(), and not put()? +

+ +

+Note also that there is no Returns clause for this function, which +should probably be corrected, just as should the second occurrence +of "out." in the text. +

+ +

+I think the least invasive change to fix it would be something like +the following: +

+

Proposed resolution:

+

In 22.2.2.2.2 [lib.facet.num.put.virtuals], just above paragraph 1, remove + the bool overload.

+ +

+In 22.2.2.2.2 [lib.facet.num.put.virtuals], p23, make the following changes +

+ +
+ Replace put() with do_put() in the declaration + of the member function. +
+ +
+ Change the Effects clause to a Returns clause (to + avoid the requirement to call do_put(..., int) from + do_put (..., bool)) + like so: +
+ +
+ 23 Returns: If (str.flags() & + ios_base::boolalpha) == 0 then + do_put (out, str, fill, (long)val) + Otherwise the function obtains a string s as if by +
+             string_type s =
+                val ? use_facet<ctype<charT> >(loc).truename()
+                    : use_facet<ctype<charT> >(loc).falsename();
+
+ and then inserts each character c of s into out via + *out++ = c + and returns out. +
+ +

Rationale:

+

+This fixes a couple of obvious typos, and also fixes what appears to +be a requirement of gratuitous inefficiency. +

+
+

360. locale mandates inefficient implementation

Section: 22.1.1 [lib.locale]  Status: WP  Submitter: Martin Sebor  Date: 12 Mar 2002

22.1.1, p7 (copied below) allows iostream formatters and extractors to make assumptions about the values returned from facet members. @@ -10004,8 +11212,7 @@ prevents locale from being implemented efficiently.

This change is reasonable becuase it clarifies the intent of this part of the standard.


-

363. Missing exception specification in 27.4.2.1.1

-Section: 27.4.2.1.1 [lib.ios::failure]  Status: WP  Submitter: Walter Brown and Marc Paterno  Date: 20 May 2002

+

363. Missing exception specification in 27.4.2.1.1

Section: 27.4.2.1.1 [lib.ios::failure]  Status: WP  Submitter: Walter Brown and Marc Paterno  Date: 20 May 2002

The destructor of ios_base::failure should have an empty throw specification, because the destructor of its base class, exception, is @@ -10013,15 +11220,15 @@ declared in this way.

Proposed resolution:

Change the destructor to

-
  virtual ~failure() throw();
+
+  virtual ~failure() throw();
 

Rationale:

Fixes an obvious glitch. This is almost editorial.


-

364. Inconsistent wording in 27.5.2.4.2

-Section: 27.5.2.4.2 [lib.streambuf.virt.buffer]  Status: WP  Submitter: Walter Brown, Marc Paterno  Date: 10 May 2002

+

364. Inconsistent wording in 27.5.2.4.2

Section: 27.5.2.4.2 [lib.streambuf.virt.buffer]  Status: WP  Submitter: Walter Brown, Marc Paterno  Date: 10 May 2002

-27.5.2.4.2 [lib.streambuf.virt.buffer] paragraph 1 is inconsistent with the Effects +27.5.2.4.2 [lib.streambuf.virt.buffer] paragraph 1 is inconsistent with the Effects clause for seekoff.

Proposed resolution:

@@ -10051,12 +11258,53 @@ for each class derived from basic_streambuf in this clause the existing wording and what's in the proposed resolution, but the change may make the intent clearer.


-

370. Minor error in basic_istream::get

-Section: 27.6.1.3 [lib.istream.unformatted]  Status: WP  Submitter: Ray Lischner  Date: 15 Jul 2002

-

Defect report for description of basic_istream::get (section 27.6.1.3 [lib.istream.unformatted]), paragraph 15. The description for the get function +

365. Lack of const-qualification in clause 27

Section: 27 [lib.input.output]  Status: WP  Submitter: Walter Brown, Marc Paterno  Date: 10 May 2002

+

+Some stream and streambuf member functions are declared non-const, +even thought they appear only to report information rather than to +change an object's logical state. They should be declared const. See +document N1360 for details and rationale. +

+ +

The list of member functions under discussion: in_avail, +showmanyc, tellg, tellp, is_open.

+ +

Related issue: 73

+ +

Proposed resolution:

+

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

+

Replace

+
+  bool is_open();
+
+

with

+
+  bool is_open() const;
+
+

Rationale:

+

Of the changes proposed in N1360, the only one that is safe is +changing the filestreams' is_open to const. The LWG believed that +this was NAD the first time it considered this issue (issue 73), but now thinks otherwise. The corresponding streambuf +member function, after all,is already const.

+ +

The other proposed changes are less safe, because some streambuf +functions that appear merely to report a value do actually perform +mutating operations. It's not even clear that they should be +considered "logically const", because streambuf has two interfaces, a +public one and a protected one. These functions may, and often do, +change the state as exposed by the protected interface, even if the +state exposed by the public interface is unchanged.

+ +

Note that implementers can make this change in a binary compatible +way by providing both overloads; this would be a conforming extension.

+ +
+

370. Minor error in basic_istream::get

Section: 27.6.1.3 [lib.istream.unformatted]  Status: WP  Submitter: Ray Lischner  Date: 15 Jul 2002

+

Defect report for description of basic_istream::get (section 27.6.1.3 [lib.istream.unformatted]), paragraph 15. The description for the get function with the following signature:

-
  basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>&
+
+  basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>&
   sb);
 
@@ -10083,28 +11331,26 @@ with the following signature:

Rationale:

Fixes an obvious typo.


-

373. Are basic_istream and basic_ostream to use (exceptions()&badbit) != 0 ?

-Section: 27.6.1.2.1 [lib.istream.formatted.reqmts], 27.6.2.5.1 [lib.ostream.formatted.reqmts]  Status: WP  Submitter: Keith Baker  Date: 23 Jul 2002

+

373. Are basic_istream and basic_ostream to use (exceptions()&badbit) != 0 ?

Section: 27.6.1.2.1 [lib.istream.formatted.reqmts], 27.6.2.5.1 [lib.ostream.formatted.reqmts]  Status: WP  Submitter: Keith Baker  Date: 23 Jul 2002

-In 27.6.1.2.1 [lib.istream.formatted.reqmts] and 27.6.2.5.1 [lib.ostream.formatted.reqmts] +In 27.6.1.2.1 [lib.istream.formatted.reqmts] and 27.6.2.5.1 [lib.ostream.formatted.reqmts] (exception()&badbit) != 0 is used in testing for rethrow, yet -exception() is the constructor to class std::exception in 18.6.1 [lib.exception] that has no return type. Should member function -exceptions() found in 27.4.4 [lib.ios] be used instead? +exception() is the constructor to class std::exception in 18.6.1 [lib.exception] that has no return type. Should member function +exceptions() found in 27.4.4 [lib.ios] be used instead?

Proposed resolution:

-In 27.6.1.2.1 [lib.istream.formatted.reqmts] and 27.6.2.5.1 [lib.ostream.formatted.reqmts], change +In 27.6.1.2.1 [lib.istream.formatted.reqmts] and 27.6.2.5.1 [lib.ostream.formatted.reqmts], change "(exception()&badbit) != 0" to "(exceptions()&badbit) != 0".

Rationale:

Fixes an obvious typo.


-

375. basic_ios should be ios_base in 27.7.1.3

-Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: WP  Submitter: Ray Lischner  Date: 14 Aug 2002

+

375. basic_ios should be ios_base in 27.7.1.3

Section: 27.7.1.3 [lib.stringbuf.virtuals]  Status: WP  Submitter: Ray Lischner  Date: 14 Aug 2002

-In Section 27.7.1.3 [lib.stringbuf.virtuals]: Table 90, Table 91, and paragraph +In Section 27.7.1.3 [lib.stringbuf.virtuals]: Table 90, Table 91, and paragraph 14 all contain references to "basic_ios::" which should be "ios_base::".

@@ -10116,10 +11362,53 @@ paragraph 14 to "ios_base".

Rationale:

Fixes an obvious typo.


-

380. typos in codecvt tables 53 and 54

-Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 6 Sep 2002

+

379. nonsensical ctype::do_widen() requirement

Section: 22.2.1.1.2 [lib.locale.ctype.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 6 Sep 2002

+

+The last sentence in 22.2.1.1.2, p11 below doesn't seem to make sense. +

+
+  charT do_widen (char c) const;
+
+  -11- Effects: Applies the simplest reasonable transformation from
+       a char value or sequence of char values to the corresponding
+       charT value or values. The only characters for which unique
+       transformations are required are those in the basic source
+       character set (2.2). For any named ctype category with a
+       ctype<charT> facet ctw and valid ctype_base::mask value
+       M (is(M, c) || !ctw.is(M, do_widen(c))) is true.
+
+

+Shouldn't the last sentence instead read +

+
+       For any named ctype category with a ctype<char> facet ctc
+       and valid ctype_base::mask value M
+       (ctc.is(M, c) || !is(M, do_widen(c))) is true.
+
+

+I.e., if the narrow character c is not a member of a class of +characters then neither is the widened form of c. (To paraphrase +footnote 224.) +

+

Proposed resolution:

+

+Replace the last sentence of 22.2.1.1.2 [lib.locale.ctype.virtuals], p11 with the +following text: +

+
+       For any named ctype category with a ctype<char> facet ctc
+       and valid ctype_base::mask value M,
+       (ctc.is(M, c) || !is(M, do_widen(c))) is true.
+
+ +

[Kona: Minor edit. Added a comma after the M for clarity.]

+ +

Rationale:

+

The LWG believes this is just a typo, and that this is the correct fix.

+
+

380. typos in codecvt tables 53 and 54

Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 6 Sep 2002

-Tables 53 and 54 in 22.2.1.5.2 [lib.locale.codecvt.virtuals] are both titled "convert +Tables 53 and 54 in 22.2.1.5.2 [lib.locale.codecvt.virtuals] are both titled "convert result values," when surely "do_in/do_out result values" must have been intended for Table 53 and "do_unshift result values" for Table 54. @@ -10144,8 +11433,7 @@ heading Meaning, to "space for more than (to_limit - to) destination elements was needed to terminate a sequence given the value of state."


-

381. detection of invalid mbstate_t in codecvt

-Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 6 Sep 2002

+

381. detection of invalid mbstate_t in codecvt

Section: 22.2.1.5.2 [lib.locale.codecvt.virtuals]  Status: WP  Submitter: Martin Sebor  Date: 6 Sep 2002

All but one codecvt member functions that take a state_type argument list as one of their preconditions that the state_type argument have @@ -10166,13 +11454,15 @@ cases, I propose the following: Add a new paragraph before 22.2.1.5.2, p5, and after the function declaration below

-
    result do_unshift(stateT& state,
+
+    result do_unshift(stateT& state,
     externT* to, externT* to_limit, externT*& to_next) const;
 

as follows:

-
    Requires: (to <= to_end) well defined and true; state initialized,
+
+    Requires: (to <= to_end) well defined and true; state initialized,
     if at the beginning of a sequence, or else equal to the result of
     converting the preceding characters in the sequence.
 
@@ -10180,12 +11470,14 @@ as follows: and change the text in Table 54, row 4, the error row, under the heading Meaning, from

-
    state has invalid value
+
+    state has invalid value
 

to

-
    an unspecified error has occurred
+
+    an unspecified error has occurred
 

Rationale:

The intent is that implementations should not be required to detect @@ -10195,8 +11487,7 @@ behavior. Implementations that do choose to detect invalid state values, or that choose to detect any other kind of error, may return error as an indication.


-

383. Bidirectional iterator assertion typo

-Section: 24.1.4 [lib.bidirectional.iterators]  Status: WP  Submitter: ysapir (submitted via comp.std.c++)  Date: 17 Oct 2002

+

383. Bidirectional iterator assertion typo

Section: 24.1.4 [lib.bidirectional.iterators]  Status: WP  Submitter: ysapir (submitted via comp.std.c++)  Date: 17 Oct 2002

Following a discussion on the boost list regarding end iterators and the possibility of performing operator--() on them, it seems to me @@ -10208,8 +11499,8 @@ with that discussion. I have checked this newsgroup, as well as attempted a search of the Active/Defect/Closed Issues List on the site for the words "s is derefer" so I believe this has not been proposed before. Furthermore, -the "Lists by Index" mentions only DR 299 on section -24.1.4, and DR 299 is not related to this issue. +the "Lists by Index" mentions only DR 299 on section +24.1.4, and DR 299 is not related to this issue.

@@ -10217,7 +11508,8 @@ The standard makes the following assertion on bidirectional iterators, in section 24.1.4 [lib.bidirectional.iterators], Table 75:

-
                         operational  assertion/note
+
+                         operational  assertion/note
 expression  return type   semantics    pre/post-condition
 
 --r          X&                        pre: there exists s such
@@ -10253,14 +11545,127 @@ Change the guarantee to "postcondition: r is dereferenceable."
 

Rationale:

Fixes an obvious typo


-

400. redundant type cast in lib.allocator.members

-Section: 20.4.1.1 [lib.allocator.members]  Status: WP  Submitter: Markus Mauhart  Date: 27 Feb 2003

+

389. Const overload of valarray::operator[] returns by value

Section: 26.3.2 [lib.template.valarray]  Status: WP  Submitter: Gabriel Dos Reis  Date: 8 Nov 2002

+

Consider the following program:

+
+    #include <iostream>
+    #include <ostream>
+    #include <vector>
+    #include <valarray>
+    #include <algorithm>
+    #include <iterator>
+    template<typename Array>
+    void print(const Array& a)
+    {
+    using namespace std;
+    typedef typename Array::value_type T;
+    copy(&a[0], &a[0] + a.size(),
+    ostream_iterator<T>(std::cout, " "));
+    }
+    template<typename T, unsigned N>
+    unsigned size(T(&)[N]) { return N; }
+    int main()
+    {
+    double array[] = { 0.89, 9.3, 7, 6.23 };
+    std::vector<double> v(array, array + size(array));
+    std::valarray<double> w(array, size(array));
+    print(v); // #1
+    std::cout << std::endl;
+    print(w); // #2
+    std::cout << std::endl;
+    }
+
+ +

While the call numbered #1 succeeds, the call numbered #2 fails +because the const version of the member function +valarray<T>::operator[](size_t) returns a value instead of a +const-reference. That seems to be so for no apparent reason, no +benefit. Not only does that defeats users' expectation but it also +does hinder existing software (written either in C or Fortran) +integration within programs written in C++. There is no reason why +subscripting an expression of type valarray<T> that is const-qualified +should not return a const T&.

+

Proposed resolution:

+

In the class synopsis in 26.3.2 [lib.template.valarray], and in +26.3.2.3 [lib.valarray.access] just above paragraph 1, change

+
+  T operator[](size_t const);
+
+

to

+
+  const T& operator[](size_t const);
+
+ +

[Kona: fixed a minor typo: put semicolon at the end of the line + wehre it belongs.]

+ +

Rationale:

+

Return by value seems to serve no purpose. Valaray was explicitly +designed to have a specified layout so that it could easily be +integrated with libraries in other languages, and return by value +defeats that purpose. It is believed that this change will have no +impact on allowable optimizations.

+
+

391. non-member functions specified as const

Section: 22.1.3.2 [lib.conversions]  Status: WP  Submitter: James Kanze  Date: 10 Dec 2002

+

+The specifications of toupper and tolower both specify the functions as +const, althought they are not member functions, and are not specified as +const in the header file synopsis in section 22.1 [lib.locales]. +

+

Proposed resolution:

+

In 22.1.3.2 [lib.conversions], remove const from the function + declarations of std::toupper and std::tolower

+

Rationale:

+

Fixes an obvious typo

+
+

395. inconsistencies in the definitions of rand() and random_shuffle()

Section: 26.5 [lib.c.math]  Status: WP  Submitter: James Kanze  Date: 3 Jan 2003

+

+In 26.5 [lib.c.math], the C++ standard refers to the C standard for the +definition of rand(); in the C standard, it is written that "The +implementation shall behave as if no library function calls the rand +function." +

+ +

+In 25.2.11 [lib.alg.random.shuffle], there is no specification as to +how the two parameter version of the function generates its random +value. I believe that all current implementations in fact call rand() +(in contradiction with the requirement avove); if an implementation does +not call rand(), there is the question of how whatever random generator +it does use is seeded. Something is missing. +

+ +

Proposed resolution:

+

+In [lib.c.math], add a paragraph specifying that the C definition of +rand shal be modified to say that "Unless otherwise specified, the +implementation shall behave as if no library function calls the rand +function." +

+ +

+In [lib.alg.random.shuffle], add a sentence to the effect that "In +the two argument form of the function, the underlying source of +random numbers is implementation defined. [Note: in particular, an +implementation is permitted to use rand.] +

+

Rationale:

+

The original proposed resolution proposed requiring the + two-argument from of random_shuffle to + use rand. We don't want to do that, because some existing + implementations already use something else: gcc + uses lrand48, for example. Using rand presents a + problem if the number of elements in the sequence is greater than + RAND_MAX.

+
+

400. redundant type cast in lib.allocator.members

Section: 20.4.1.1 [lib.allocator.members]  Status: WP  Submitter: Markus Mauhart  Date: 27 Feb 2003

-20.4.1.1 [lib.allocator.members] allocator members, contains +20.4.1.1 [lib.allocator.members] allocator members, contains the following 3 lines:

-
  12 Returns: new((void *) p) T( val)
+
+  12 Returns: new((void *) p) T( val)
      void destroy(pointer p);
   13 Returns: ((T*) p)->~T()
 
@@ -10275,5 +11680,321 @@ Replace "((T*) p)" with "p".

Rationale:

Just a typo, this is really editorial.

+
+

402. wrong new expression in [some_]allocator::construct

Section: 20.1.5 [lib.allocator.requirements], 20.4.1.1 [lib.allocator.members],   Status: WP  Submitter: Markus Mauhart  Date: 27 Feb 2003

+

+This applies to the new expression that is contained in both par12 of +20.4.1.1 [lib.allocator.members] and in par2 (table 32) of 20.1.5 [lib.allocator.requirements]. +I think this new expression is wrong, involving unintended side +effects. +

+ + +

20.4.1.1 [lib.allocator.members] contains the following 3 lines:

+ +
+  11 Returns: the largest value N for which the call allocate(N,0) might succeed.
+     void construct(pointer p, const_reference val);
+  12 Returns: new((void *) p) T( val)
+
+ + +

20.1.5 [lib.allocator.requirements] in table 32 has the following line:

+
+  a.construct(p,t)   Effect: new((void*)p) T(t)
+
+ +

+.... with the prerequisits coming from the preceding two paragraphs, +especially from table 31: +

+ +
+  alloc<T>             a     ;// an allocator for T
+  alloc<T>::pointer    p     ;// random access iterator
+                              // (may be different from T*)
+  alloc<T>::reference  r = *p;// T&
+  T const&             t     ;
+
+ +

+Cause of using "new" but not "::new", any existing "T::operator new" +function will hide the global placement new function. When there is no +"T::operator new" with adequate signature, +every_alloc<T>::construct(..) is ill-formed, and most +std::container<T,every_alloc<T>> use it; a workaround +would be adding placement new and delete functions with adequate +signature and semantic to class T, but class T might come from another +party. Maybe even worse is the case when T has placement new and +delete functions with adequate signature but with "unknown" semantic: +I dont like to speculate about it, but whoever implements +any_container<T,any_alloc> and wants to use construct(..) +probably must think about it. +

+

Proposed resolution:

+

+Replace "new" with "::new" in both cases. +

+
+

403. basic_string::swap should not throw exceptions

Section: 21.3.5.8 [lib.string::swap]  Status: WP  Submitter: Beman Dawes  Date: 25 Mar 2003

+ +

+std::basic_string, 21.3 [lib.basic.string] paragraph 2 says that +basic_string "conforms to the requirements of a Sequence, as specified +in (23.1.1)." The sequence requirements specified in (23.1.1) to not +include any prohibition on swap members throwing exceptions. +

+ +

+Section 23.1 [lib.container.requirements] paragraph 10 does limit conditions under +which exceptions may be thrown, but applies only to "all container +types defined in this clause" and so excludes basic_string::swap +because it is defined elsewhere. +

+ +

+Eric Niebler points out that 21.3 [lib.basic.string] paragraph 5 explicitly +permits basic_string::swap to invalidates iterators, which is +disallowed by 23.1 [lib.container.requirements] paragraph 10. Thus the standard would +be contradictory if it were read or extended to read as having +basic_string meet 23.1 [lib.container.requirements] paragraph 10 requirements. +

+ +

+Yet several LWG members have expressed the belief that the original +intent was that basic_string::swap should not throw exceptions as +specified by 23.1 [lib.container.requirements] paragraph 10, and that the standard is +unclear on this issue. The complexity of basic_string::swap is +specified as "constant time", indicating the intent was to avoid +copying (which could cause a bad_alloc or other exception). An +important use of swap is to ensure that exceptions are not thrown in +exception-safe code. +

+ +

+Note: There remains long standing concern over whether or not it is +possible to reasonably meet the 23.1 [lib.container.requirements] paragraph 10 swap +requirements when allocators are unequal. The specification of +basic_string::swap exception requirements is in no way intended to +address, prejudice, or otherwise impact that concern. +

+ + + + + +

Proposed resolution:

+

+In 21.3.5.8 [lib.string::swap], add a throws clause: +

+ +

+Throws: Shall not throw exceptions. +

+
+

404. May a replacement allocation function be declared inline?

Section: 17.4.3.4 [lib.replacement.functions], 18.4.1 [lib.new.delete]  Status: WP  Submitter: Matt Austern  Date: 24 Apr 2003

+

+The eight basic dynamic memory allocation functions (single-object +and array versions of ::operator new and ::operator delete, in the +ordinary and nothrow forms) are replaceable. A C++ program may +provide an alternative definition for any of them, which will be used +in preference to the implementation's definition. +

+ +

+Three different parts of the standard mention requirements on +replacement functions: 17.4.3.4 [lib.replacement.functions], 18.4.1.1 [lib.new.delete.single] +and 18.4.1.2 [lib.new.delete.array], and 3.7.3 [basic.stc.dynamic]. +

+ +

None of these three places say whether a replacement function may + be declared inline. 18.4.1.1 [lib.new.delete.single] paragraph 2 specifies a + signature for the replacement function, but that's not enough: + the inline specifier is not part of a function's signature. + One might also reason from 7.1.2 [dcl.fct.spec] paragraph 2, which + requires that "an inline function shall be defined in every + translation unit in which it is used," but this may not be quite + specific enough either. We should either explicitly allow or + explicitly forbid inline replacement memory allocation + functions.

+

Proposed resolution:

+

+Add a new sentence to the end of 17.4.3.4 [lib.replacement.functions] paragraph 3: +"The program's definitions shall not be specified as inline. +No diagnostic is required." +

+ +

[Kona: added "no diagnostic is required"]

+ +

Rationale:

+

+The fact that inline isn't mentioned appears to have been +nothing more than an oversight. Existing implementations do not +permit inline functions as replacement memory allocation functions. +Providing this functionality would be difficult in some cases, and is +believed to be of limited value. +

+
+

407. Can singular iterators be destroyed?

Section: 24.1 [lib.iterator.requirements]  Status: WP  Submitter: Nathan Myers  Date: 3 June 2003

+

+Clause 24.1 [lib.iterator.requirements], paragraph 5, says that the only expression +that is defined for a singular iterator is "an assignment of a +non-singular value to an iterator that holds a singular value". This +means that destroying a singular iterator (e.g. letting an automatic +variable go out of scope) is technically undefined behavior. This +seems overly strict, and probably unintentional. +

+

Proposed resolution:

+

+Change the sentence in question to "... the only exceptions are +destroying an iterator that holds a singular value, or the assignment +of a non-singular value to an iterator that holds a singular value." +

+
+

411. Wrong names of set member functions

Section: 25.3.5 [lib.alg.set.operations]  Status: WP  Submitter: Daniel Frey  Date: 9 Jul 2003

+

+25.3.5 [lib.alg.set.operations] paragraph 1 reads: +"The semantics of the set operations are generalized to multisets in a +standard way by defining union() to contain the maximum number of +occurrences of every element, intersection() to contain the minimum, and +so on." +

+ +

+This is wrong. The name of the functions are set_union() and +set_intersection(), not union() and intersection(). +

+

Proposed resolution:

+

Change that sentence to use the correct names.

+
+

414. Which iterators are invalidated by v.erase()?

Section: 23.2.4.3 [lib.vector.modifiers]  Status: WP  Submitter: Matt Austern  Date: 19 Aug 2003

+

+Consider the following code fragment: +

+
+
+int A[8] = { 1,3,5,7,9,8,4,2 };
+std::vector<int> v(A, A+8);
+
+std::vector<int>::iterator i1 = v.begin() + 3;
+std::vector<int>::iterator i2 = v.begin() + 4;
+v.erase(i1);
+
+
+ +

+Which iterators are invalidated by v.erase(i1): i1, i2, +both, or neither? +

+ +

+On all existing implementations that I know of, the status of i1 and +i2 is the same: both of them will be iterators that point to some +elements of the vector (albeit not the same elements they did +before). You won't get a crash if you use them. Depending on +exactly what you mean by "invalidate", you might say that neither one +has been invalidated because they still point to something, +or you might say that both have been invalidated because in both +cases the elements they point to have been changed out from under the +iterator. +

+ +

+The standard doesn't say either of those things. It says that erase +invalidates all iterators and references "after the point of the +erase". This doesn't include i1, since it's at the point of the +erase instead of after it. I can't think of any sensible definition +of invalidation by which one can say that i2 is invalidated but i1 +isn't. +

+ +

+(This issue is important if you try to reason about iterator validity +based only on the guarantees in the standard, rather than reasoning +from typical implementation techniques. Strict debugging modes, +which some programmers find useful, do not use typical implementation +techniques.) +

+

Proposed resolution:

+

+In 23.2.4.3 [lib.vector.modifiers] paragraph 3, change "Invalidates all the +iterators and references after the point of the erase" to +"Invalidates iterators and references at or after the point of the +erase". +

+

Rationale:

+

I believe this was essentially a typographical error, and that it + was taken for granted that erasing an element invalidates iterators + that point to it. The effects clause in question treats iterators + and references in parallel, and it would seem counterintuitive to + say that a reference to an erased value remains valid.

+
+

420. is std::FILE a complete type?

Section: 27.8.1 [lib.fstreams]  Status: WP  Submitter: Martin Sebor  Date: 18 Sep 2003

+

+7.19.1, p2, of C99 requires that the FILE type only be declared in +<stdio.h>. None of the (implementation-defined) members of the +struct is mentioned anywhere for obvious reasons. +

+ +

+C++ says in 27.8.1, p2 that FILE is a type that's defined in <cstdio>. Is +it really the intent that FILE be a complete type or is an implementation +allowed to just declare it without providing a full definition? +

+

Proposed resolution:

+

In the first sentence of 27.8.1 [lib.fstreams] paragraph 2, change + "defined" to "declared".

+

Rationale:

+

We don't want to impose any restrictions beyond what the C standard + already says. We don't want to make anything implementation defined, + because that imposes new requirements in implementations.

+
+

428. string::erase(iterator) validity

Section: 21.3.5.5 [lib.string::erase]  Status: WP  Submitter: Martin Sebor  Date: 18 Sep 2003

+

+23.1.1, p3 along with Table 67 specify as a prerequisite for a.erase(q) +that q must be a valid dereferenceable iterator into the sequence a. +

+ +

+However, 21.3.5.5, p5 describing string::erase(p) only requires that +p be a valid iterator. +

+ +

+This may be interepreted as a relaxation of the general requirement, +which is most likely not the intent. +

+

Proposed resolution:

+

Remove 21.3.5.5 [lib.string::erase] paragraph 5.

+

Rationale:

+

The LWG considered two options: changing the string requirements to + match the general container requirements, or just removing the + erroneous string requirements altogether. The LWG chose the latter + option, on the grounds that duplicating text always risks the + possibility that it might be duplicated incorrectly.

+
+

436. are cv-qualified facet types valid facets?

Section: 22.1.1.1.2 [lib.locale.facet]  Status: WP  Submitter: Martin Sebor  Date: 15 Oct 2003

+

+Is "const std::ctype<char>" a valid template argument to has_facet, use_facet, +and the locale template ctor? And if so, does it designate the same Facet as +the non-const "std::ctype<char>?" What about "volatile std::ctype<char>?" +Different implementations behave differently: some fail to compile, others +accept such types but behave inconsistently. +

+

Proposed resolution:

+

Change 22.1.1.1.2, p1 to read:

+ +

Template parameters in this clause which are required to be facets +are those named Facet in declarations. A program that passes a type +that is not a facet, or a type that refers to volatile-qualified +facet, as an (explicit or deduced) template parameter to a locale +function expecting a facet, is ill-formed. A const-qualified facet is +a valid template argument to any locale function that expects a Facet +template parameter.

+ +

[Kona: changed the last sentence from a footnote to normative +text.]

+

----- End of document -----

- \ No newline at end of file + + -- 2.30.2