2755. §[string.view.io] uses non-existent basic_string_view::to_string function

Section: 24.4.4 [string.view.io], 24.3.3.9 [string.io] Status: C++17 Submitter: Billy Baker Opened: 2016-07-26 Last modified: 2017-07-30

Priority: 0

View all issues with C++17 status.

Discussion:

In looking at N4606, [string.view.io] has an Effects clause that references basic_string_view::to_string which no longer exists after the application of P0254R2.

[2016-07-26, Marshall suggests concrete wording]

[2016-07 Chicago LWG]

Monday: P0 - tentatively ready

Proposed resolution:

This wording is relative to N4606.

  1. Modify 24.3.3.9 [string.io] as indicated:

    template<class charT, class traits, class Allocator>
      basic_ostream<charT, traits>&
        operator<<(basic_ostream<charT, traits>& os,
                   const basic_string<charT, traits, Allocator>& str);
    

    -5- Effects: Equivalent to: return os << basic_string_view<charT, traits>(str);Behaves as a formatted output function (30.7.5.2.1 [ostream.formatted.reqmts]) of os. Forms a character sequence seq, initially consisting of the elements defined by the range [str.begin(), str.end()). Determines padding for seq as described in 30.7.5.2.1 [ostream.formatted.reqmts]. Then inserts seq as if by calling os.rdbuf()->sputn(seq, n), where n is the larger of os.width() and str.size(); then calls os.width(0).

    -6- Returns: os

  2. Modify 24.4.4 [string.view.io] as indicated:

    template<class charT, class traits>
      basic_ostream<charT, traits>&
        operator<<(basic_ostream<charT, traits>& os,
                   basic_string_view<charT, traits> str);
    

    -1- Effects: Equivalent to: return os << str.to_string();Behaves as a formatted output function (30.7.5.2.1 [ostream.formatted.reqmts]) of os. Forms a character sequence seq, initially consisting of the elements defined by the range [str.begin(), str.end()). Determines padding for seq as described in 30.7.5.2.1 [ostream.formatted.reqmts]. Then inserts seq as if by calling os.rdbuf()->sputn(seq, n), where n is the larger of os.width() and str.size(); then calls os.width(0).

    -?- Returns: os