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 12/17/2013 11:06 AM, Peter A. Bigot wrote:
On 11/20/2013 08:09 AM, Ed Smith-Rowland wrote:On 11/18/2013 09:08 AM, Daniel Krügler wrote:2013/11/15 Ed Smith-Rowland <3dw4rd@verizon.net>:Sorry, if this is documented somewhere, but is this intended to implementGreetings,As the title says. It's a pretty simple class" a non-mutating read-onlyview into a const CharT* or a basic_string. Built and tested on x86_64-linux. OK?http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3762.html ? I don't think that your implementation is valid, because it maps an empty string view into a NULL data pointer. But according to the specification of data() the return type, this isn't feasible: <quote> constexpr const charT* data() const noexcept; Returns: A non-null pointer p such that p + i == &operator[](i) for each i in [0,size()). </quote> - DanielRight. Here is a fix that introduces an constexpr unit length string to represent empty strings so that refs to empty strings don't point to the ether.Thanks for providing this feature; I'm finding it very useful. There's a small problem with this fix in that some zero-length string_views should remain pointing into the referenced object, and not be remapped to the constexpr one. This showed up after fixing a boundary condition problem with substr, recorded in: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59529 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59530 notes a similar problem with operator[], and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59531 fixes a buffer overrun in copy(). Proposed patches are attached to each issue. Peter
I've looked over these patches (thanks Peter!) and tweaked up a couple patches (no need to leave commented out tests, and copy can start from pos=length()).
I'm finishing testing on x86_64-linux.Paolo, are there any Copyright issues we need to be aware of? Does Peter need a Copyright form? These are fairly obvious one-liners I think. There are no real alternatives to these patches. What ChangeLog attribution is appropriate?
Ed
Attachment:
CL_string_ref
Description: Text document
Attachment:
patch_string_ref
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |