1113. bitset::to_string could be simplified

Section: 22.9.2 [template.bitset] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-05-09 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [template.bitset].

View all issues with C++11 status.

Discussion:

In 853 our resolution is changing the signature by adding two defaulting arguments to 3 calls. In principle, this means that ABI breakage is not an issue, while API is preserved.

With that observation, it would be very nice to use the new ability to supply default template parameters to function templates to collapse all 3 signatures into 1. In that spirit, this issue offers an alternative resolution than that of 853.

[ Batavia (2009-05): ]

Move to Open, and look at the issue again after 853 has been accepted. We further recommend this be deferred until after the next Committee Draft.

[ 2009-10 post-Santa Cruz: ]

Move to Tentatively Ready.

Proposed resolution:

  1. In 22.9.2 [template.bitset]/1 (class bitset) ammend:

    template <class charT = char,
                class traits = char_traits<charT>,
                class Allocator = allocator<charT>> 
      basic_string<charT, traits, Allocator>
      to_string(charT zero = charT('0'), charT one = charT('1')) const;
    template <class charT, class traits> 
      basic_string<charT, traits, allocator<charT> > to_string() const; 
    template <class charT> 
      basic_string<charT, char_traits<charT>, allocator<charT> > to_string() const; 
    basic_string<char, char_traits<char>, allocator<char> > to_string() const;
    
  2. In 22.9.2.3 [bitset.members] prior to p35 ammend:

    template <class charT = char,
                class traits = char_traits<charT>,
                class Allocator = allocator<charT>> 
      basic_string<charT, traits, Allocator>
      to_string(charT zero = charT('0'), charT one = charT('1')) const;
    
  3. Strike 22.9.2.3 [bitset.members] paragraphs 37 -> 39 (including signature above 37)