This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 06/06/2013 10:55 AM, Ed Smith-Rowland wrote:
On 06/05/2013 04:01 PM, Jonathan Wakely wrote:Certainly. I forgot that in the last literals patch. I'll fix that after I finish this one. (I just noticed junk comments in the testcases for literals also).On 5 June 2013 20:18, Ed Smith-Rowland wrote:Greetings, This patch implements quoted string manipulators for C++14. 27.7.6 - Quoted manipulators [quoted.manip].The idea is to allow round trip insert and extract of strings with spaces.std::stringstream ss; std::string original = "thing1 thing1"; std::string round_trip; ss << std::quoted(original); ss >> std::quoted(round_trip); assert( original == round_trip ); Builds and tests clean on x86-64-linux.As I suggested for your literals patch, couldn't the test for: #if __cplusplus > 201103L go inside the existing one? i.e. #if __cplusplus >= 201103L [...] #if __cplusplus > 201103L [...] #endif #endifI looks that way. But all used of the template parm String are either references or pointers so these operations should be efficient._Quoted_string appears to do two copies of the string, one for the constructor argument and one for the member variable, do they definitely get elided?_Quoted_string should be used as a non-owning string thing.The members of _Quoted_string should be named _M_xxx not __xxx, to follow the coding style guidelines.Done.What is __delim2 for? What if the first extraction in the operator>> fails, is doing __is.unget() the right thing to do?Thanks. I'll return with __is rather than attempting to continue reading.For some reason I forgot about auto return type in C++14. It sure cleans things up nicely. Done.You could simplify the quoted() overloads by using auto return type deduction, is it an intentional choice not to use that?Rebuilt and retested on x86_64
OK, I added a static_assert to check that _String is only reference or pointer. I also added a tests that check the case where _String is 'const basic_string<>&'.
Built and tested on x86_64-linux. OK? Ed
Attachment:
CL_quoted
Description: Text document
Attachment:
patch_quoted3
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |