This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
Section: 31.7.9 [quoted.manip] Status: C++14 Submitter: Marshall Clow Opened: 2013-07-12 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [quoted.manip].
View all issues with C++14 status.
Discussion:
In 31.7.9 [quoted.manip] p2 b2:
— Each character in s. If the character to be output is equal to escape or delim, as determined by operator==, first output escape.
In 31.7.9 [quoted.manip] p3 b1 sb1:
— If the first character extracted is equal to delim, as determined by operator==, […]
these should both use traits::eq.
Also, I believe that 31.7.9 [quoted.manip] p3 implies that:
std::ostream _stream; std::string _string; _stream << _string; _stream << quoted(_string);
should both compile, or both fail to compile, based on whether or not their char_traits match. But I believe that the standard should say that explicitly.
[ 2013-09 Chicago ]
Marshall Clow improved the wording with support from Stefanus.
[ 2013-09 Chicago (late night issues) ]
Moved to Ready, after confirming wording correctly reflects discussion earlier in the day.
Proposed resolution:
This wording is relative to N3691.
Change 31.7.9 [quoted.manip] p2+3 as indicated:
template <class charT> unspecified quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); template <class charT, class traits, class Allocator> unspecified quoted(const basic_string<charT, traits, Allocator>& s, charT delim=charT('"'), charT escape=charT('\\'));-2- Returns: An object of unspecified type such that if out is an instance of basic_ostream with member type char_type the same as charT and with member type traits_type, which in the second form is the same as traits, then the expression out << quoted(s, delim, escape) behaves as if it inserts the following characters into out using character inserter function templates (27.7.3.6.4), which may throw ios_base::failure (27.5.3.1.1):
delim
Each character in s. If the character to be output is equal to escape or delim, as determined by
operator==traits_type::eq, first output escape.delim
template <class charT, class traits, class Allocator> unspecified quoted(basic_string<charT, traits, Allocator>& s, charT delim=charT('"'), charT escape=charT('\\'));-3- Returns: An object of unspecified type such that:
If in is an instance of basic_istream with member types char_type and traits_type the same as charT and traits, respectively, then the expression in >> quoted(s, delim, escape) behaves as if it extracts the following characters from in using basic_istream::operator>> (27.7.2.2.3) which may throw ios_base::failure (27.5.3.1.1):
If the first character extracted is equal to delim, as determined by
operator==traits_type::eq, then: […]If out is an instance of basic_ostream with member types char_type and traits_type the same as charT and traits, respectively, then the expression out << quoted(s, delim, escape) behaves as specified for the const basic_string<charT, traits, Allocator>& overload of the quoted function.