This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

853. to_string needs updating with zero and one

Section: 22.9.2 [template.bitset] Status: C++11 Submitter: Howard Hinnant Opened: 2008-06-18 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [template.bitset].

View all issues with C++11 status.

Discussion:

Issue 396(i) adds defaulted arguments to the to_string member, but neglects to update the three newer to_string overloads.

[ post San Francisco: ]

Daniel found problems with the wording and provided fixes. Moved from Ready to Review.

[ Post Summit: ]

Alisdair: suggest to not repeat the default arguments in B, C, D (definition of to_string members)

Walter: This is not really a definition.

Consensus: Add note to the editor: Please apply editor's judgement whether default arguments should be repeated for B, C, D changes.

Recommend Tentatively Ready.

[ 2009-05-09: See alternative solution in issue 1113(i). ]

Proposed resolution:

  1. replace in 22.9.2 [template.bitset]/1 (class bitset)

    template <class charT, class traits>
      basic_string<charT, traits, allocator<charT> >
      to_string(charT zero = charT('0'), charT one = charT('1')) const;
    template <class charT>
      basic_string<charT, char_traits<charT>, allocator<charT> >
      to_string(charT zero = charT('0'), charT one = charT('1')) const;
    basic_string<char, char_traits<char>, allocator<char> >
      to_string(char zero = '0', char one = '1') const;
    
  2. replace in 22.9.2.3 [bitset.members]/37

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

    37 Returns: to_string<charT, traits, allocator<charT> >(zero, one).

  3. replace in 22.9.2.3 [bitset.members]/38

    template <class charT>
      basic_string<charT, char_traits<charT>, allocator<charT> >
      to_string(charT zero = charT('0'), charT one = charT('1')) const;
    

    38 Returns: to_string<charT, char_traits<charT>, allocator<charT> >(zero, one).

  4. replace in 22.9.2.3 [bitset.members]/39

    basic_string<char, char_traits<char>, allocator<char> >
      to_string(char zero = '0', char one = '1') const;
    

    39 Returns: to_string<char, char_traits<char>, allocator<char> >(zero, one).